3

I'm getting this error back from dlv

could not attach to pid 20727: decoding dwarf section info at offset 0x0: too short

The binary is built in this way:

go build -a -v -ldflags "-w -X main.gitCommit=<sha> -linkmode 'auto' -extldflags '-static'"

Could you confirm that is the -w flag that cause the following issue? Does it strip the debug symbol?

Mazzy
  • 13,354
  • 43
  • 126
  • 207
  • Possible duplicate of [decoding dwarf section info at offset 0x0: too short](https://stackoverflow.com/questions/52230503/decoding-dwarf-section-info-at-offset-0x0-too-short) – daplho Jan 24 '19 at 01:27
  • @daplho not a duplicate. I'm not using Goland at all – Mazzy Jan 24 '19 at 01:33
  • I know that but there is a chance the underlying issue is the same. – daplho Jan 24 '19 at 01:34
  • Also this question from yesterday https://stackoverflow.com/questions/54333761/unable-to-debug-go-code-could-not-launch-process-decoding-dwarf-section-info-a - are you running this on Mac? – Adrian Jan 24 '19 at 13:45

1 Answers1

3

After I've removed the -w flag delve was able to attach to the process

Mazzy
  • 13,354
  • 43
  • 126
  • 207