Go version
go version go1.24.1 linux/arm64
Output of go env
in your module/workspace:
AR='ar'
CC='gcc'
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_ENABLED='1'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
CXX='g++'
GCCGO='gccgo'
GO111MODULE='on'
GOARCH='arm64'
GOARM64='v8.0'
GOAUTH='netrc'
GOBIN=''
GOCACHE='/home/ulin/.cache/go-build'
GOCACHEPROG=''
GODEBUG=''
GOENV='/home/ulin/.config/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFIPS140='off'
GOFLAGS=''
GOGCCFLAGS='-fPIC -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build1130356347=/tmp/go-build -gno-record-gcc-switches'
GOHOSTARCH='arm64'
GOHOSTOS='linux'
GOINSECURE=''
GOMOD='/dev/null'
GOMODCACHE='/home/ulin/gosrc/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='linux'
GOPATH='/home/ulin/gosrc'
GOPRIVATE=''
GOPROXY='https://goproxy.cn'
GOROOT='/usr/local/go'
GOSUMDB='off'
GOTELEMETRY='on'
GOTELEMETRYDIR='/home/ulin/.config/go/telemetry'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/usr/local/go/pkg/tool/linux_arm64'
GOVCS=''
GOVERSION='go1.24.1'
GOWORK=''
PKG_CONFIG='pkg-config'
GDB
$ gdb --version GNU gdb (Ubuntu 9.2-0ubuntu1~20.04.2) 9.2 Copyright (C) 2020 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.
What did you do?
CC=/usr/bin/clang-15 go test runtime -run TestGdbPythonCgo
What did you see happen?
Failed
--- FAIL: TestGdbPythonCgo (7.19s) runtime-gdb_test.go:79: gdb version 9.2 runtime-gdb_test.go:339: gdb output: Dwarf Error: DW_FORM_strx1 found in non-DWO CU [in module /tmp/TestGdbPythonCgo1034027560/001/a.exe]
Loading Go Runtime support. Loading Go Runtime support.
No symbol table is loaded. Use the "file" command.
Make breakpoint pending on future shared library load? (y or [n]) [answered N; input not from terminal]
[Thread debugging using libthread_db enabled] Using host libthread_db library "/lib/aarch64-linux-gnu/libthread_db.so.1". hi
map[a:[b c d] e:[f g h]], 99, spongepants [Inferior 1 (process 1159565) exited normally]
BEGIN info goroutines
Traceback (most recent call last):
File "/usr/local/go/src/runtime/runtime-gdb.py", line 567, in invoke for ptr in SliceValue(gdb.parse_and_eval("'runtime.allgs'")):
gdb.error: 'runtime.allgs' has unknown type; cast it to its declared type
Error occurred in Python: 'runtime.allgs' has unknown type; cast it to its declared type
END BEGIN print smallmapvar No symbol "smallmapvar" in current context. END BEGIN print mapvar No symbol "mapvar" in current context. END
BEGIN print slicemap No symbol "slicemap" in current context.
END
BEGIN print strvar No symbol "strvar" in current context. END
BEGIN print chanint No symbol "chanint" in current context.
END
BEGIN print chanstr
No symbol "chanstr" in current context.
END BEGIN info locals
No frame selected.
END
BEGIN goroutine 1 bt
Traceback (most recent call last):
File "/usr/local/go/src/runtime/runtime-gdb.py", line 661, in invoke
self.invoke_per_goid(goid, cmd)
File "/usr/local/go/src/runtime/runtime-gdb.py", line 664, in invoke_per_goid
pc, sp = find_goroutine(goid)
File "/usr/local/go/src/runtime/runtime-gdb.py", line 592, in find_goroutine
for ptr in SliceValue(gdb.parse_and_eval("'runtime.allgs'")):
gdb.error: 'runtime.allgs' has unknown type; cast it to its declared type
Error occurred in Python: 'runtime.allgs' has unknown type; cast it to its declared type
END
BEGIN goroutine all bt
Traceback (most recent call last):
File "/usr/local/go/src/runtime/runtime-gdb.py", line 655, in invoke
for ptr in SliceValue(gdb.parse_and_eval("'runtime.allgs'")):
gdb.error: 'runtime.allgs' has unknown type; cast it to its declared type
Error occurred in Python: 'runtime.allgs' has unknown type; cast it to its declared type
END
No source file named main.go.
No source file named main.go.
Make breakpoint pending on future shared library load? (y or [n]) [answered N; input not from terminal]
The program is not being run.
BEGIN goroutine 1 bt at the end
Traceback (most recent call last):
File "/usr/local/go/src/runtime/runtime-gdb.py", line 661, in invoke
self.invoke_per_goid(goid, cmd)
File "/usr/local/go/src/runtime/runtime-gdb.py", line 664, in invoke_per_goid
pc, sp = find_goroutine(goid)
File "/usr/local/go/src/runtime/runtime-gdb.py", line 592, in find_goroutine
for ptr in SliceValue(gdb.parse_and_eval("'runtime.allgs'")):
gdb.error: 'runtime.allgs' has unknown type; cast it to its declared type
Error occurred in Python: 'runtime.allgs' has unknown type; cast it to its declared type
END
runtime-gdb_test.go:354: info goroutines failed: Traceback (most recent call last):
File "/usr/local/go/src/runtime/runtime-gdb.py", line 567, in invoke
for ptr in SliceValue(gdb.parse_and_eval("'runtime.allgs'")):
gdb.error: 'runtime.allgs' has unknown type; cast it to its declared type
Error occurred in Python: 'runtime.allgs' has unknown type; cast it to its declared type
FAIL
FAIL runtime 7.209s
FAIL
What did you expect to see?
Test should pass.
Comment From: JunyangShao
@golang/runtime
Comment From: mknyszek
In triage, this seems like a DWARF issue? CC @dr2chase @thanm
CC @golang/compiler
go-delve/delve#3873 seems related, and this might end up being a Clang problem.
Comment From: thanm
@linsite for what it's worth we have a builder that runs clang-15 on linux/arm64 on every commit, and we don't see these failures there. This says to me that the test is failing on your particular system due to some sort of configuration problem, most likely with clang or GDB, not with Go. It's hard to think of possible suggestions without being able to experiment with the system by hand.
Generally speaking this error ("gdb.error: 'runtime.allgs' has unknown type; cast it to its declared type") means that GDB was able to start up the binary but wasn't able to read the Go-specific debug info (DWARF). This can mean that GDB is too old (I note that you did not include the GDB version with your report -- that piece of info would be helpful), or it could be that somehow the compiler is doing something that GDB doesn't like. Thanks.
Comment From: linsite
@linsite for what it's worth we have a builder that runs clang-15 on linux/arm64 on every commit, and we don't see these failures there. This says to me that the test is failing on your particular system due to some sort of configuration problem, most likely with clang or GDB, not with Go. It's hard to think of possible suggestions without being able to experiment with the system by hand.
Generally speaking this error ("gdb.error: 'runtime.allgs' has unknown type; cast it to its declared type") means that GDB was able to start up the binary but wasn't able to read the Go-specific debug info (DWARF). This can mean that GDB is too old (I note that you did not include the GDB version with your report -- that piece of info would be helpful), or it could be that somehow the compiler is doing something that GDB doesn't like. Thanks.
gdb info has been added. FYI gcc seems to work fine in the very same environment.
$ CC=/usr/bin/gcc go test runtime -run TestGdbPythonCgo
ok runtime 8.265s
if there are any tests or information needed, please let me know. i'll try to do a build manully to see if there is anything intresting.
Comment From: ianlancetaylor
gdb 9 is fairly old. On the Go clang15 builder we are running gdb 13.1. Just a couple of days ago we changed the minimum gdb requirement on HEAD to be gdb 10. Perhaps we should simply backport that requirement.
Comment From: linsite
Thanks. @ianlancetaylor
It's clear to me now that clang15 is using DWARFv5, is not compatible with gdb 9.
gdb 9 is fairly old. On the Go clang15 builder we are running gdb 13.1. Just a couple of days ago we changed the minimum gdb requirement on HEAD to be gdb 10. Perhaps we should simply backport that requirement.
I totally agree, that surely can help.
Comment From: thanm
Closing this bug out; please reopen if there is more work to do here, thanks.