Saving core file in gdb

ε祈祈猫儿з 提交于 2019-12-20 08:09:33

问题


Is it possible to save/dump core file using gdb? Sometimes I want to save file to analyze it later.


回答1:


Issue the 'generate-core-file' command in gdb.

(gdb) help generate-core-file
Save a core file with the current state of the debugged process.
Argument is optional filename.  Default filename is 'core.<process_id>'.
(gdb) break main
Breakpoint 1 at 0x400e0b: file utils/udec.c, line 36.
(gdb) r
Starting program: /home/nos/build/utils/udec

Breakpoint 1, main (argc=1, argv=0x7fffffffe9a8) at utils/udec.c:36
36              int fileargc = 1;
(gdb) generate-core-file
Saved corefile core.7336



回答2:


You can also use gcore <pid> to produce cores.



来源:https://stackoverflow.com/questions/3789550/saving-core-file-in-gdb

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