700 B
700 B
GDB 远程调试 Golang
Target
gdbserver :<port> <program name>
# 如 gdbserver :889 demo-go
Host
arm-linux-gnueabihf-gdb
# 如: target remote 192.168.1.100:8899
(gdb) target remote <remote ip>:<remote port>
(gdb) set language go
# 如: file /host/path/to/demo-go
(gdb) file <debug targe file>
(gdb) b <file>:<line>
(gdb) b <package>.<function>
# 查看调用栈
(gdb) bt
# 切换调用栈
(gdb) f <n>
# 查看 goroutine
(gdb) info goroutines
(gdb) goroutines <n> bt
GDB 调试 Golang 无法查看 string、slice 等类型。