Debugging a core produced by valgrind
Valgrind produced a vgcore.NNNN file -- how do I debug the core using GDB? Do I need to use the original executable and supply the core, or is there some other way to do it?
Using valgrind as the root executable doesn't seem to work, and using th开发者_运维知识库e executable that was being run under valgrind directly in GDB with the core seems to produce bad backtraces.
This works fine for me:
gdb ./a.out vgcore.21650
and that's how you are supposed to use the vgcore.
If your program corrupted stack before crashing, then obviously you wouldn't get good stack traces from vgcore. You might want to expand your question with actual Valgrind report that led to the crash.
精彩评论