diff --git a/Software/Applications/GDB/GDB_的使用.md b/Software/Applications/GDB/GDB_的使用.md index b9f9194..41e9338 100644 --- a/Software/Applications/GDB/GDB_的使用.md +++ b/Software/Applications/GDB/GDB_的使用.md @@ -3,11 +3,17 @@ ## 1.基本指令 ```bash +# 设置调试目标文件(解决找不到符号或找不到文件问题) +(gdb) file # 开启/关闭伪图形窗口 (gdb) tui enable/disable +# 设置参数 +(gdb) r ... # 查看各级函数调用及参数 (gdb) backtrace (gdb) bt +# 切换调用栈 +(gdb) f # 退出 gdb 调试环境 (gdb) quit (gdb) q @@ -22,14 +28,17 @@ # 删除断点 (gdb) delete [breakpoints num] [range...] (gdb) d [breakpoints num] [range...] +# 查看断点信息(breakpoints num) +(gdb) info breakpoints +(gdb) info b +# 禁用断点 +(gdb) dis # 清除全部断点 (gdb) clear # 删除所选定的环境中所有的断点 (gdb) clear ``` -可通过 info breakpoints 获取 breakpoints num 等断点信息。 - ## 3.执行控制 ```bash diff --git a/Software/Development/Language/Go/Debug/GDB_远程调试_Golang.md b/Software/Development/Language/Go/Debug/GDB_远程调试_Golang.md new file mode 100644 index 0000000..877b32f --- /dev/null +++ b/Software/Development/Language/Go/Debug/GDB_远程调试_Golang.md @@ -0,0 +1,34 @@ +# GDB 远程调试 Golang + +## Target + +```bash +gdbserver : +# 如 gdbserver :889 demo-go +``` + +## Host + +```bash +arm-linux-gnueabihf-gdb +# 如: target remote 192.168.1.100:8899 +(gdb) target remote : +(gdb) set language go +# 如: file /host/path/to/demo-go +(gdb) file +(gdb) b : +(gdb) b . +# 查看调用栈 +(gdb) bt +# 切换调用栈 +(gdb) f +# 查看 goroutine +(gdb) info goroutines +(gdb) goroutines bt +``` + +GDB 调试 Golang 无法查看 string、slice 等类型。 + +## 外部参考资料 + +1. [Golang 程序调试工具介绍(gdb vs dlv)](https://blog.csdn.net/dianfu2892/article/details/101466591)