zoukankan      html  css  js  c++  java
  • gdb

    1. gcc ... -omain -g
        -g : The function and variable names will be saved.
    2. start gdb
        gdb appName
        set args xxx xxx xxx
            Pass arguments to the app

    3. l command:
        l : show source code, and type "enter" to continue show source code.
        show listsize : Number of source lines gdb will list by default is 10
        set listsize 20: set it 20
        l 5 : show line 5
        l insert_sort.c:5 : show line 5 of insert_sort.c
        l insert_sort.c:func : show the code of a func
        l main.c:main : show the code of a func
    4. breakpoint operations:
        b 14 : set breakpoint in line 14
        b 17 : set breakpoint in line 17
        i b : show all the breakpoints
        d 1 : delete the first breakpoint
        d 2 3 : delete two breakpoints at the same time
        d 4-7 : delete breakpoints the fourth to seventh
        dis 2 : disable the second breakpoint
        ena 2 : enable the second breakpoint
        r : running
        p i : show the value of i
        b 17 if i==10 : set condition breakpoint
            set the breakpoint and it will be hit when i==10
    5. debug operations
        r : run app and stop at the first breakpoint
        p i : show the value of i
        p array[i] : show value of the ith element
        ptype i : show the type of i
        n : go by one step
        display i : display i in every step
        i(info) display : show all display
        undisplay i(the ith one) : Contrary to the display
        step : get into a func
        finish : get out of a func,but you must delete all breakpoints in the func.
        c(continue) : continue to debug and stop at next breakpoint
    5. other operations
        q(quit) : quit gdb
        set var i=5 : set the value of i
        until : Jump out of the loop,but you must delete all breakpoints in the loop
        start : run a line and then stop,used after starting gdb
        r : run to the first breakpoint and then stop
        
        
        
     

  • 相关阅读:
    mongoDB BI 分析利器
    如何定位 Node.js 的内存泄漏
    如何对MySQL数据库中的数据进行实时同步
    [有奖活动进行中]阿里数据库专家曾文旌为你解决数据库那些事
    如何实现Docker应用的自定义弹性伸缩
    vue methods 中方法的相互调用
    vue 实现部分路由组件缓存
    SSH框架之一详解maven搭建多模块项目
    GitHub Pages 搭建流程-基于jekyll-bootstrap
    ExtJs 4 中的MVC应用架构
  • 原文地址:https://www.cnblogs.com/liujun5319/p/9660217.html
Copyright © 2011-2022 走看看