views:

973

answers:

3

When my process crashes, how can I print to log a core dump file stack, C++ over windows? I know that in Unix there is a way to do it using some signal handlers but never did it myself. How can I do it in windows (prefer not to use ACE)?

Thanks.

A: 

You can set your own top level exception handler and walk the stack using dbghelp library to get a call stack. You may also generate an application crash dump this way.

Canopus
+2  A: 

The Windows equivalent of a core dump is called a Minidump, and you can write one using MiniDumpWriteDump. There's an article about on codeproject here: http://www.codeproject.com/KB/debug/postmortemdebug_standalone1.aspx

RichieHindle
A: 

If you're looking for a stack walker, take a look at this one, created by Jochen Kalmbach. When run, it will let you log the stack trace in whatever way you like. The common way, however, is to ask Windows to create a dump (either full or mini).

eran