Skip to content

dlv cannot attach to process spawned with go run #2844

@1ma

Description

@1ma
  1. What version of Delve are you using (dlv version)?

Both installed recently in $GOPATH/bin via the Go: Install/Update Tools dialog of the VS Code Go extension:

$ dlv version
Delve Debugger
Version: 1.8.0
Build: $Id: 6a6c9c332d5354ddf1f8a2da3cc477bd18d2be53 $
$ dlv-dap version
Delve Debugger
Version: 1.7.3
Build: $Id: c532746bc713b05a49680bc8c36b27c72c391a6b $
  1. What version of Go are you using? (go version)?

go version go1.17.5 linux/amd64, installed from https://go.dev/dl/

  1. What operating system and processor architecture are you using?

Ubuntu 18.04.6 LTS, amd64

  1. What did you do?

Given this simple program:

package main

import (
	"fmt"
	"time"
)

func main() {
	for {
		fmt.Println("brrrrrr")
		time.Sleep(3 * time.Second)
	}
}

I can compile it with go build main.go, run it in a terminal with ./main, add a breakpoint on the Println line and then click "Attach to process" in the Debug dialog of VS Code. In a few seconds, the breakpoint triggers as expected:

ok

However, if I directly go for go run main.go and follow the same process I get what seems like a Delve error.

  1. What did you expect to see?

I expected to be able to attach to a Go process spawned with go run and debug it.

  1. What did you see instead?

ko

Starting: /home/socialpoint/go/bin/dlv-dap dap --check-go-version=false --listen=127.0.0.1:43111 --log-dest=3 from /home/socialpoint/delve
DAP server listening at: 127.0.0.1:43111
2021-12-28T19:39:32+01:00 error layer=debugger error loading binary "/lib/x86_64-linux-gnu/libpthread.so.0": could not parse .eh_frame section: unknown CIE_id 0x9daad7e4 at 0x0
Type 'dlv help' for list of commands.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions