go-delve / delve

Delve is a debugger for the Go programming language.
MIT License
22.91k stars 2.14k forks source link

Support debugging Go executable stripped from symbols using information from pclntab #2899

Closed tymonx closed 2 years ago

tymonx commented 2 years ago

It should be possible to retrieve debug information from internal pclntab table built in executable even after striping it from debug symbols. This table is always present in executable because it used by the runtime package.

  1. What version of Delve are you using (dlv version)?
1.8.0
  1. What version of Go are you using? (go version)?
1.17.5
  1. What operating system and processor architecture are you using?
Linux Fedora 35 Kinoite, AMD64
  1. What did you do?

Strip executable from debug symbols:

go build -ldflags '-s -w' -trimpath -o <name> <file>.go

Run it via Delve:

dlv exec ./<name>
  1. What did you expect to see?
Type 'help' for list of commands.
(dlv)
  1. What did you see instead?
could not launch process: could not open debug info
aarzilli commented 2 years ago

It isn't worth doing, we'd take a dependency on a lot of internal details of the compiler/runtime and the only thing we could do is stack traces.