Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot debug tests linked to non-Go code with CGo #3552

Closed
BatmanAoD opened this issue Sep 26, 2024 · 2 comments
Closed

Cannot debug tests linked to non-Go code with CGo #3552

BatmanAoD opened this issue Sep 26, 2024 · 2 comments
Labels
Debug Issues related to the debugging functionality of the extension.
Milestone

Comments

@BatmanAoD
Copy link

BatmanAoD commented Sep 26, 2024

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.22.5 darwin/arm64
  • Run gopls -v version to get version of Gopls from the VS Code integrated terminal.
    • golang.org/x/tools/gopls v0.16.2
  • 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
    • v0.42.1
  • Run Ctrl+Shift+P (Cmd+Shift+P on Mac OS) > Go: Locate Configured Go Tools command.

# Tools Configuration


## Environment

GOBIN: undefined
toolsGopath: 
gopath: /Users/kstrand/workspace/go
GOROOT: /Users/kstrand/sdk/go1.22.5
PATH: /Users/kstrand/sdk/go1.22.5/bin:/Users/kstrand/Library/pnpm:/Users/kstrand/.pyenv/shims:/Users/kstrand/Library/Application Support/carapace/bin:/opt/homebrew/opt/zstd/bin:/opt/homebrew/opt/z3/bin:/opt/homebrew/opt/yuicompressor/bin:/opt/homebrew/opt/yajl/bin:/opt/homebrew/opt/xz/bin:/opt/homebrew/opt/xxhash/bin:/opt/homebrew/opt/wget/bin:/opt/homebrew/opt/webp/bin:/opt/homebrew/opt/vde/bin:/opt/homebrew/opt/tree-sitter/bin:/opt/homebrew/opt/tmux/bin:/opt/homebrew/opt/telnet/bin:/opt/homebrew/opt/tcptraceroute/bin:/opt/homebrew/opt/squid/bin:/opt/homebrew/opt/sqlite3/bin:/opt/homebrew/opt/sqlite/bin:/opt/homebrew/opt/[email protected]/bin:/opt/homebrew/opt/skaffold/bin:/opt/homebrew/opt/shellcheck/bin:/opt/homebrew/opt/sccache/bin:/opt/homebrew/opt/rsync/bin:/opt/homebrew/opt/qemu/bin:/opt/homebrew/opt/pzstd/bin:/opt/homebrew/opt/python@3/bin:/opt/homebrew/opt/[email protected]/bin:/opt/homebrew/opt/[email protected]/bin:/opt/homebrew/opt/[email protected]/bin:/opt/homebrew/opt/python3/bin:/opt/homebrew/opt/python/bin:/opt/homebrew/opt/pyenv/bin:/opt/homebrew/opt/protobuf@25/bin:/opt/homebrew/opt/protobuf@23/bin:/opt/homebrew/opt/protobuf/bin:/opt/homebrew/opt/pkgconfig/bin:/opt/homebrew/opt/pkg-config/bin:/opt/homebrew/opt/pcre2/bin:/opt/homebrew/opt/pango/bin:/opt/homebrew/opt/p11-kit/bin:/opt/homebrew/opt/openssl@3/bin:/opt/homebrew/opt/[email protected]/bin:/opt/homebrew/opt/[email protected]/bin:/opt/homebrew/opt/[email protected]/bin:/opt/homebrew/opt/openssl/bin:/opt/homebrew/opt/openjdk@22/bin:/opt/homebrew/opt/openjdk@21/bin:/opt/homebrew/opt/openjdk@20/bin:/opt/homebrew/opt/openjdk/bin:/opt/homebrew/opt/openexr@3/bin:/opt/homebrew/opt/openexr/bin:/opt/homebrew/opt/oniguruma/bin:/opt/homebrew/opt/nvim/bin:/opt/homebrew/opt/npm/bin:/opt/homebrew/opt/nomad/bin:/opt/homebrew/opt/nodejs/bin:/opt/homebrew/opt/node@22/bin:/opt/homebrew/opt/node@21/bin:/opt/homebrew/opt/node@20/bin:/opt/homebrew/opt/node/bin:/opt/homebrew/opt/node.js/bin:/opt/homebrew/opt/ninja/bin:/opt/homebrew/opt/nettle/bin:/opt/homebrew/opt/netpbm/bin:/opt/homebrew/opt/neovim/bin:/opt/homebrew/opt/ncurses/bin:/opt/homebrew/opt/meson/bin:/opt/homebrew/opt/make/bin:/opt/homebrew/opt/m4/bin:/opt/homebrew/opt/lz4/bin:/opt/homebrew/opt/luajit/bin:/opt/homebrew/opt/lmdb/bin:/opt/homebrew/opt/llvm@18/bin:/opt/homebrew/opt/llvm/bin:/opt/homebrew/opt/little-cms2/bin:/opt/homebrew/opt/lima/bin:/opt/homebrew/opt/libvterm/bin:/opt/homebrew/opt/libvmaf/bin:/opt/homebrew/opt/libtool/bin:/opt/homebrew/opt/libtiff/bin:/opt/homebrew/opt/libtasn1/bin:/opt/homebrew/opt/libtasn/bin:/opt/homebrew/opt/librsvg/bin:/opt/homebrew/opt/libpng/bin:/opt/homebrew/opt/libnettle/bin:/opt/homebrew/opt/libnet/bin:/opt/homebrew/opt/libjpeg-turbo/bin:/opt/homebrew/opt/libidn2/bin:/opt/homebrew/opt/libgd/bin:/opt/homebrew/opt/libevent/bin:/opt/homebrew/opt/libavif/bin:/opt/homebrew/opt/lcms2/bin:/opt/homebrew/opt/[email protected]/bin:/opt/homebrew/opt/[email protected]/bin:/opt/homebrew/opt/kubernetes-cli/bin:/opt/homebrew/opt/kubectx/bin:/opt/homebrew/opt/[email protected]/bin:/opt/homebrew/opt/[email protected]/bin:/opt/homebrew/opt/kubectl/bin:/opt/homebrew/opt/kcat/bin:/opt/homebrew/opt/k9s/bin:/opt/homebrew/opt/jq/bin:/opt/homebrew/opt/jpeg-xl/bin:/opt/homebrew/opt/jpeg-turbo/bin:/opt/homebrew/opt/jd/bin:/opt/homebrew/opt/java/bin:/opt/homebrew/opt/jasper/bin:/opt/homebrew/opt/icu4c/bin:/opt/homebrew/opt/htop/bin:/opt/homebrew/opt/htop-osx/bin:/opt/homebrew/opt/helm@3/bin:/opt/homebrew/opt/helm/bin:/opt/homebrew/opt/[email protected]/bin:/opt/homebrew/opt/hdf5/bin:/opt/homebrew/opt/harfbuzz/bin:/opt/homebrew/opt/gts/bin:/opt/homebrew/opt/gsed/bin:/opt/homebrew/opt/grpcurl/bin:/opt/homebrew/opt/graphviz/bin:/opt/homebrew/opt/graphite2/bin:/opt/homebrew/opt/google-go/bin:/opt/homebrew/opt/golang/bin:/opt/homebrew/opt/gobject-introspection/bin:/opt/homebrew/opt/[email protected]/bin:/opt/homebrew/opt/[email protected]/bin:/opt/homebrew/opt/go/bin:/opt/homebrew/opt/gnutls/bin:/opt/homebrew/opt/gnu-time/bin:/opt/homebrew/opt/gnu-sed/bin:/opt/homebrew/opt/glib/bin:/opt/homebrew/opt/glab/bin:/opt/homebrew/opt/git/bin:/opt/homebrew/opt/giflib/bin:/opt/homebrew/opt/ghz/bin:/opt/homebrew/opt/gh/bin:/opt/homebrew/opt/gfortran/bin:/opt/homebrew/opt/gettext/bin:/opt/homebrew/opt/gdk-pixbuf/bin:/opt/homebrew/opt/gdbm/bin:/opt/homebrew/opt/gd/bin:/opt/homebrew/opt/gcc@13/bin:/opt/homebrew/opt/gcc/bin:/opt/homebrew/opt/gawk/bin:/opt/homebrew/opt/fzf/bin:/opt/homebrew/opt/fribidi/bin:/opt/homebrew/opt/freetype2/bin:/opt/homebrew/opt/freetype/bin:/opt/homebrew/opt/fontconfig/bin:/opt/homebrew/opt/flex/bin:/opt/homebrew/opt/findutils/bin:/opt/homebrew/opt/evans/bin:/opt/homebrew/opt/envoy/bin:/opt/homebrew/opt/emscripten/bin:/opt/homebrew/opt/dtc/bin:/opt/homebrew/opt/docker/bin:/opt/homebrew/opt/docker-compose/bin:/opt/homebrew/opt/difftastic/bin:/opt/homebrew/opt/coreutils/bin:/opt/homebrew/opt/colima/bin:/opt/homebrew/opt/cmake/bin:/opt/homebrew/opt/chafa/bin:/opt/homebrew/opt/carapace/bin:/opt/homebrew/opt/capstone/bin:/opt/homebrew/opt/cairo/bin:/opt/homebrew/opt/c-ares/bin:/opt/homebrew/opt/buf/bin:/opt/homebrew/opt/brotli/bin:/opt/homebrew/opt/[email protected]/bin:/opt/homebrew/opt/bison/bin:/opt/homebrew/opt/bazelisk/bin:/opt/homebrew/opt/bash/bin:/opt/homebrew/opt/avro-c/bin:/opt/homebrew/opt/[email protected]/bin:/opt/homebrew/opt/autoconf/bin:/opt/homebrew/opt/atuin/bin:/opt/homebrew/opt/aom/bin:/opt/homebrew/opt/make/libexec/gnubin:/opt/homebrew/opt/libtool/libexec/gnubin:/opt/homebrew/opt/gsed/libexec/gnubin:/opt/homebrew/opt/gnu-time/libexec/gnubin:/opt/homebrew/opt/gnu-sed/libexec/gnubin:/opt/homebrew/opt/gawk/libexec/gnubin:/opt/homebrew/opt/findutils/libexec/gnubin:/opt/homebrew/opt/coreutils/libexec/gnubin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Library/Apple/usr/bin:/Applications/Wireshark.app/Contents/MacOS:/usr/local/go/bin:/opt/podman/bin:/Users/kstrand/.cargo/bin:/Users/kstrand/bin:/Users/kstrand/.yarn/bin:/Users/kstrand/.local/bin:/opt/local/bin:/opt/local/sbin:/Users/kstrand/workspace/go/bin:/Users/kstrand/.fzf/bin
PATH (vscode launched with): /Users/kstrand/Library/pnpm:/Users/kstrand/.pyenv/shims:/Users/kstrand/Library/Application Support/carapace/bin:/opt/homebrew/opt/zstd/bin:/opt/homebrew/opt/z3/bin:/opt/homebrew/opt/yuicompressor/bin:/opt/homebrew/opt/yajl/bin:/opt/homebrew/opt/xz/bin:/opt/homebrew/opt/xxhash/bin:/opt/homebrew/opt/wget/bin:/opt/homebrew/opt/webp/bin:/opt/homebrew/opt/vde/bin:/opt/homebrew/opt/tree-sitter/bin:/opt/homebrew/opt/tmux/bin:/opt/homebrew/opt/telnet/bin:/opt/homebrew/opt/tcptraceroute/bin:/opt/homebrew/opt/squid/bin:/opt/homebrew/opt/sqlite3/bin:/opt/homebrew/opt/sqlite/bin:/opt/homebrew/opt/[email protected]/bin:/opt/homebrew/opt/skaffold/bin:/opt/homebrew/opt/shellcheck/bin:/opt/homebrew/opt/sccache/bin:/opt/homebrew/opt/rsync/bin:/opt/homebrew/opt/qemu/bin:/opt/homebrew/opt/pzstd/bin:/opt/homebrew/opt/python@3/bin:/opt/homebrew/opt/[email protected]/bin:/opt/homebrew/opt/[email protected]/bin:/opt/homebrew/opt/[email protected]/bin:/opt/homebrew/opt/python3/bin:/opt/homebrew/opt/python/bin:/opt/homebrew/opt/pyenv/bin:/opt/homebrew/opt/protobuf@25/bin:/opt/homebrew/opt/protobuf@23/bin:/opt/homebrew/opt/protobuf/bin:/opt/homebrew/opt/pkgconfig/bin:/opt/homebrew/opt/pkg-config/bin:/opt/homebrew/opt/pcre2/bin:/opt/homebrew/opt/pango/bin:/opt/homebrew/opt/p11-kit/bin:/opt/homebrew/opt/openssl@3/bin:/opt/homebrew/opt/[email protected]/bin:/opt/homebrew/opt/[email protected]/bin:/opt/homebrew/opt/[email protected]/bin:/opt/homebrew/opt/openssl/bin:/opt/homebrew/opt/openjdk@22/bin:/opt/homebrew/opt/openjdk@21/bin:/opt/homebrew/opt/openjdk@20/bin:/opt/homebrew/opt/openjdk/bin:/opt/homebrew/opt/openexr@3/bin:/opt/homebrew/opt/openexr/bin:/opt/homebrew/opt/oniguruma/bin:/opt/homebrew/opt/nvim/bin:/opt/homebrew/opt/npm/bin:/opt/homebrew/opt/nomad/bin:/opt/homebrew/opt/nodejs/bin:/opt/homebrew/opt/node@22/bin:/opt/homebrew/opt/node@21/bin:/opt/homebrew/opt/node@20/bin:/opt/homebrew/opt/node/bin:/opt/homebrew/opt/node.js/bin:/opt/homebrew/opt/ninja/bin:/opt/homebrew/opt/nettle/bin:/opt/homebrew/opt/netpbm/bin:/opt/homebrew/opt/neovim/bin:/opt/homebrew/opt/ncurses/bin:/opt/homebrew/opt/meson/bin:/opt/homebrew/opt/make/bin:/opt/homebrew/opt/m4/bin:/opt/homebrew/opt/lz4/bin:/opt/homebrew/opt/luajit/bin:/opt/homebrew/opt/lmdb/bin:/opt/homebrew/opt/llvm@18/bin:/opt/homebrew/opt/llvm/bin:/opt/homebrew/opt/little-cms2/bin:/opt/homebrew/opt/lima/bin:/opt/homebrew/opt/libvterm/bin:/opt/homebrew/opt/libvmaf/bin:/opt/homebrew/opt/libtool/bin:/opt/homebrew/opt/libtiff/bin:/opt/homebrew/opt/libtasn1/bin:/opt/homebrew/opt/libtasn/bin:/opt/homebrew/opt/librsvg/bin:/opt/homebrew/opt/libpng/bin:/opt/homebrew/opt/libnettle/bin:/opt/homebrew/opt/libnet/bin:/opt/homebrew/opt/libjpeg-turbo/bin:/opt/homebrew/opt/libidn2/bin:/opt/homebrew/opt/libgd/bin:/opt/homebrew/opt/libevent/bin:/opt/homebrew/opt/libavif/bin:/opt/homebrew/opt/lcms2/bin:/opt/homebrew/opt/[email protected]/bin:/opt/homebrew/opt/[email protected]/bin:/opt/homebrew/opt/kubernetes-cli/bin:/opt/homebrew/opt/kubectx/bin:/opt/homebrew/opt/[email protected]/bin:/opt/homebrew/opt/[email protected]/bin:/opt/homebrew/opt/kubectl/bin:/opt/homebrew/opt/kcat/bin:/opt/homebrew/opt/k9s/bin:/opt/homebrew/opt/jq/bin:/opt/homebrew/opt/jpeg-xl/bin:/opt/homebrew/opt/jpeg-turbo/bin:/opt/homebrew/opt/jd/bin:/opt/homebrew/opt/java/bin:/opt/homebrew/opt/jasper/bin:/opt/homebrew/opt/icu4c/bin:/opt/homebrew/opt/htop/bin:/opt/homebrew/opt/htop-osx/bin:/opt/homebrew/opt/helm@3/bin:/opt/homebrew/opt/helm/bin:/opt/homebrew/opt/[email protected]/bin:/opt/homebrew/opt/hdf5/bin:/opt/homebrew/opt/harfbuzz/bin:/opt/homebrew/opt/gts/bin:/opt/homebrew/opt/gsed/bin:/opt/homebrew/opt/grpcurl/bin:/opt/homebrew/opt/graphviz/bin:/opt/homebrew/opt/graphite2/bin:/opt/homebrew/opt/google-go/bin:/opt/homebrew/opt/golang/bin:/opt/homebrew/opt/gobject-introspection/bin:/opt/homebrew/opt/[email protected]/bin:/opt/homebrew/opt/[email protected]/bin:/opt/homebrew/opt/go/bin:/opt/homebrew/opt/gnutls/bin:/opt/homebrew/opt/gnu-time/bin:/opt/homebrew/opt/gnu-sed/bin:/opt/homebrew/opt/glib/bin:/opt/homebrew/opt/glab/bin:/opt/homebrew/opt/git/bin:/opt/homebrew/opt/giflib/bin:/opt/homebrew/opt/ghz/bin:/opt/homebrew/opt/gh/bin:/opt/homebrew/opt/gfortran/bin:/opt/homebrew/opt/gettext/bin:/opt/homebrew/opt/gdk-pixbuf/bin:/opt/homebrew/opt/gdbm/bin:/opt/homebrew/opt/gd/bin:/opt/homebrew/opt/gcc@13/bin:/opt/homebrew/opt/gcc/bin:/opt/homebrew/opt/gawk/bin:/opt/homebrew/opt/fzf/bin:/opt/homebrew/opt/fribidi/bin:/opt/homebrew/opt/freetype2/bin:/opt/homebrew/opt/freetype/bin:/opt/homebrew/opt/fontconfig/bin:/opt/homebrew/opt/flex/bin:/opt/homebrew/opt/findutils/bin:/opt/homebrew/opt/evans/bin:/opt/homebrew/opt/envoy/bin:/opt/homebrew/opt/emscripten/bin:/opt/homebrew/opt/dtc/bin:/opt/homebrew/opt/docker/bin:/opt/homebrew/opt/docker-compose/bin:/opt/homebrew/opt/difftastic/bin:/opt/homebrew/opt/coreutils/bin:/opt/homebrew/opt/colima/bin:/opt/homebrew/opt/cmake/bin:/opt/homebrew/opt/chafa/bin:/opt/homebrew/opt/carapace/bin:/opt/homebrew/opt/capstone/bin:/opt/homebrew/opt/cairo/bin:/opt/homebrew/opt/c-ares/bin:/opt/homebrew/opt/buf/bin:/opt/homebrew/opt/brotli/bin:/opt/homebrew/opt/[email protected]/bin:/opt/homebrew/opt/bison/bin:/opt/homebrew/opt/bazelisk/bin:/opt/homebrew/opt/bash/bin:/opt/homebrew/opt/avro-c/bin:/opt/homebrew/opt/[email protected]/bin:/opt/homebrew/opt/autoconf/bin:/opt/homebrew/opt/atuin/bin:/opt/homebrew/opt/aom/bin:/opt/homebrew/opt/make/libexec/gnubin:/opt/homebrew/opt/libtool/libexec/gnubin:/opt/homebrew/opt/gsed/libexec/gnubin:/opt/homebrew/opt/gnu-time/libexec/gnubin:/opt/homebrew/opt/gnu-sed/libexec/gnubin:/opt/homebrew/opt/gawk/libexec/gnubin:/opt/homebrew/opt/findutils/libexec/gnubin:/opt/homebrew/opt/coreutils/libexec/gnubin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Library/Apple/usr/bin:/Applications/Wireshark.app/Contents/MacOS:/usr/local/go/bin:/opt/podman/bin:/Users/kstrand/.cargo/bin:/Users/kstrand/bin:/Users/kstrand/.yarn/bin:/Users/kstrand/.local/bin:/opt/local/bin:/opt/local/sbin:/Users/kstrand/workspace/go/bin:/Users/kstrand/.fzf/bin

## Tools

	go:	/Users/kstrand/sdk/go1.22.5/bin/go: go version go1.22.5 darwin/arm64

	gopls:	/Users/kstrand/workspace/go/bin/gopls	(version: v0.16.2 built with go: go1.22.5)
	gotests:	/Users/kstrand/workspace/go/bin/gotests	(version: v1.6.0 built with go: go1.22.5)
	gomodifytags:	not installed
	impl:	not installed
	goplay:	not installed
	dlv:	/Users/kstrand/workspace/go/bin/dlv	(version: v1.23.0 built with go: go1.22.5)
	staticcheck:	/Users/kstrand/workspace/go/bin/staticcheck	(version: v0.4.7 built with go: go1.22.5)

## Go env

Workspace Folder (controller): /Users/kstrand/workspace/controller

	GO111MODULE=''
	GOARCH='arm64'
	GOBIN=''
	GOCACHE='/Users/kstrand/Library/Caches/go-build'
	GOENV='/Users/kstrand/Library/Application Support/go/env'
	GOEXE=''
	GOEXPERIMENT=''
	GOFLAGS=''
	GOHOSTARCH='arm64'
	GOHOSTOS='darwin'
	GOINSECURE=''
	GOMODCACHE='/Users/kstrand/workspace/go/pkg/mod'
	GONOPROXY='gitlab.com/rigetti'
	GONOSUMDB='gitlab.com/rigetti'
	GOOS='darwin'
	GOPATH='/Users/kstrand/workspace/go'
	GOPRIVATE='gitlab.com/rigetti'
	GOPROXY='https://proxy.golang.org,direct'
	GOROOT='/Users/kstrand/sdk/go1.22.5'
	GOSUMDB='sum.golang.org'
	GOTMPDIR=''
	GOTOOLCHAIN='auto'
	GOTOOLDIR='/Users/kstrand/sdk/go1.22.5/pkg/tool/darwin_arm64'
	GOVCS=''
	GOVERSION='go1.22.5'
	GCCGO='gccgo'
	AR='ar'
	CC='clang'
	CXX='clang++'
	CGO_ENABLED='1'
	GOMOD='/Users/kstrand/workspace/controller/go.mod'
	GOWORK=''
	CGO_CFLAGS='-O2 -g'
	CGO_CPPFLAGS=''
	CGO_CXXFLAGS='-O2 -g'
	CGO_FFLAGS='-O2 -g'
	CGO_LDFLAGS='-O2 -g'
	PKG_CONFIG='pkg-config'
	GOGCCFLAGS='-fPIC -arch arm64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -ffile-prefix-map=/var/folders/p5/r6b6hyz97bj53sddy2cn4fd80000gq/T/go-build3728861249=/tmp/go-build -gno-record-gcc-switches -fno-common'

Share the Go related settings you have added/edited

  "go.buildFlags": [
    "-tags=unit,integration"
  ],
  "go.testTags": "unit,integration",
  "go.delveConfig": {
    "debugAdapter": "dlv-dap",
  },
  "[go]": {
    "editor.formatOnSave": true,
    "editor.codeActionsOnSave": {
      "source.organizeImports": "explicit"
    }
  },

Launch profile:

        {
            "name": "Go Test",
            "type": "go",
            "request": "launch",
            "mode": "test",
            "program": "${fileDirname}",
            "buildFlags": [
                "-tags=unit,integration",
                "-gcflags=all=-N -l",
            ],
            "logOutput": "dap,debugger,gdbwire,lldbout",
            "trace": "verbose",
            "showLog": true,
        }

Describe the bug

I have a project that uses UniFFI and uniffi-bindgen-go to generate Go bindings for a Rust library. It appears that any unit tests that import these bindings cause the debugger not to start. Instead, it shows this error:

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)

Unfortunately, I don't have a simple example Rust/Go library that I can share; if that would help, I can try to put together a minimal example some time in the next few weeks.

I have built and linked the Rust bindings in both debug and release mode, but this does not seem to make a difference, and I also don't need the debugger to work across the FFI boundary, so I wouldn't expect the Rust debug symbols to matter.

This is the CGO link declaration (bindings is the name of the Rust library):

// #cgo LDFLAGS: -L../target/debug -lbindings -ldl -lm -lpthread

Using dlv test on the command line seems to work fine:

dlv test --build-flags="-tags=unit" ./queue/policy/ -- -test.run <testname>

Steps to reproduce the behavior:

I see this no matter how I launch the debugger (i.e. from the "Run and Debug" panel, from the test UI, or using the "Go: Debug Test At Cursor" command).

Screenshots or recordings

image

Debug log (with dap,debugger,gdbwire,lldbout logging):

dlv_debug.txt

@gopherbot gopherbot added this to the Untriaged milestone Sep 26, 2024
@hyangah
Copy link
Contributor

hyangah commented Sep 27, 2024

We recently saw a similar issue #3547 and go-delve/delve#1138.
Can you upgrade to go1.23.1 and reinstall dlv to see if it resolves your issue?
Thanks!

@hyangah hyangah added the Debug Issues related to the debugging functionality of the extension. label Sep 27, 2024
@BatmanAoD
Copy link
Author

@hyangah Thank you; that worked! (It took a few tries because apparently the ~/sdk/.../go version of Go was separate from everything on my PATH, so I have no idea why VSCode was using that or how it got there. 🤨)

Sorry for opening a duplicate; #3547 is almost certainly the same issue. I looked for issues with cgo but somehow didn't find that one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Debug Issues related to the debugging functionality of the extension.
Projects
None yet
Development

No branches or pull requests

3 participants