Login | Register   
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


Tip of the Day
Language: C++
Expertise: Beginner
Jul 18, 2000

Debugging in Visual C++

Question:
Is there a way to access the call stack debugging information from the code? I would like to print the call stack inside a function, each time it is called.

Answer:
The stack call information isn't directly accessible. If you want to access that information, you will have to extract it from the executable file (Microsoft's format of executable files is called PE, Portable Executable. You can read about its structure on MSDN). Another option is to use assembly code to check the stack frame, the status of registers, activation records etc. A simpler solution is to use a stack object to which each function adds its name as a push() operation. The problem is that you will be able to see only your functions in the call chain, but not startup code or runtime library function calls.

DevX Pro
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap