Show me how you debug.

Not about OpenMW? Just about Morrowind in general? Have some random babble? Kindly direct it here.
User avatar
Svetomech
Posts: 69
Joined: 01 Jun 2014, 12:51
Location: Moscow
Contact:

Re: Show me how you debug.

Post by Svetomech »

sirherrbatka wrote:lack of GC
Does it even need one?
User avatar
wareya
Posts: 338
Joined: 09 May 2015, 13:07

Re: Show me how you debug.

Post by wareya »

Regression tests* and a sea of print statements: https://github.com/wareya/Spark-Reader/ ... e.java#L28

I only use debuggers for crashes and reverse engineering, basically. I generally don't work on stuff unless I understand it well architecturally, so (aside from crashes) I never end up a bug that I know where it happens but not how it works, only bugs I understand completely and bugs I don't understand at all.

* Not unit tests. Regression tests help make sure that existing systems don't break when you change them, unit tests ensure that new systems act as specified. I've never been able to use unit tests since I constantly rewrite everything I make and there's no really specificity to it.
bidik
Posts: 24
Joined: 28 Apr 2017, 12:06

Re: Show me how you debug.

Post by bidik »

Thought the discussion stopped, and then noticied those 1 2 3 4 in the corner, lol.

You moved to discussing C#, but I'm interested in OpenMW development, and thus I'm tied to C++ for now. Not even going to think about C# until I find a way of compiling C# to native code.

I'm afraid of opening source code of OpenMW and not being able to understand anything. I suspect that a good debugger is necessary when trying to understand how code works, this is why I asked how people debug.

Also, any tips for understanding someone else's source code? I'm almost never was able to understand a source code downloaded from somewhere, maybe just reading it isn't enough after all.
Naugrim
Posts: 172
Joined: 08 Jan 2016, 01:32
Location: Spain

Re: Show me how you debug.

Post by Naugrim »

bidik wrote: I'm afraid of opening source code of OpenMW and not being able to understand anything.
Life would be too easy and boring otherwise ;) Just give it a try.
bidik wrote: I suspect that a good debugger is necessary when trying to understand how code works, this is why I asked how people debug.
Also, any tips for understanding someone else's source code? I'm almost never was able to understand a source code downloaded from somewhere, maybe just reading it isn't enough after all.
Debugging helps when focusing on some low level detail, e.g. identify some bug (sometimes) but it shouldn't be abused. Best approach is to go from high level of detail to lower level.

When approaching a code project, specially if it's a big one I follow this steps:
1. Take a deep breath and assume I won't understand anything until some time has been spent.
2. Pray for documentation.
3. Find documentation (if any) and confirm it's mostly useless.
4. Try to understand the overall build process and overall structure, really at high level: it is a big-fat package or submodules? is the code organized in directories in some ways? what's the building tool? is there a script i can use to built & test? do I need to install something manually or it is self-contained?
5. How can I interact with it: is it a shell tool? has some GUI? web services interface(s)?
6. Identify the execution flow: is it single or multi-thread? has asynchronous components? some big loop or batch process?

After that I can get some idea of the project, and then I just focus on some specific part I want to check. Maybe then I really go into the code and debug, or even better I make assumptions, change something and then run it. Most of the time it crashes but I learn something everytime.
bidik
Posts: 24
Joined: 28 Apr 2017, 12:06

Re: Show me how you debug.

Post by bidik »

Time to compile something, I guess. Never had much luck with it too, programs done with visual studio 2010 not always compile smoothly with visual studio 2015, and often there is some weird build script that just doesn't finish.

Last time I tried to compile something, I stopped after reading on their wiki that I need a lot of free space on my harddrive.

I probably should limit myself with OpenMW for now. Hm, I probably wouldn't try to compile OpenMW, too bothersome, and devteam probably have enough programmers already. I'm curious if there's something interesting in the code, but I'm not ready to commit lots of my time for it, I guess.
User avatar
sirherrbatka
Posts: 2159
Joined: 07 Aug 2011, 17:21

Re: Show me how you debug.

Post by sirherrbatka »

Does it even need one?
If you are going with full copy on write inmutable data structures, you will want to have GC. And not just conservative GC, but compacting GC. You need to have fast allocation, you don't want to have memory fragmentation. GC is the way to go here.
bidik
Posts: 24
Joined: 28 Apr 2017, 12:06

Re: Show me how you debug.

Post by bidik »

Tried to install Visual Studio C++ 6.0.

Really liked the size of it, only 86 MiB.

But I got error during installation.

"This product ships with the matching localized language version of Service Pack 3 for Windows NT 4. The localized version of your installed windows Operating system does not match the localized language version of this product. We recommend that you quit setup and install service pack 3 for Windows NT 4 from another source. You may find it at http://www.microsoft.com. Re-rerun Setup after applying the service pack and rebooting your PC."

Found this thread http://www.vbforums.com/showthread.php? ... -language)

Looks like this error is due to the language of my windows 7 interface not being english, and VS expecting english.

Tried to install english language with Vistalizator, there was some error again, so I gave up here.

A few months ago I tried installing Visual Studio 2015, it installed fine (after downloading 4 GiB of something and filling my installed program list with 20 different subpackages), and then bugged up during the registration. It stopped reacting after I typed in my new login and password.

Maybe I should try Visual Studio 2010 next.
bidik
Posts: 24
Joined: 28 Apr 2017, 12:06

Re: Show me how you debug.

Post by bidik »

Thought about getting CLion trial for 1 month and releasing something opensource in that time. But no, it must be at least 3 months old.

There is a student license for it, but it requires ISIC card, it's not available for ‎extramural students.

Sucks, huh.

Strange that nobody mentioned CodeBlocks yet.
bidik
Posts: 24
Joined: 28 Apr 2017, 12:06

Re: Show me how you debug.

Post by bidik »

Visual Studio 2010 installed, but 15 seconds after trying to compile something, it crashes with some exception in devenv.exe. I don't know why. Reading some random webpage about visual studio crashes, maybe something interesting is in there.
Post Reply