-
Notifications
You must be signed in to change notification settings - Fork 17.8k
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
cmd/compile: gdb 8 on windows crashes reading Go binary #21380
Comments
The same happens for gdb 7.11.1 from http://www.msys2.org/
|
@kjk if this worked with 1.8 and if you have the time, bisecting this to a commit made during the 1.9 cycle would be of great help. |
This works for me with Alex |
I'm also on windows and encountered a similar behavior when compiling go from source. The tests TestGdbBacktrace and TestGdbAutompTypes fail to run after compilation, with the exact same internal gdb error as posted here. After the suggestion by Alex Brainman that gdb 7.8 works for him I downloaded an old gdb and was able to confirm this on my machine. In the first try I got
Within the go documentation there exists the comment that go makes use of a extension for gdb. As I'm not familiar with GDB and the extension possibility I would like to give this information as a starting point for other people to debug this error. Edit: As suggested by mvdan I tried to build 1.8 release branch but got the exact same problem. So it's not a bug which was introduced by |
Just noting that some dwarf fix, not necessarily related, was made: 38bd725 |
Go 1.9 has since been released. Is this still an issue? Unfortunately, this was not placed in the right milestone, so it slipped through triaging. |
I've pulled the latest changes (03c3bb5) and retried this issue. It's still failing with the same error:
|
FYI, it looks as though a GDB binutils bug, 18624 was filed back in 2015 for this same issue. Reported for GDB 7.9, but presumably with a version of Go that was a good deal older than 1.9. This would suggest that the problem is not specific to 1.9. |
Given that this has been happening since 2015, not for Go 1.9.2. |
For anyone tripping on this: A temporary workaround is to use external linker:
This seems to make gdb happy (at least on recent windows/msys2) |
Change https://golang.org/cl/102419 mentions this issue: |
This ensures that gdb tests run on Windows by ignoring any line ending. Works with gdb 7.7, however with gdb 7.9 and 7.12 gets an error error: internal-error: buildsym_init: Assertion `free_pendings == NULL' failed. Updates #21380 Change-Id: I6a6e5b2a1b5efdca4dfce009fcb9c134c87497d6 Reviewed-on: https://go-review.googlesource.com/102419 TryBot-Result: Gobot Gobot <[email protected]> Reviewed-by: Alex Brainman <[email protected]>
This still happens with gdb 8.1 and go 1.11 (trunk). I've provided more details in gdb bug tracker: https://sourceware.org/bugzilla/show_bug.cgi?id=18624#c9 |
This might be a gdb bug that only happens with COFF/PE: https://sourceware.org/ml/gdb-patches/2018-06/msg00736.html |
I believe this is fixed in gdb 8.2. It now passes for me using STL's excellent and most recent MinGW distribution. https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=4735f0edf4265e3e260e10a12921baf17987a020
|
I'm just gonna leave this here for any poor soul on Windows who installs/updates MinGW and friends once in a blue moon or so: https://stackoverflow.com/questions/30069830/how-to-install-mingw-w64-and-msys2 |
Change https://go.dev/cl/470596 mentions this issue: |
The runtime-gdb.py script needs procid to be set in order to map a goroutine ID with an OS thread. The Go runtime is not currently setting that variable on Windows, so TestGdbPython (and friends) can't succeed. This CL initializes procid and unskips gdb tests on Windows. Fixes #22687 Updates #21380 Updates #22021 Change-Id: Icd1d9fc1764669ed1bf04f53d17fadfd24ac3f30 Reviewed-on: https://go-review.googlesource.com/c/go/+/470596 Reviewed-by: Alex Brainman <[email protected]> Reviewed-by: Dmitri Shuralyov <[email protected]> TryBot-Result: Gopher Robot <[email protected]> Reviewed-by: Bryan Mills <[email protected]> Run-TryBot: Quim Muntal <[email protected]>
What version of Go are you using (
go version
)?What operating system and processor architecture are you using (
go env
)?What did you do?
I'm trying to gather more information on #20975 which involves running the executable on windows under a debugger that understands dwarf debug info (because neither msvc nor windbg do).
I tried:
build.ps1
to build ithttps://nuwen.net/mingw.html
and unpack underc:\
C:\MinGW\bin\gdb.exe .\go20975.exe
to run under dbghttps://vox.com
in text boxWhat did you expect to see?
When crash happens, I expected to get a human-readable callstack.
What did you see instead?
The crash happened in the program but it also crashed gdb.
It seems that DWARF information created by Go compiler breaks gdb.
The text was updated successfully, but these errors were encountered: