Closed tzookb closed 1 month ago
Same issue on my side, but only on projects using cgo. This works as expected on non-cgo projects.
I would say that I made it "work" by downgrading dlv to 1.21.2
rm -f $(which dlv)
./build-support/go/go1.21.0/bin/go install github.com/go-delve/delve/cmd/dlv@v1.21.2
but now breakpoint are not stopping, as it says:
could not find file /xxxxx/src/go/example.com/contacts_interactions/server/contacts_interactions.go
Can you try to run dlv
command directly and see if it works?
I think something like
cd /xxxxxxx/connected_accounts/cmd/connected_accountsd
dlv debug ./main.go
cc @derekparker @aarzilli
not sure if it worked or not :|
#:/ dlv debug ./main.go
Warning: no debug info found, some functionality will be missing such as stack traces and variable evaluation.
Type 'help' for list of commands.
(dlv)
@tzookb was this using the latest version of Delve? This error message is unusual especially considering Delve is building the binary. The binary seems to be created without any debug information.
A few questions:
I just installed latest vscode-go, that installed latest dlv, as I don't want to jump hoops around versioning.
I tried to see what I can do here: https://github.com/golang/vscode-go/blob/master/docs/debugging.md#starting-a-debug-session-fails-with
but I get the original error of the issue:
Failed to launch: could not launch process: could not read debug info (decoding dwarf section info at offset 0x0: too short) and could not read go symbol table (could not find rodata struct member
dlv (latest 1.23.1) debug errors now:
➜ connected_accountsd git:(master) ✗ dlv debug ./main.go
Warning: no debug info found, some functionality will be missing such as stack traces and variable evaluation.
could not launch process: could not read debug info (decoding dwarf section info at offset 0x0: too short) and could not read go symbol table (could not find rodata struct member)
we are using a this go version: go version go1.21.0 darwin/arm64
Could be a duplicate of https://github.com/go-delve/delve/issues/3701, knowing whether you are using CGO would be important.
What's the output of clang --version
, ld -v
and dsymutil -v
?
clang --version
Apple clang version 16.0.0 (clang-1600.0.26.3)
Target: arm64-apple-darwin23.6.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
ld -v
@(#)PROGRAM:ld PROJECT:ld-1115.7.3
BUILD 13:29:00 Aug 9 2024
configured to support archs: armv6 armv7 armv7s arm64 arm64e arm64_32 i386 x86_64 x86_64h armv6m armv7k armv7m armv7em
will use ld-classic for: armv6 armv7 armv7s i386 armv6m armv7k armv7m armv7em
LTO support using: LLVM version 16.0.0 (static support for 29, runtime is 29)
TAPI support using: Apple TAPI version 16.0.0 (tapi-1600.0.11.8)
dsymutil -v
Apple LLVM version 16.0.0
(clang-1600.0.26.3)Optimized build.
xcode version: /usr/bin/xcodebuild -version
Xcode 16.0
Build version 16A242d
I couldn't replicate the other pr solution :|
What about cgo? Does it use it? Also can you post the binary executable built with go build -gcflags='all=-N -l' ...
somewhere?
In my case, cgo is heavily used (and I haven't the problem on non-cgo projects) and I've the same problem when using the command line:
CGO_CFLAGS="$(/usr/local/bin/php-config --includes) -I/opt/homebrew/include/" CGO_LDFLAGS="$(/usr/local/bin/
php-config --ldflags) $(/usr/local/bin/php-config --libs) -L/opt/homebrew/lib/" dlv debug main.go
WARN[0000] CGO_CFLAGS already set, Cgo code could be optimized. layer=dlv
# command-line-arguments
ld: warning: ignoring duplicate libraries: '-lcrypto', '-liconv', '-lpthread', '-lresolv', '-lsqlite3', '-lssl', '-lxml2'
Warning: no debug info found, some functionality will be missing such as stack traces and variable evaluation.
could not launch process: could not read debug info (decoding dwarf section info at offset 0x0: too short) and could not read go symbol table (could not find rodata struct member)
go version
go version go1.22.0 darwin/arm64
clang --version
Apple clang version 16.0.0 (clang-1600.0.26.3)
Target: arm64-apple-darwin24.0.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
ld -v
@(#)PROGRAM:ld PROJECT:ld-1115.7.3
BUILD 13:29:00 Aug 9 2024
configured to support archs: armv6 armv7 armv7s arm64 arm64e arm64_32 i386 x86_64 x86_64h armv6m armv7k armv7m armv7em
will use ld-classic for: armv6 armv7 armv7s i386 armv6m armv7k armv7m armv7em
LTO support using: LLVM version 16.0.0 (static support for 29, runtime is 29)
TAPI support using: Apple TAPI version 16.0.0 (tapi-1600.0.11.8)
dsymutil -v
Apple LLVM version 16.0.0
(clang-1600.0.26.3)Optimized build.
/usr/bin/xcodebuild -version
Xcode 16.0
Build version 16A242d
This looks to be the same issue as: https://github.com/go-delve/delve/issues/1138#issuecomment-2361176952 However, I tried to upgrade delve and the other workaround and nothing fixes the issue in my case.
cc @cherrymui it could be that the problem that existed with custom clang toolchains now also affects the xcode toolchain.
I also notified a weird issue that may, or may not be related.
Starting the program with go run main.go
works, but building it with go build
and then executing it fails with this error:
terminated by signal SIGKILL (Forced quit)
However, executing the binary that is killed through LLDB (lldb ./mybinary
) surprisingly works.
I figured out the issue on my side: it is because the project has toolchain go1.22.0
in its go.mod
.
Setting the environment variable GOTOOLCHAIN
to auto
to force using the system installation fixes both Delve and go build
. Thanks for your time and sorry for the noise.
Edit: the root of the issue was that ~/Library/Application\ Support/go/env
was containing a GOTOOLCHAIN
variable (I've no idea why, I probably messed it up at some point). Removing this file definitely fixed the issue.
at least for me I noticed that for an app that include packages that needs "CGO_ENABLED" it fails with the mentioned error.
it depends on https://github.com/confluentinc/confluent-kafka-go
@tzookb can you upgrade to go1.23 and see if the problem still reproduces?
checked with 1.23 and Im able to run and debug 😮💨
I think this can be closed.
do we have a suggestion for go 1.21?
Thanks @aarzilli @dunglas and @derekparker for your help investigating.
do we have a suggestion for go 1.21?
@tzookb as Go 1.21 is not supported by the Go release policy, I don't think we'll be able to help. If you must use 1.21, your solution above (downgrading delve) may be necessary.
I ran into this for a 1.22 golang project on my M1 mac (14.7.1) with latest xcode (16.0). Switching the project to 1.23 got debugging working again.
What version of Go, VS Code & VS Code Go extension are you using?
Version Information
* Run `go version` to get version of Go from _the VS Code integrated terminal_. - go version go1.21.0 darwin/arm64 * Run `gopls -v version` to get version of Gopls from _the VS Code integrated terminal_. ``` Build info ---------- golang.org/x/tools/gopls v0.16.2 golang.org/x/tools/gopls@v0.16.2 h1:K1z03MlikHfaMTtG01cUeL5FAOTJnITuNe0TWOcg8tM= github.com/BurntSushi/toml@v1.2.1 h1:9F2/+DoOYIOksmaJFPw1tGFy1eDnIJXg+UHjuD8lTak= github.com/google/go-cmp@v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= golang.org/x/exp/typeparams@v0.0.0-20221212164502-fae10dda9338 h1:2O2DON6y3XMJiQRAS1UWU+54aec2uopH3x7MAiqGW6Y= golang.org/x/mod@v0.20.0 h1:utOm6MM3R3dnawAiJgn0y+xvuYRsm1RKM/4giyfDgV0= golang.org/x/sync@v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ= golang.org/x/telemetry@v0.0.0-20240829154258-f29ab539cc98 h1:Wm3cG5X6sZ0RSVRc/H1/sciC4AT6HAKgLCSH2lbpR/c= golang.org/x/text@v0.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4= golang.org/x/tools@v0.22.1-0.20240829175637-39126e24d653 h1:6bJEg2w2kUHWlfdJaESYsmNfI1LKAZQi6zCa7LUn7eI= golang.org/x/vuln@v1.0.4 h1:SP0mPeg2PmGCu03V+61EcQiOjmpri2XijexKdzv8Z1I= honnef.co/go/tools@v0.4.7 h1:9MDAWxMoSnB6QoSqiVr7P5mtkT9pOc1kSxchzPCnqJs= mvdan.cc/gofumpt@v0.6.0 h1:G3QvahNDmpD+Aek/bNOLrFR2XC6ZAdo62dZu65gmwGo= mvdan.cc/xurls/v2@v2.5.0 h1:lyBNOm8Wo71UknhUs4QTFUNNMyxy2JEIaKKo0RWOh+8= go: go1.21.0 ``` * Run `code -v` or `code-insiders -v` to get version of VS Code or VS Code Insiders. ``` 1.93.1 38c31bc77e0dd6ae88a4e9cc93428cc27a56ba40 arm64 ``` * Check your installed extensions to get the version of the VS Code Go extension -
Share the Go related settings you have added/edited
launch.json:
Describe the bug
running the app like always, but now I get: (attached screenshot)
Screenshots or recordings