我们正在尝试调试Go代码并收到以下错误消息:
could not launch process: decoding dwarf section info at offset 0x0: too short
我们的设置:
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
我们尝试过的事情:
尝试从命令行运行:
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
请注意,我们尝试调试的二进制文件确实已执行。只是调试器无法启动。
我们试图从另一件事此链接:
WITSC02X6385JGH:orderer sjain68$ export GOFLAGS="-ldflags=-compressdwarf=false"; dlv debug could not launch process: decoding dwarf section info at offset 0x0: too short
有人说要运行GOCACHE = off go build …并将其输出粘贴到这里。
我们该如何解决?
对我们有用的解决方案是升级Go版本
$ go version go version go1.13.3 darwin/amd64
所以Go 1.11是元凶。