使用GoLand调试geth
geth调试遇到的问题
使用goland生成geth
选择go build
按照包(Package)或者按照目录(Directory)的编译单位,比如编译geth就是如下目录,如果是evm就是cmd/evm
goland调试无法输入
直接选择debug之后,无法输入,也就是说,虽然这个console可以输入字符,但是没有反应
这个问题idea其实也有,但是一开始没有反应过来,以为是输入卡住了,后来才反应过来原来是这个console根本没法输入。。
可以看看这个:Unable to read stdin input in debug mode,
So far the only supported way to debug a program like this is to start a headless instance in one terminal:
dlv --headless debug yourprogram.go
This will print something like this:
API server listening at: 127.0.0.1:XYZ
then in another terminal do:
dlv connect :XYZ
Input for delve will go in the second terminal, input for your program will go in the first one.
这里使用的是dlv调试,用dlv connect server就可以
我们可直接用geth attach
来操作,该命令会启动一个连到节点的交互式JS控制台
attach的地址在启动的时候已经给出了,就是IPC地址:
最终命令:geth attach xxxxx/geth.ipc
Bingo! 开始你的调试吧!
本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来自 CapybaraJ!
评论