watchpoint 内存(变量)
breakpoint (代码)
break 24
break main
break 24 if (32 == i32Num)
break test.c:main
/*指定哪个线程调用时才中断*/
break line thread thread-number
root@libz-Lenovo:/home/libz/project/gdb_test# gdb ./test_gdb.elf -q
Reading symbols from /home/libz/project/gdb_test/test_gdb.elf...done.
(gdb) l main
12
13
14 /***************************************************************/
15
16 int main(int argc, char *argv[])
17 {
18 INT32_T i32Num = 0;
19
20 printf("%s\n", g_pu8Str);
21 printf("%d\n", i32Num);
(gdb)
22 i32Num = 32;
23
24 printf("i32Num = [%d]\n", i32Num);
25 getchar();
26 return 0;
27 }
28
(gdb) break 24 if (3 == i32Num)
Breakpoint 1 at 0x804847e: file ./gdb_test.c, line 24.
(gdb) r
Starting program: /home/libz/project/gdb_test/test_gdb.elf
abc
0
i32Num = [32]
[Inferior 1 (process 23272) exited normally]
(gdb) info breakpoints
Num Type Disp Enb Address What
1 breakpoint keep y 0x0804847e in main at ./gdb_test.c:24
stop only if (3 == i32Num)
(gdb) delete 1
(gdb) info breakpoints
No breakpoints or watchpoints.
(gdb) break 24 if (32 == i32Num)
Breakpoint 2 at 0x804847e: file ./gdb_test.c, line 24.
(gdb) r
Starting program: /home/libz/project/gdb_test/test_gdb.elf
abc
0
Breakpoint 2, main (argc=1, argv=0xbffff5f4) at ./gdb_test.c:24
24 printf("i32Num = [%d]\n", i32Num);
(gdb)