-
Notifications
You must be signed in to change notification settings - Fork 646
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
Linux: Print demangled symbols on backtrace #312
Conversation
|
||
std::string symbolName = traceLine.substr(parenthesesOpen+1,offsetPlus-parenthesesOpen-1); | ||
int status = -1; | ||
char* demangled = abi::__cxa_demangle(symbolName.c_str(), nullptr, nullptr, &status); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is GNU libstdc++ specific, shouldn't it be ifdef
d? I believe macOS users use LLVM libc++
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Clang implements the same function so it should be okay. GitHub CI does builds for MacOS and they seem to have passed so I don't expect any issues.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this still work when compiling with -stdlib=libc++
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried to compile with that option but a vcpkg library is compiled without it causing linker errors. I don't know how to change the compiler options for vcpkg dependencies.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I found out how to change the compiler option for vcpkg libraries but I can't use clang to compile them and my GCC installation is not compiled with -stdlib support. So I can't test this. However a bigger problem for this code on Mac OS is problably the format of the output of backtrace_symbols. Best case scenario if it's different the sanity checks will fail and it will just print the raw output.
-rdynamic breaks vulkan loading. |
ae17a36
to
c14bcdf
Compare
As discussed on Discord, we'd prefer a solution that would read the debug info from the ELF symbol table rather than force the export of every function. But since this would require using a more sophisticated back-trace library I think this PR is an acceptable intermediate solution. The only request I have is that |
This PR does the following:


Crash backtraces go from looking like this:
To looking like this:
The PR also increases the amount of lines cemu tries to retrieve because I've encountered a situation where the backtrace was incomplete.
Caveats:
-rdynamic
needs to be enabled. This increases Release executable size by 4.4 MiB.