为了账号安全,请及时绑定邮箱和手机立即绑定

无法调试 Go 代码:无法启动进程:在偏移量 0x0 处解码矮节信息:太短

无法调试 Go 代码:无法启动进程:在偏移量 0x0 处解码矮节信息:太短

Go
九州编程 2023-06-01 18:08:07
我们正在尝试调试 Go 代码并收到此错误:could not launch process: decoding dwarf section info at offset 0x0: too short我们的设置:WITSC02X6385JGH:orderer sjain68$ uname -aDarwin 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_64WITSC02X6385JGH:orderer sjain68$ go versiongo version go1.11 darwin/amd64WITSC02X6385JGH:orderer sjain68$ dlv versionDelve DebuggerVersion: 1.1.0Build: $Id: 1990ba12450cab9425a2ae62e6ab988725023d5c我们尝试过的事情:使用 VS Code 更新 dlv -> Go: Install/Update Tools尝试从命令行运行: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:41305INFO[0002] launching process with args: [/Users/sjain68/go/src/github.com/hyperledger/fabric/orderer/debug]  layer=debuggerdebugserver-@(#)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 debugcould not launch process: decoding dwarf section info at offset 0x0: too short有人说要运行 GOCACHE=off go build ... 我们如何解决这个问题?
查看完整描述

3 回答

?
墨色风雨

TA贡献1853条经验 获得超6个赞

更新 Go 后我遇到了同样的问题。从控制台更新 Delve 包有帮助:

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


查看完整回答
反对 回复 2023-06-01
?
梦里花落0921

TA贡献1772条经验 获得超5个赞

确保您没有使用从构建中删除调试信息的标志,即 -ldflags="-s -w" 。



查看完整回答
反对 回复 2023-06-01
?
牛魔王的故事

TA贡献1830条经验 获得超3个赞

对我们有用的解决方案是升级 Go 版本


$ go version

go version go1.13.3 darwin/amd64

所以 Go 1.11 是罪魁祸首。


查看完整回答
反对 回复 2023-06-01
  • 3 回答
  • 0 关注
  • 170 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信