Go-ethereum 调试编译

 在使用Go-ethereum 进行开发时,需要进行测试调试geth时,由于官方默认Makefile编译版本是经过优化版本,不管用gdb,

还是dlv调试工具,都会出现不方便调试的时候,经过自己整理摸索,实现了Go-ethereum的调试版本编译,

总结步骤如下:

  0. 使用官方的makefile生产环境:

 cd /path/to/go-ethereum

  make geth

  1. 导出GO工作环境环境变量:                                                                                                                                              export GOBIN= /path/to/go-ethereum/build/bin

 export GOPATH= /path/to/go-ethereum/build/_workspace

  2.  强制重新编译

        go install -a -gcflags=all='-N -l' -v ./cmd/geth

3. 编译或者下载dlv,推荐使用dlv调试工具,相比GDB, dlv对于Golang有更好的支持。

   dlv exec geth

你可能感兴趣的:(区块链,以太坊)