Game Development Community

Debugging technique for infinite loop

by Chris Robertson · in Technical Issues · 04/09/2005 (4:35 pm) · 7 replies

After some period of time, a TGE application I am running hangs. My machine is still alive, and I can use the task manager to close it, but the application is no longer processing input or updating the display. This sounds like the app is stuck in a loop somewhere, but I'm having trouble tracking down where exactly it might be.

I have not observed any pattern to why or when it occurs.

I have the source code, but when I reproduce the problem while running the MSVC debugger, I just get a bunch of win32 assembly code when I hit F12, and I can't seem to find where in the application source code I am.

Anyone have any tips/techniques for such a problem?

#1
04/10/2005 (2:30 am)
Are you running a debug build? If not then you will not get symbols etc. If you are, check the call stack. Hit the manual pause, then resume a few times, just to make sure. Otherwise, grab a journal and play it back.

torqueExe.exe -jSave journal.jrn

you can play it back with

torqueExe.exe -jPlay journal.jrn

That will re-create the events that lead to the loop. Good luck.
#2
04/10/2005 (2:07 pm)
Hi Pat,

Yes, I'm running a debug build. The problem is that when I hit the manual breakpoint, I end up somewhere in win32 code, not in my application source code.

The callstack contains things like:
USER32
KERNEL32

What I really want, is to know where the program counter (PC) is while my application is locked up. Then I could set a breakpoint there and step into the source code.
#3
04/10/2005 (2:13 pm)
@Chris

It is perfectly natural for your call stack to contain USER32 and KERNEL32 calls as these are operating system dlls.

Do a cut and paste of your call stack and we'll see if we can at least point you in the right direction.
#4
04/10/2005 (2:16 pm)
The cut/paste is a good idea, but should be done in a private forum area.
#5
04/10/2005 (2:24 pm)
Hi Peter,

I understand that the USER32 and KERNEL32 calls are normal, my problem is that they are the only items in the call stack, so I can't find where in my application source code the problem is.

The cut and paste will have to wait a little, as I'm not at my home pc right now.
#6
04/10/2005 (3:07 pm)
On thing that could help is installing the OS debug symbols for Windows. This will at least tell you in what Win32 API function your in. This should help at least narrow down if it's file access, input, D3D, etc.
#7
11/01/2006 (10:38 am)
I just hit a similiar issue, with an F12 break on a application freeze coming up with assembly code. Here are some instructions for Microsofts VC++ Express. These links I found useful:

http://blogs.msdn.com/calvin_hsia/archive/2004/10/18/244075.aspx

http://www.thescripts.com/forum/thread263235.html

To get a callstack showing where TGE stepped out into the DLL, I had to open up the thread viewer. Choose Debug->Windows->Threads, choose the top thread, then look at the callstack.

But the DLL in the callstack doesn't have symbol names. You can get some of them by doing this: (you have to restart the IDE afterwards)
Tools->Options->Debugging->Native and Check
"Load DLL Exports"

There is also supposed to be a way to get symbols dynamically from a Microsoft server (as mentioned in one of the above links) but I couldn't find the menu option to get it working.

Hope this helps someone...