这是直接来自 gdb 控制台的示例会话
Starting program:
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Breakpoint 1, 0x00000000025654f0 in ~F()
(gdb) bt
#0 0x00000000025654f0 in ~F()
at hello.cpp:123
(gdb) c
Continuing.
foo.cpp:122:12: runtime error: member call on null pointer of type 'Object'
这是我的.gdbinit
文件
set pagination off
set language c++
set print pretty on
set logging file gdb.txt
set logging on
break ~F()
info breakpoints
r
bt
c
set logging off
quit
生成的 gdb.txt 看起来像这样:
Breakpoint 1 at 0x25654f0
Num Type Disp Enb Address What
1 breakpoint keep y 0x00000000025654f0 <~F()>
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Breakpoint 1, 0x00000000025654f0 in ~F()
#0 0x00000000025654f0 in ~F()
....
Breakpoint 1, 0x00000000025654f0 in ~F()
我没有看到foo.cpp:122:12: runtime error: member call on null pointer of type 'Object'
日志中出现。如何将其写入我的日志?
谢谢