当前位置:网站首页>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 .
边栏推荐
- This Exception was thrown from a job compiled with Burst, which has limited exception support. 报错
- Six fusion positioning technologies in wireless communication application of Internet of things
- 个人买场内基金选择什么证券公司开户好,更安全
- GEE:基于 MCD64A1 的 GlobFire 日常火灾数据集
- 毕业季,给初入社会的你一些建议
- 元宇宙系统的发展与原理介绍
- 乌国家安全与国防委员会秘书:将对俄境内目标进行精确打击
- DlhSoft Kanban Library for WPF
- 一套十万级TPS的IM综合消息系统的架构实践与思考
- [practice] 1364- implement a perfect waterfall flow component on the mobile terminal (with source code)
猜你喜欢

Katalon global variable is referenced in testobject

Fastposter v2.8.4 release e-commerce poster generator

获取系统当前日期

【实操】Appium Settings app is not running after 5000ms

树莓派无需显示屏的VNC Viewer方式的远程连接

Word、PDF、TXT文件实现全文内容检索需要用什么方法?

ThreadLocal的简单理解

论文阅读 (59):Keyword-Based Diverse Image Retrieval with Variational Multiple Instance Graph

JS基础8
This Exception was thrown from a job compiled with Burst, which has limited exception support. 报错
随机推荐
工控安全之勒索病毒篇
壓縮解壓
Hystrix deployment
Excel导入导出便捷工具类
Metersphere implements UI automation elements that are not clickable (partially occluded)
Graduation season, some suggestions for you who are new to the society
MarkDown——基本使用语法
Threads and thread pools
MySQL (III)
方法重写(Override)
Understanding of FTP protocol
[Li Kou - dynamic planning] sort out topic 1: basic topics: 509, 70, 746, 62, 63, 343, 96 (with links, topic descriptions, problem solving methods and codes)
JSON module, hashlib, Base64
获取系统当前日期
Yann LeCun新论文:构建自动智能体之路
Create ECS using API shortcut
Remote connection of raspberry pie in VNC viewer mode without display
Katalon当中的output使用方法
拼接String集合中的字符串_基于Stream
[Agora] get an Agora_ Example usage of refptr object