Login | Register   
RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX

By submitting your information, you agree that devx.com may send you DevX offers via email, phone and text message, as well as email offers about other products and services that DevX believes may be of interest to you. DevX will process your information in accordance with the Quinstreet Privacy Policy.

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



Building the Right Environment to Support AI, Machine Learning and Deep Learning

Debugging in Visual C++

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.

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.



Thanks for your registration, follow us on our social networks to keep up-to-date