panicdelve

dlv attach got panic: <nil> not an Int


when I installed dlv and trying to attach a pid, I got panic:

dlv attach 1
panic: <nil> not an Int

goroutine 1 [running]:
go/constant.Int64Val(0x0, 0x0, 0xc, 0xc0074ff300)
        /usr/local/go/src/go/constant/value.go:499 +0x19d
github.com/go-delve/delve/pkg/proc.(*Variable).parseG.func1(0xba0c52, 0xc, 0x9)
        /home/go/src/delve/pkg/proc/variables.go:822 +0x6b
github.com/go-delve/delve/pkg/proc.(*Variable).parseG(0xc0074fe200, 0xc000244000, 0xc0074fe200, 0x0)
        /home/go/src/delve/pkg/proc/variables.go:846 +0x44b
github.com/go-delve/delve/pkg/proc.GetG(0xcb1b60, 0xc000244000, 0xc000244000, 0x7fb53c4fe2a8, 0xc000228580)
        /home/go/src/delve/pkg/proc/variables.go:247 +0xd1
github.com/go-delve/delve/pkg/proc.NewTarget(0xcb4760, 0xc000228580, 0xc000051840, 0x1a, 0xc000212420, 0x1, 0x1, 0xc00016e520, 0x200, 0xc0001cb6b8, ...)
        /home/go/src/delve/pkg/proc/target.go:128 +0x22d
github.com/go-delve/delve/pkg/proc/native.(*nativeProcess).initialize(0xc000228580, 0xc000051840, 0x1a, 0xc000212420, 0x1, 0x1, 0x0, 0xc0002688c0, 0x10000c0001cb750)
        /home/go/src/delve/pkg/proc/native/proc.go:305 +0x19e
github.com/go-delve/delve/pkg/proc/native.Attach(0x1, 0xc000212420, 0x1, 0x1, 0xc0001cb898, 0xc0001cb7a0, 0x40bb0b)
        /home/go/src/delve/pkg/proc/native/proc_linux.go:132 +0x1bb
github.com/go-delve/delve/service/debugger.(*Debugger).Attach(0xc0002146c0, 0x1, 0x0, 0x0, 0xc0001cb858, 0x1, 0x1)
        /home/go/src/delve/service/debugger/debugger.go:295 +0x216
github.com/go-delve/delve/service/debugger.New(0xc0002687e0, 0xc000212560, 0x0, 0x0, 0x0, 0x0, 0x0)
        /home/go/src/delve/service/debugger/debugger.go:121 +0x7cd
github.com/go-delve/delve/service/rpccommon.(*ServerImpl).Run(0xc000214600, 0xc000214600, 0xc00024e5a0)
        /home/go/src/delve/service/rpccommon/server.go:112 +0xc8
github.com/go-delve/delve/cmd/dlv/cmds.execute(0x1, 0xc000212560, 0x0, 0x0, 0xc000245f80, 0x0, 0x0, 0x3, 0x0)
        /home/go/src/delve/cmd/dlv/cmds/commands.go:774 +0x501
github.com/go-delve/delve/cmd/dlv/cmds.attachCmd(0xc000238900, 0xc000212560, 0x1, 0x1)
        /home/go/src/delve/cmd/dlv/cmds/commands.go:606 +0xc0
github.com/spf13/cobra.(*Command).execute(0xc000238900, 0xc000212510, 0x1, 0x1, 0xc000238900, 0xc000212510)
        /home/go/pkg/mod/github.com/spf13/cobra@v0.0.0-20170417170307-b6cb39589372/command.go:647 +0x231
github.com/spf13/cobra.(*Command).ExecuteC(0xc0002386c0, 0xc0002386c0, 0xb99853, 0x6)
        /home/go/pkg/mod/github.com/spf13/cobra@v0.0.0-20170417170307-b6cb39589372/command.go:733 +0x2bc
github.com/spf13/cobra.(*Command).Execute(...)
        /home/go/pkg/mod/github.com/spf13/cobra@v0.0.0-20170417170307-b6cb39589372/command.go:692
main.main()
        /home/go/src/delve/cmd/dlv/main.go:24 +0xc6

how I installed: wget https://studygolang.com/dl/golang/go1.14.1.linux-amd64.tar.gz

tar -C /usr/local -zxvf go1.14.1.linux-amd64.tar.gz

  mkdir -p /home/go/bin/home/go/pkg /home/go/src

  vi .bash_profile

  source .bash_profile 

14 cd $GOPATH/src/

15 git clone https://github.com/derekparker/delve.git

16 cd delve/cmd/dlv/

18 go build

19 go install

dlv version Delve Debugger Version: 1.4.0 Build: $Id: 67422e6f7148fa1efa0eac1423ab5594b223d93b $

And I don't know how to solve it


Solution

  • I have found the solution. The version is too old: https://github.com/go-delve/delve/issues/3133 The latest dlv works perfectly.