当前位置:网站首页>Introduction to GDB
Introduction to GDB
2022-06-28 11:02:00 【MoyangCitta】
gcc -g -Wall program.c -o program“-g” Option is used to add source code information to the executable ,“-Wall” Open all without affecting the behavior of the program warning.
Single process 、 Single thread basic debugging command
start-up 、 sign out 、 Look at the code
- Start and exit
gdb Executable program
quitSet parameters for the program / Get and set parameters
set args 10 20
show args- GDB Use the help
help- View the current file code
list/l ( Show... From default location )
list/l Line number ( Displays... From the specified line )
list/l Function name ( Displays... From the specified function )- View non current file code
list/l file name : Line number
list/l file name : Function name - Set the number of rows displayed
show list/listsize
set list/listsize Row number Breakpoint operation
- To set breakpoints
b/break Line number
b/break Function name
b/break file name : Line number
b/break file name : function - View breakpoints
i/info b/break- Delete breakpoints
d/del/delete Breakpoint number - Setting breakpoint is invalid
dis/disable Breakpoint number - Setting breakpoints takes effect
ena/enable Breakpoint number - Set conditional breakpoints ( It is generally used in the position of circulation )
b/break 10 if i==5Debug command
- function GDB Program
start ( The program stops on the first line )
run ( Stop only when you encounter a breakpoint )- Continue operation , Stop at the next breakpoint
c/continue- One line down ( Will not enter function body )
n/next- Variable operating
p/print Variable name ( Print variable values )
ptype Variable name ( Print variable types )- Step down debugging ( Encountered a function entering the function body )
s/step
finish ( Jump out of the body of functions )- Automatic variable operation
display Variable name ( Automatically print the value of the specified variable )
i/info display
undisplay Number - Other operating
set var Variable name = A variable's value ( More used in the loop )
until( Out of the loop , Requires no breakpoints in the loop )Multi process debugging command
(gdb) set follow-fork-mode modemode You can choose parent perhaps child, namely : Choose which process to debug
notes : The process that is not tracked and debugged will end directly
Multithreaded debugging command
- utilize info threads View thread information
- thread id Debugging objectives id Specified thread
set scheduler-locking off | on | step“off” Indicates that no thread is locked ;
“on” Indicates that only the currently debugged thread continues to run ;
“step” When stepping , Only the current thread will execute .
边栏推荐
- [practice] 1364- implement a perfect waterfall flow component on the mobile terminal (with source code)
- AGCO AI frontier promotion (6.28)
- JS基础6
- metersphere使用js刷新当前页面
- Décompression par compression
- Hystrix deployment
- Summary of characteristics of five wireless transmission protocols of Internet of things
- 树莓派无需显示屏的VNC Viewer方式的远程连接
- 将浏览器中的文件 url转换为File流
- File的io流与base64
猜你喜欢
![[practice] 1364- implement a perfect waterfall flow component on the mobile terminal (with source code)](/img/e8/21d8d81a3d7b544687d6adc06ad4b1.png)
[practice] 1364- implement a perfect waterfall flow component on the mobile terminal (with source code)

Fastposter v2.8.4 release e-commerce poster generator

Katalon global variable is referenced in testobject

零基础自学SQL课程 | IF函数

Katalon框架测试web(二十)自定义关键字以及上传弹窗操作

Yann LeCun新论文:构建自动智能体之路

Mysql database overview and installation process
![[monkey] Introduction to monkey test](/img/70/5a7152d0b6b77df7f9d6ad0e09e000.png)
[monkey] Introduction to monkey test

How to use output in katalon

Redis6 一:Nosql引入、Redis可以解决什么问题?
随机推荐
Knowing the details of redis RDB, you can step on many holes less
JS基础6
Fastposter v2.8.4 release e-commerce poster generator
[leetcode daily question] [December 19, 2021] 997 Find the town judge
MarkDown——基本使用语法
JS foundation 3
Hystrix deployment
壓縮解壓
Mongo database
【SemiDrive源码分析】【X9芯片启动流程】32 - DisPlay模块分析 - RTOS侧
Bytecode proof in appliedzkp zkevm (9)
JS基础1-JS引入与运算符
Mongo数据库
NFT卡牌链游系统开发dapp搭建技术详情
Dataease installation upgrade
JS foundation 1-js introduction and operator
Information hidden in the trend chart of Hong Kong London gold market
论文阅读 (59):Keyword-Based Diverse Image Retrieval with Variational Multiple Instance Graph
李宏毅《机器学习》丨7. Conclusion(总结)
Docker modifies the user name and password of MySQL