Browse - Programming Tips - How can I log a stack trace if my (Microsoft Visual C++) program crashes?\Date: 2016sep29 OS: Windows Q. How can I log a stack trace if my (Microsoft Visual C++) program crashes?\ A. Include all .pdb (program symbol database) files in your install Include dbghelp.dll in your install Catch the crash with when your program starts:#include <crtdbg.h> // ... _CrtSetReportHook(OurReportingFunction);Here's how that function could be:int OurReportingFunction(int iReportType, LPSTR szUserMessage, int *retVal) { if (iReportType != _CRT_WARN) // Ignore warnings { // Probablly log something here } MyDumpStack(); // Implemented with StackWalker }Use Stackwalker to dump your stack: https://stackwalker.codeplex.com/ Add a commentSign in to add a comment![]()
|