当前位置:网站首页>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 .
边栏推荐
- Knowing the details of redis RDB, you can step on many holes less
- 还在用 SimpleDateFormat 做时间格式化?小心项目崩掉!
- Bytecode proof in appliedzkp zkevm (9)
- This Exception was thrown from a job compiled with Burst, which has limited exception support. 报错
- Oracle 日期格式化异常:无效数字
- Convert the file URL in the browser to a file stream
- Solve the problem of reading package listsdonebuilding dependency treereading state informationdone
- 毕业季,给初入社会的你一些建议
- 动态库(共享库)的制作和使用
- Six fusion positioning technologies in wireless communication application of Internet of things
猜你喜欢

MarkDown——基本使用语法

Debug debugging in katalon

Katalon global variable is referenced in testobject

Spatial-Temporal时间序列预测建模方法汇总

Metersphere实现UI自动化元素不可点击(部分遮挡)
![[monkey] Introduction to monkey test](/img/70/5a7152d0b6b77df7f9d6ad0e09e000.png)
[monkey] Introduction to monkey test

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

JS foundation 3

Remote connection of raspberry pie in VNC viewer mode without display

Yann Lecun's new paper: the road to building automatic agents
随机推荐
How to use output in katalon
GEE:基于 MCD64A1 的 GlobFire 日常火灾数据集
Redis database
JS基础4
移动命令
Metersphere implements UI automation elements that are not clickable (partially occluded)
Katalon当中的debug调试
Yann Lecun's new paper: the road to building automatic agents
MySQL common commands for viewing database performance
【Qt】connect 语法参考实现
MySQL查看数据库性能常用命令
数据库系列:有什么办法对数据库的业务表进行无缝升级
MySQL(三)
Katalon当中的使用循环for、while和if...else、break、continue
GCC简介
Transactions proof in appliedzkp zkevm (10)
远程登录sshd服务
Remote connection of raspberry pie in VNC viewer mode without display
Mongo数据库
Gee: mcd64a1 based globfire daily fire data set