3.18 GDB调试

目录

GDB简介

GDB基本命令


GDB简介

 GDB是GNU开源组织发布的一个强大的Linux下的程序调试工具。 一般来说,GDB主要帮助你完成下面四个方面的功能:

1、启动你的程序,可以按照你的自定义的要求随心所欲的运行程序(按着自己的想法运行)。

2、可让被调试的程序在你所指定的调置的断点处停住。(断点可以是条件表达式)

3、当程序被停住时,可以检查此时你的程序中所发生的事。

4、你可以改变你的程序,将一个BUG产生的影响修正从而测试其他BUG。

GDB基本命令

Here are some of the most frequently needed GDB commands:

       break [file:]function

        设置断点

           Set a breakpoint at function (in file).

       run [arglist]

        运行程序

           Start your program (with arglist, if specified).

       bt  Backtrace: display the program stack.      

        查看栈信息  

        print expr

        打印

           Display the value of an expression.

         c   Continue running your program (after stopping, e.g. at a            

         继续运行

breakpoint).        

         next            

        单步运行

Execute next program line (after stopping); step over any function

            calls in the line.

     edit [file:]function

        停止信息

           look at the program line where it is presently stopped.

       list [file:]function

        查看代码信息

           type the text of the program in the vicinity of where it is

           presently stopped.

       step

        查看函数内部内容

           Execute next program line (after stopping); step into any function

           calls in the line.

       help [name]

        帮助手册

           Show information about GDB command name, or general information

           about using GDB.

       quit

        退出

           Exit from GDB.

调试core文件

调试正在运行的进程

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值