Unable to debug Go code: could not launch process: decoding dwarf section info at offset 0x0: too short

vscode golang could not launch process decoding dwarf section info at offset 0x0 too short
golang debug
upgrade delve
delve golang github
uninstall delve
golang devel
delve go binary
dlv documentation

we are trying to debug Go code and getting this error:

could not launch process: decoding dwarf section info at offset 0x0: too short

our settings:

WITSC02X6385JGH:orderer sjain68$ uname -a
Darwin WITSC02X6385JGH 17.7.0 Darwin Kernel Version 17.7.0: Fri Jul  6 19:54:51 PDT 2018; root:xnu-4570.71.3~2/RELEASE_X86_64 x86_64
WITSC02X6385JGH:orderer sjain68$ go version
go version go1.11 darwin/amd64
WITSC02X6385JGH:orderer sjain68$ dlv version
Delve Debugger
Version: 1.1.0
Build: $Id: 1990ba12450cab9425a2ae62e6ab988725023d5c

Things we have tried:

  • Update dlv using VS Code -> Go: Install/Update Tools

Try running from command line:

WITSC02X6385JGH:orderer sjain68$ /Users/sjain68/go/bin/dlv debug github.com/hyperledger/fabric/orderer --headless=true --listen=127.0.0.1:41305 --api-version=2 --log=true --
API server listening at: 127.0.0.1:41305
INFO[0002] launching process with args: [/Users/sjain68/go/src/github.com/hyperledger/fabric/orderer/debug]  layer=debugger
debugserver-@(#)PROGRAM:debugserver  PROJECT:debugserver-902.0.79.7
 for x86_64.
Got a connection, launched process /Users/sjain68/go/src/github.com/hyperledger/fabric/orderer/debug (pid = 9278).
Exiting.
could not launch process: decoding dwarf section info at offset 0x0: too short

Note that the binary that we are trying to debug does gets executed. Its just that the debugger does not launch.

Another thing we tried from this link:

WITSC02X6385JGH:orderer sjain68$ export GOFLAGS="-ldflags=-compressdwarf=false"; dlv debug
could not launch process: decoding dwarf section info at offset 0x0: too short

Someone said to run GOCACHE=off go build ... and output of that is pasted here.

How can we fix this?

I had the same issue after updateing Go. Updating Delve package from console helped:

go get -u github.com/go-delve/delve/cmd/dlv

could not launch process: decoding dwarf section info at , GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together. Sign up could not launch process: decoding dwarf section info at offset 0x0: too short #1138 But when I downupgrade the go version to 1.9.4 , it could debug normally. Still get the same issue could not launch process: decoding dwarf section info at offset 0x0: too short after update to Mac OS 10.14, GO 1.11 @JiaLiPassion I resolved it by moving to 1.1.0 of Delv. Apologies if you've already tried that

The solution that worked for us was to upgrade Go version

$ go version
go version go1.13.3 darwin/amd64

So Go 1.11 is the culprit.

cgo problem? ([Could not launch program: decoding dwarf section , 11:59 ~/code/go $ cat hello.go package main // #include // #include // static void hack(char GitHub is home to over 50 million developers working together to host and review Delve cannot debug go-qml example projects #97 could not launch process: decoding dwarf section info at offset 0x0: too short Debugging a Go contract with Go version 1.11 (on macOS) gives the error: could not launch process: decoding dwarf section info at offset 0x0: too short This issue disappears when Go is updated to 1.12 (Only macOS tested) Expected Behavior. User should be aware of the Go version required to debug contracts. Actual Behavior. No mention in the README

make sure you aren't using flags that remove the debug info from your build ie -ldflags="-s -w" .

https://lukeeckley.com/post/useful-go-build-flags/

decoding dwarf section info at offset 0x0: too short, decoding dwarf section info at offset 0x0: too short. delve output could not launch process could not find .debug_line section in binary get dlv delve remote debugging. I am using JetBrains GoLand and I am trying to debug my go file and I am getting the following error: After hours of effort, I was able to find the issue. could not launch process: decoding dwarf section info at offset 0x0: too short it could debug normally. Go version 1.10 does not work for the "decoding dwarf

could not launch process: decoding dwarf section info at , could not launch process: decoding dwarf section info at offset 0x0: too short. 2 While I downgrade the go version to 1.9.4 , it could debug normally. 2017/05/17 13:41:33 server.go:73: Using API v1 2017/05/17 13:41:33 debugger.go:97: launching process with args: [./debug.test] could not launch process: decoding dwarf section info at offset 0x0: too short Process exiting with code: 1

derekparker/delve, hello folks. i've been trying to use the delve plugin for atom to debug my go that includes a library i've written, and when i hit any of the library code (even just a fmt. i get "could not launch process: decoding dwarf section info at offset 0x0: too short". I'd like to be able to debug my program with go-sqlite3 pulled in. 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?

delve, Created 1 year ago in go-delve/delve with 2 comments. Hi! thx for could not launch process: decoding dwarf section info at offset 0x0: too short $ 0. Created 2​  I use Goland not enter debug mode. go_run_str_go -- #gosetup could not launch process: decoding dwarf section info at offset 0x0: too short Debugger finished with

Comments
  • Did you read this answer?
  • Yes we have. Is there anything in that answer that we have not tried?