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
        
        
        
     

  • 相关阅读:
    浮点数二分
    [模板]整数二分
    Mybatis实现增删改查
    如何使用 KEIL 下载 HEX 文件?
    线程CPU使用率该如何计算?
    单片机里面的CPU使用率是什么鬼?
    ASP.NET Core 3.1使用JWT认证Token授权 以及刷新Token
    ASP.NET Core 3.1使用Swagger API接口文档
    Visual Studio 默认git拉取Github出错 No error could not read Username for 'https://github.com': terminal prompts disabled
    ASP.NET Core 3.1使用log4net/nlog/Serilog记录日志
  • 原文地址:https://www.cnblogs.com/liujun5319/p/9660217.html
Copyright © 2011-2022 走看看