将核心文件保存在gdb中


Answers:


140

在gdb中发出“ generate-core-file”命令。

(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

4
它将保存在GDB的当前工作目录中,可通过pwd命令查看。如果需要更改,可以使用进行更改cd,就像在shell上一样。
乔纳森·莱因哈特

3
@Jonathon_Reinhartgenerate-core-file如果要将核心文件路径保存在某个位置
则将

By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.