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

Fabric调试异常

作者在使用chaincode进行智能合约开发的过程中,使用Goland + Golang + win10_X64作为开发环境:

GoLand 2018.1.4
Build #GO-181.5087.39, built on May 24, 2018
Licensed to youBBS

JRE: 1.8.0_152-release-1136-b39 amd64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Windows 10 10.0

go1.11.4 windows/amd64

但在调试的时候会发生如下错误:

D:\golang\bin\go.exe test -c -tags nopkcs1 -o C:\Users\NewWang\AppData\Local\Temp\___TestBcoin_Init_in_github_com_utxo_chaincode.exe -gcflags "all=-N -l" github.com/utxo/chaincode #gosetup
"E:\GoLand 2018.1.4\bin\runnerw.exe" D:\golang\bin\go.exe tool test2json -t C:\Users\NewWang\.GoLand2018.1\config\plugins\intellij-go\lib\dlv\windows\dlv.exe --listen=localhost:58370 --headless=true --api-version=2 --backend=default exec C:\Users\NewWang\AppData\Local\Temp\___TestBcoin_Init_in_github_com_utxo_chaincode.exe -- -test.v -test.run ^TestBcoin_Init$ #gosetup

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

总结网络上提出以下两种解决方案:

  1. 升级Goland 版本到2018.2以上的版本
  2. 使用 go get -u -v github.com/derekparker/delve/cmd/dlv 命令去编译新版本的dlv,然后在通过在 Help — Edit Custom Properties 中添加: dlv.path=D:/gopath/bin/dlv.exe,来更新dlv到与go适配的版本。

但是第二种方式经过作者的实际测试是无效的,后经过多方检索找到了真正的原因:

在1.10以上的版本中,当应用工程引入plugin的包后debugframe会丢失,导致dlv无法使用。

解决方案:

  1. 等待 1.12 版本中修复这个问题
  2. 将go的版本降低到1.9

参考链接:

https://youtrack.jetbrains.com/issue/GO-5446
https://github.com/golang/go/issues/23733

    原文作者:王的博客
    原文地址: https://www.cnblogs.com/cnblogs-wangzhipeng/p/10209688.html
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞