I am trying to programatically get a stack trace to better help me debug problems.? ? I have a C++ MFC ISAPI compiled using MSVC 6.0.?
Although I am specifically having issues in an ISAPI, technically getting the stack should work under any Windows program (C++ MFC).
I have tried to implement several sample source code examples I have found on the internet, but I am unable to get a good stack printout with any of them.? What I want is the file, function and line number information with the call stack dump.? I am compiling in Debug mode and have the PDB, so it should not be an issue.? I dont know if its a? [login to view URL] issue or [login to view URL] issue or what.? I am not sure if I have the compiler settings wrong, or what is going on. Can you help?
To make this easy, I have included a base-bones sample ISAPI with source code including my failed attempt to get the stack? - all it does is print it to a web page.? This project is to enhance the? GetStack function to work correctly, with complete stack information (including function/file/line number information, not just hex numbers).? I dont care if you plug in sample code from a magazine, I just want it to work!? If its too distracting to start from my? GetStack routing, feel free to delete it and plug your own in, I was just trying to show an example.
This must be done using Microsoft Visual Studio 6.0 using C++ and MFC, and work correctly on Windows XP and Windows Server 2003.
1) Compile the sample code
2) In IIS, add a virtual directory "isapitest" pointing to the Debug sub directory, give it execute priviledges
3) In a browser open the ISAPI, like? <http://localhost/isapitest/[login to view URL]>
4) It should display the stack, with function names and line numbers
If you need assistance with the ISAPI part of it, I can help with that.? This is more about getting the stack trace code working.
What I need specifically is the source you had to change, and anything else you had to change (settings) to get it to work.
## Deliverables
Two specific examples (and specifically when I would use this) are:
1) When the program asserts, show a message with the stack (windows app) or log or email the error (web based):
See Feb '99 BugSlayer article
[[login to view URL]][1]
2) Crash handling during an unhandled exception:
[[login to view URL]][2]
These are 2 times I would want to use this code.? I was just trying to get either working.? These are old examples - I need it working now for XP and Win2003.? There are other such examples on [login to view URL] - again I just need help getting something working.