-
查看断点
-
两种方式
info breakpoints [list...]
info break [list...]
-
作用
- 表格的形式输出所有断点。
- 断点有三种: 普通位置断点,检测数据变化型断点,捕获事件型断点。
[list...]
表示查看指定编号的断点。
-
输出表格
breakpoint numbers
断点编号.m.n
,m
表示多进程调试时的进程编号,n
则是对应进程的断点。type
什么类型的断点: 行级别调试断点,监测数据变化的监测断点,捕获事件的断点。disposition
描述信息: 当前断点是触发后禁用或者是触发后删除。enabled diabled
是否启用。address
断点位置,可能是程序虚拟地址,位置信息等,可能是未来断点pending
,一般是共享库上的断点。multiple
表示一个断点多个位置。what
具体的断点信息,即设置时断点的条件,比如位置等。
-
-
案例
-
查看
chen@chen:~/cppfile/test$ gdb ./a.out -q Reading symbols from ./a.out...done. (gdb) break show Breakpoint 1 at 0x4004d6: show. (3 locations) (gdb) info breakpoints Num Type Disp Enb Address What 1 breakpoint keep y <MULTIPLE> 1.1 y 0x00000000004004d6 in show() at test.cpp:1 1.2 y 0x00000000004004e0 in show(int) at test.cpp:2 1.3 y 0x00000000004004ec in show(float) at test.cpp:3 (gdb) !cat test.cpp void show(){} void show(int a){} void show(float b){} int main() { }
-
临时断点
(gdb) tbreak show Note: breakpoint 1 also set at pc 0x4004ec. Note: breakpoint 1 also set at pc 0x4004e0. Note: breakpoint 1 also set at pc 0x4004d6. Temporary breakpoint 2 at 0x4004d6: show. (3 locations) (gdb) info breakpoints Num Type Disp Enb Address What 1 breakpoint keep y <MULTIPLE> 1.1 y 0x00000000004004d6 in show() at test.cpp:1 1.2 y 0x00000000004004e0 in show(int) at test.cpp:2 1.3 y 0x00000000004004ec in show(float) at test.cpp:3 2 breakpoint del y <MULTIPLE> 2.1 y 0x00000000004004d6 in show() at test.cpp:1 2.2 y 0x00000000004004e0 in show(int) at test.cpp:2 2.3 y 0x00000000004004ec in show(float) at test.cpp:3
- 第二个断点的
Disp
变成了del
,即一次性断点。
- 第二个断点的
-
-
总结
gdb查看断点
于 2021-04-11 15:08:40 首次发布