Jump to content
  • Advertisement
Sign in to follow this  
Nitage

how to get call stack information programatically?

This topic is 4613 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm using C++ (VC7.1) and I want to be able to write the call stack to my log system when an exception gets thrown. Is there any way using VC7.1 to programatically obtain the call stack info?

Share this post


Link to post
Share on other sites
Advertisement
StackWalk64 is the ticket, yes. But don't get his hopes up. Writing a simple dump-stack-addresses thing is easily done, but going whole-hog and dumping function names and their local variable values is quite a bit of work.
Let's see: 2200 LOC for symbol engine, 1200 LOC for general debug code (catching exceptions, enabling debug token, etc.), 700 for pretty STL container dumps, and a further 1000 or so for misc. crap (caching of symbols, displaying the error dialog).
Now don't get me wrong, this is really great to have; it's just so much work and hard to get right, you definitely want to reuse existing code. Mine is going to be released Real Soon Now under GPL; as an alternative, John Robbins (the Bugslayer) has in the meantime written a book that includes a symbol engine, but I've not seen it myself.

BTW: putting symbol files (e.g. .PDB) in program's directory is reasonable, but not required: the absolute path to them is stored in the .EXE.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!