Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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 the executable that was being run under valgrind directly in GDB with the core seems to produce bad backtraces.

like image 777
psychotik Avatar asked Dec 23 '09 04:12

psychotik


1 Answers

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.

like image 129
Employed Russian Avatar answered Nov 01 '22 06:11

Employed Russian