I am trying to create a dump file for my application whenever it crashes. I am currently using procdump.exe with -e flag in order to do it, so if I have unhandled exception in my application procdump creates a dump file for me.
I thought that I was done, but then I found out that my application crashes and procdump doesn’t create a dump file. After some investigations I have found out that invalid use of vector::front causes runtime error. I turned on the _SECURE_SCL_THROWS flag and after that procdump.exe -e did catch the crash and created a dump file.
Now to my question: Is now procdump.exe -e will always create a dump file when my application crashes? How can I guarantee that I don’t have any other scenarios where procdump -e is not good for me?
I assume you are on a windows environment (because you use procdump.exe). You could also set an exception filter for your programm that writes a mindump whenever your application crash:
Register a callback function using SetUnhandledExceptionFilter which will be invoked on a crash. A possible signature would be:
Register it somewhere using:
Define a function pointer to call the Function MiniDumpWriteDump:
Use the MiniDumpWriteDump function to write the dump (requires DbgHelp.dll 5.1 or later) in the previously registerd callback method (HandleException):