运行dlv debug test.go时找不到二进制文件中的debug_line部分

Using macOS, installed dlv via brew install go-delve/delve/delve

then try to debug a program in test.go like this: dlv debug test.go

then got this error:

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

Any suggestion?


updated on 9/4

I uninstalled the brew dlv and install like below, it still not work.

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$

You can install it from the source code instead of using brew.

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

This should fix this issue.