Quake3World.com Forums
     Programming Discussion
        Advice on bug hunting?


Post new topicReply to topic
Login | Profile | | FAQ | Search | IRC




Print view Previous topic | Next topic 
Topic Starter Topic: Advice on bug hunting?

Grunt
Grunt
Joined: 25 Nov 2009
Posts: 65
PostPosted: 10-19-2011 01:19 PM           Profile Send private message  E-mail  Edit post Reply with quote


My mod has some issue in the code whereby the server hangs and takes 100% cpu. In the server console, all you see is whatever was happening normally prior to that. The hanging doesn't stop after a minute, it continues probably forever.

Do you guys have any advice on how I should go about finding this bug?

Certainly I want to try to replicate the circumstances of triggering the bug, but, so far it appears extremely random.




Top
                 

Cool #9
Cool #9
Joined: 01 Dec 2000
Posts: 44138
PostPosted: 10-20-2011 12:36 AM           Profile   Send private message  E-mail  Edit post Reply with quote


I haven't had the situation where I introduced really hard to detect bugs in my mod yet, so I usually have a vague idea what's probably going wrong. If I'm not sure where the offending line of code is, I just comment out portions of code where I suspect the bug is. I then reintroduce portions of code to see what exactly is happening and use a lot of Printf's to dump debugging info to the console. At one point a section of code is reintroduced and the game hangs again, then I can pinpoint exactly which line of code causes the hang or crash.

The problem with hangs or crashes is that (as far as I know) there's no external logging available so it's impossible to look at some log and see what's going wrong. So the first thing I'm trying to do is to prevent the crash from happening and just dump info to the console to see if I can find any irregularities or odd values.

In your case though, if the bug appears to be occurring randomly, this method might not be useful because you don't know if the bug doesn't happen due to the offending code not being executed or because it's just not the right situation for the bug to occur.

Do you see any patterns in when the bug is occuring? Try to filter out as much "junk" as you can. If the bug occurs in a full fledged map for the mod, see if you can create a box map in which you can cause the crash to happen.




Top
                 

Mentor
Mentor
Joined: 12 Mar 2005
Posts: 3958
PostPosted: 10-20-2011 06:43 AM           Profile Send private message  E-mail  Edit post Reply with quote


Attach a debugger (gdb, msvc) and break when the program hangs.




Top
                 

Grunt
Grunt
Joined: 25 Nov 2009
Posts: 65
PostPosted: 10-22-2011 11:10 PM           Profile Send private message  E-mail  Edit post Reply with quote


Yeah... I tried to figure out how to do that once and failed. But I may need to end up figuring out how to do that.




Top
                 
Quake3World.com | Forum Index | Programming Discussion


Post new topic Reply to topic


cron
Quake3World.com
© ZeniMax. Zenimax, QUAKE III ARENA, Id Software and associated trademarks are trademarks of the ZeniMax group of companies. All rights reserved.
This is an unofficial fan website without any affiliation with or endorsement by ZeniMax.
All views and opinions expressed are those of the author.