在runnig dlv debug test.go时找不到二进制文件中的__debug_line部分

时间:2018-09-01 11:17:07

标签: debugging go

使用macOS,并通过brew install go-delve/delve/delve安装了dlv

然后尝试在test.go中调试程序,如下所示:dlv debug test.go

然后出现此错误:

could not launch process: could not find __debug_line section in binary

有什么建议吗?


于9/4更新

我卸载了brew dlv并按如下所示进行安装,

localhost:dlv lua$ go get github.com/derekparker/delve/cmd/dlv localhost:dlv lua$ cd $GOPATH/src/github.com/derekparker/delve/cmd/dlv localhost:dlv lua$ go build localhost:dlv lua$ go install localhost:dlv lua$ pwd /Users/lua/go/src/github.com/derekparker/delve/cmd/dlv localhost:dlv lua$ dlv -bash: /usr/local/bin/dlv: No such file or directory localhost:dlv lua$

1 个答案:

答案 0 :(得分:0)

您可以从源代码安装它,而不必使用brew。

go get github.com/derekparker/delve/cmd/dlv
cd $GOPATH/src/github.com/derekparker/delve/cmd/dlv
go build 
go install

这应该可以解决此问题。