I’m trying to get distrobuilder up and running in Visual Studio Code and debug it with delve, but crashes when trying stop at a breakpoint. I’m not sure if I’m missing a build argument I should be passing to delve when it builds the binary for debugging or if this isn’t expected to work for one reason or another.
go get ./distrobuilder
sudo -E ~/go/bin/dlv debug --headless --api-version 2 --listen 127.0.0.1:2345 --only-same-user=false ./distrobuilder -- --help
- In VSCode, create a launch configuration as follows:
{ "name": "Connect to server", "type": "go", "request": "attach", "mode": "remote", "port": 2345, "host": "127.0.0.1" }
- Set a breakpoint in VSCode
- Connect to the remote debugging session.
It crashes with a stacktrace:
API server listening at: 127.0.0.1:2345
SIGTRAP: trace trap
PC=0xd44453 m=0 sigcode=128
goroutine 1 [running]:
main.main()
/home/link/go/src/github.com/lxc/distrobuilder/distrobuilder/main.go:91 +0x33 fp=0xc00021ff88 sp=0xc00021fc70 pc=0xd44453
runtime.main()
/usr/lib/go-1.14/src/runtime/proc.go:203 +0x1c8 fp=0xc00021ffe0 sp=0xc00021ff88 pc=0x43df38
runtime.goexit()
/usr/lib/go-1.14/src/runtime/asm_amd64.s:1373 +0x1 fp=0xc00021ffe8 sp=0xc00021ffe0 pc=0x46e681
rax 0xc00021fcf0
rbx 0x14
rcx 0xc000000180
rdx 0xeed9a8
rdi 0xc000355678
rsi 0xd0
rbp 0xc00021ff78
rsp 0xc00021fc70
r8 0x1a
r9 0x1a
r10 0x7fa5f598bab6
r11 0x0
r12 0x203000
r13 0x0
r14 0xd0
r15 0x2a
rip 0xd44453
rflags 0x202
cs 0x33
fs 0x0
gs 0x0
Is this to be expected?