watchpoint和breakpoint

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)



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值