This commit is contained in:
2024-08-10 19:46:55 +08:00
commit 2233526534
798 changed files with 35282 additions and 0 deletions

View File

@@ -0,0 +1,65 @@
# GDB 初探索(编程可阅览)
请在开始进行 C 语言编程之后查阅使用
![](https://cdn.xyxsw.site/boxcnHXggg6eLy86vFmb4shOksh.png)
## GDB 是什么?
调试器,简单来说就是当你代码跑不通时候修正错误用的
[GDB's Mascot?](https://sourceware.org/gdb/mascot/)
可搭配插件 gef pwndbg pwngdb peda
## 基本操作
[GDB 快速入门教程](https://www.bilibili.com/video/BV1EK411g7Li/)
### **GDB 使用表**
`run (r)`运行程序
`b`打断点,可以在函数和位置打断点
`info b`查看打断点的位置
`n`下一步,跳过函数的
`list`查看源代码
`-p`走 PID 路线
`edit [file:]function` 看现在停下的函数位置
`step` 进入任何函数
`p`打印变量
`shell`输入命令
`set logging on`记录日志
`watchpoint`观察变量是否变化的观察点
`watch`设置观察点位置watch*(地址)
`layout split`开启 TUI 模式
`whatis`查看变量类型
`ptype`查看详细信息
#### **TUI**
`ctrl + x + a`开启
`ctrl + p + n`往前
`ctrl + l`重新整理页面
## 官方手册
[GDB User Manual](https://sourceware.org/gdb/current/onlinedocs/gdb)
有非常多高级用法,可以在必要的时候进行查阅,受益无穷