Not logged in, Join Here! or Log In Below:  
News Articles Search    

 Home / General Programming / Obtaining reliable call stack information Account Manager
Archive Notice: This thread is old and no longer active. It is here for reference purposes. This thread was created on an older version of the flipcode forums, before the site closed in 2005. Please keep that in mind as you view this thread, as many of the topics and opinions may be outdated.

February 05, 2005, 03:01 PM

I'm interested in recovering the call stack for a suspended Win32 application. I've tried using StackWalk64, however I've found that this method is not reliable enough for my purposes -- i.e. frequently it's unable to find the calling function, especially when dealing with DLLs.

I know that obtaining the call stack is a bit of a black art since the compiler may omit some of the information necessary to directly recover the saved instruction pointer. I've done some experiements with Microsoft Visual Studio .NETs debugger and it seems to do a very good job obtaining the call stack, even in the cases where StackWalk64 failes.

Does anyone know how they are doing this, or any other ways to get reliable call stack information?




February 05, 2005, 05:45 PM

When dealing with DLLs you need to explicitly walk the modules table and load the symbols. For your own DLLs this is no problem since you've got the PDBs at hand. For most Windows DLLs there are symbol files in the Platform SDK.
Once I had loaded these, I had no problems using StackWalk.

I had written a small test program some time ago, it' still on my university account:

Maybe you'd like to compare it to your code, and we can share any improvements.


February 17, 2005, 03:52 PM

Turning off "Omit Frame Pointers" usually helps a lot too.

This thread contains 3 messages.
Hosting by Solid Eight Studios, maker of PhotoTangler Collage Maker.