gdb调试功能

[root@localhost home]# mkdir gdb   //创建gdb文件夹
[root@localhost gdb]# vim gdb.c
[root@localhost gdb]# gcc gdb.c -o gdb -g  //调试
[root@localhost gdb]# gdb gdb   //进入调试界面
GNU gdb Red Hat Linux (6.5-25.el5rh)
Copyright (C) 2006 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i386-redhat-linux-gnu"...Using host libthread_db library "/lib/libthread_db.so.1".

(gdb)     //光标所在行

l:(List)显示前十行代码
l5:显示第五行的前五行和后五行
l:继续显示
r:运行
b 10:(break)在第十行打断点
r:运行到第十行
c:(continue)继续运行
info bereak:显示断点
delete b 1:删除第一个断点
b main:在main函数打断点
n:运行到下一行,遇到函数一起执行
step:遇到函数进入函数
p c:打印出c的值

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值