I'm trying to debug a Windows program compiled using MinGW's gcc that only ever se开发者_C百科gfaults when run outside of gdb (probably some race condition... lovely.) The problem is, when the program crashes and I'm not running GDB, I can't get a stack trace... I have the option to open up the program in MSVC when it crashes, but MSVC can't read gcc's debugging symbols and so the stack trace it gives me is useless.
Is there a way to get Windows to create a core dump that I can then later open in MinGW's gdb? Alternatively, is there a way to take MSVC's stack trace (which has raw addresses but no symbols) and use gcc to get a human-readable trace?
windows does not create core files (on linux they are dumped by the kernel iirc) you can try to attach with gdb with the crash dialog opened but I doubt it will work
if you use msvc instead you can create a minidump debuggable in visualstudio but there is no way to create same dump with gcc
google made a software that you may find useful, but I'm not sure it can produce stuff with gcc
http://code.google.com/p/google-breakpad/
or you can set drmingw as jit debugger
drmingw -i
I'm sure it is possible to get something like a backtrace also on mingw, since mingw compiled llvm is able to dump a trace
http://code.google.com/p/backtrace-mingw/
looks like simpler but I've not tested it
compile with -g3 (and if you can -O0)
精彩评论