go语言调试
主流的调试器有两款,dlv & gdb。网上的资料很多,这里仅作一个综述,方便自己学习查找。
添加编译选项
go 1.10 or later:
go build -gcflags="all=-N -l" -o myApp
go 1.9 or earlier:
go build -gcflags="-N -l" -o myApp
常用调试命令:
- dlv attach <pid>
- break <filename>:<line-number>
- breakpoints
- clear <breakpoint-id>
- continue
dlv
官方:https://github.com/derekparker/delve
https://www.jetbrains.com/help/go/debugging-code.html
https://chai2010.cn/advanced-go-programming-book/ch3-asm/ch3-09-debug.html
https://zhuanlan.zhihu.com/p/126183467
gdb
https://www.cnblogs.com/wongbingming/p/13063629.html
https://cloud.tencent.com/developer/article/1428644
https://juejin.cn/post/6844903686766854152
https://zhuanlan.zhihu.com/p/107907755
对比文章
https://www.cnblogs.com/sunsky303/p/11571367.html
使用debugger学习golang
https://xargin.com/debugger/