Linux gdb-x共享库断点
我有一个断点列表,每次调试一个特定的程序时,我都要添加这些断点。我创建了一个包含断点的文件,并使用了gdb-x“file”命令,但是没有添加将来加载共享库时挂起的所有断点。有办法解决此问题吗?在脚本中将共享库中的断点设置为挂起,加载共享库时,断点将正确设置Linux gdb-x共享库断点,linux,bash,gdb,breakpoints,Linux,Bash,Gdb,Breakpoints,我有一个断点列表,每次调试一个特定的程序时,我都要添加这些断点。我创建了一个包含断点的文件,并使用了gdb-x“file”命令,但是没有添加将来加载共享库时挂起的所有断点。有办法解决此问题吗?在脚本中将共享库中的断点设置为挂起,加载共享库时,断点将正确设置 (gdb) help set breakpoint pending Set debugger's behavior regarding pending breakpoints. If on, an unrecognized breakpoin
(gdb) help set breakpoint pending
Set debugger's behavior regarding pending breakpoints.
If on, an unrecognized breakpoint location will cause gdb to create a
pending breakpoint. If off, an unrecognized breakpoint location results in
an error. If auto, an unrecognized breakpoint location results in a
user-query to see if a pending breakpoint should be created.
这是一个脚本示例(假设print\u in_lib
in在共享库中,该库将加载dlopen
):
这是它的输出:
host: srv2-x64rh5-01, OS: Linux 2.6.18-238.el5>gdb -q
Function "print_in_lib" not defined.
Breakpoint 1 (print_in_lib) pending.
warning: no loadable sections found in added symbol-file system-supplied DSO at 0x2aaaaaaab000
thousands: 1
print_debug: 0
Breakpoint 1, print_in_lib (print_debug=0) at my_lib.cpp:7
7 if (print_debug) {
(gdb) bt
#0 print_in_lib (print_debug=0) at my_lib.cpp:7
#1 0x00000000004008ab in main (argc=<value optimized out>, argv=<value optimized out>) at main.cpp:37
(gdb)
主机:srv2-x64rh5-01,操作系统:Linux 2.6.18-238.el5>gdb-q
未定义函数“打印库中的打印”。
断点1(在库中打印)挂起。
警告:在0x2AAB000处添加的符号文件系统提供的DSO中找不到可加载的节
千:1
打印调试:0
断点1,在my_lib处的_lib中打印(print_debug=0)。cpp:7
7如果(打印调试){
(gdb)英国电信
#在my_lib中0 print_(print_debug=0)。cpp:7
#main中的1 0x00000000004008ab(argc=,argv=)位于main.cpp:37
(gdb)
在脚本中,将共享库中的断点设置为挂起,加载共享库时,将正确设置断点
(gdb) help set breakpoint pending
Set debugger's behavior regarding pending breakpoints.
If on, an unrecognized breakpoint location will cause gdb to create a
pending breakpoint. If off, an unrecognized breakpoint location results in
an error. If auto, an unrecognized breakpoint location results in a
user-query to see if a pending breakpoint should be created.
这是一个脚本示例(假设print\u in_lib
in在共享库中,该库将加载dlopen
):
这是它的输出:
host: srv2-x64rh5-01, OS: Linux 2.6.18-238.el5>gdb -q
Function "print_in_lib" not defined.
Breakpoint 1 (print_in_lib) pending.
warning: no loadable sections found in added symbol-file system-supplied DSO at 0x2aaaaaaab000
thousands: 1
print_debug: 0
Breakpoint 1, print_in_lib (print_debug=0) at my_lib.cpp:7
7 if (print_debug) {
(gdb) bt
#0 print_in_lib (print_debug=0) at my_lib.cpp:7
#1 0x00000000004008ab in main (argc=<value optimized out>, argv=<value optimized out>) at main.cpp:37
(gdb)
主机:srv2-x64rh5-01,操作系统:Linux 2.6.18-238.el5>gdb-q
未定义函数“打印库中的打印”。
断点1(在库中打印)挂起。
警告:在0x2AAB000处添加的符号文件系统提供的DSO中找不到可加载的节
千:1
打印调试:0
断点1,在my_lib处的_lib中打印(print_debug=0)。cpp:7
7如果(打印调试){
(gdb)英国电信
#在my_lib中0 print_(print_debug=0)。cpp:7
#main中的1 0x00000000004008ab(argc=,argv=)位于main.cpp:37
(gdb)