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
        
        
        
     

  • 相关阅读:
    【Swift后台】环境安装
    【Swift后台】背景介绍
    【Swift后台】目录
    退居三线iOS开发的自主开发历程
    Swift调用微信支付宝SDK(Swift4.0)
    ORACLE取对照表不等的数据
    Binary转换成Hex字符串
    利用OpenSSL创建证书链并应用于IIS7
    sysctl.conf和limit.conf备忘待查
    Use Wireshark to capture loopback traffic without a loopback adapter (转)
  • 原文地址:https://www.cnblogs.com/liujun5319/p/9660217.html
Copyright © 2011-2022 走看看