-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Use libbacktrace to generate readable backtrace on Windows #36615
Conversation
f4e6e10
to
a1a2c80
Compare
Well, turns out libbacktrace is not a distributed part of GCC. There has been a pull request to add it to the MXE environment, but that pull request has been inactive for well over a year. |
abc946b
to
a00d30d
Compare
1f6a73b
to
f2fe6da
Compare
It's working in the CI builds now. However to release Windows binaries with this change, the build script of narc.ro needs to be changed. Of course I can hack the Makefile to do it, but that seems rather inelegant. @narc0tiq can you change the build script of Jenkins to build the Windows binaries against libbacktrace with LIBBACKTRACE=1, once this gets merged? The prebuilt binaries of libbacktrace can be found here. |
@Qrox I guess we'll just need to add ## Set up environment
case "${Platform}" in
"Windows")
PLATFORM="i686-w64-mingw32.static"
export CROSS="/home/narc/mxe/usr/bin/${PLATFORM}-"
export NATIVE="win32"
;;
"Windows_x64")
PLATFORM="x86_64-w64-mingw32.static"
export CROSS="/home/narc/mxe/usr/bin/${PLATFORM}-"
export NATIVE="win64"
;; Edit: It is also possible, that it would all just work automatically as BACKTRACE is set to 1 by default for non-MSYS2 builds (and LIBBACKTRACE is set to 1 by default when cross-compiling for Windows). I will see if we would need to download libbacktrace binary to Jenkins manually. |
If we're using |
|
Are you using the x86_64 (64 bit) or the i686 (32 bit) binary? It's linking to a 64 bit target so it should use the x86_64 one. |
Oh, yes. Could be my bad - I've probably curled 32 bit version and unpacked it to 64 bit folder. |
|
Seems to be working nice! |
This pull request has been mentioned on Cataclysm: Dark Days Ahead. There might be relevant details there: |
Summary
SUMMARY: Build "Use libbacktrace to generate readable backtrace on Windows"
Purpose of change
The Windows dbghelp library currently used to generate backtrace is unable to read the debug info genrated by MinGW, so the current implementation only prints the addresses of the call stack, which does not help much for debugging. This PR uses libbacktrace of GCC in addition to dbghelp to generate readable backtrace on Windows.
Describe the solution
libbacktrace
in addition todbghelp
to generate backtrace on Windows.dbghelp
is still used, sincelibbacktrace
doesn't appear to work, at least not on the release build.crash.cpp
and useddebug_write_backtrace
to generate the crash log.Describe alternatives you've considered
Do not use libbacktrace and cry when another bug report comes in with only hexadecimal numbers in the backtrace.
Testing
sample debug log
sample debug log on debug build
sample crash log
sample crash log on debug build
sample debug log from the unit test (log)