Debugging a core produced by valgrind

眉间皱痕 提交于 2019-12-22 05:08:11

问题


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.


回答1:


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.



来源:https://stackoverflow.com/questions/1950685/debugging-a-core-produced-by-valgrind

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!