Zephyr Lykos
|
ae8a12fa27
|
impr: Show external frames when using std::stacktrace backend (#2302)
<!--
Please provide as much information as possible about what your PR aims
to do.
PRs with no description will most likely be closed until more
information is provided.
If you're planing on changing fundamental behaviour or add big new
features, please open a GitHub Issue first before starting to work on
it.
If it's not something big and you still want to contact us about it,
feel free to do so !
-->
### Problem description
`std::stacktrace` backend in `hex::trace` does not show frames for
external libraries.
### Implementation description
If `dlfcn.h` is available, use `dladdr` to retrieve external symbol
information.
### Screenshots
Before:
```
[02:33:46] [FATAL] [main | Main] Printing stacktrace using implementation 'std::stacktrace'
[02:33:46] [FATAL] [main | Main] (/home/mochaa/ghq/github.com/WerWolv/ImHex/lib/trace/source/stacktrace.cpp:34) | hex::trace::getStackTrace()
[02:33:46] [FATAL] [main | Main] (/home/mochaa/ghq/github.com/WerWolv/ImHex/main/gui/source/crash_handlers.cpp:75) | printStackTrace
[02:33:46] [FATAL] [main | Main] (/home/mochaa/ghq/github.com/WerWolv/ImHex/main/gui/source/crash_handlers.cpp:125) | hex::crash::handleCrash(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)
[02:33:46] [FATAL] [main | Main] (/home/mochaa/ghq/github.com/WerWolv/ImHex/main/gui/source/crash_handlers.cpp:211) | operator()
[02:33:46] [FATAL] [main | Main] () | ??
[02:33:46] [FATAL] [main | Main] () | ??
[02:33:46] [FATAL] [main | Main] () | ??
[02:33:46] [FATAL] [main | Main] () | ??
[02:33:46] [FATAL] [main | Main] () | ??
[02:33:46] [FATAL] [main | Main] () | ??
[02:33:46] [FATAL] [main | Main] (/home/mochaa/ghq/github.com/WerWolv/ImHex/lib/third_party/imgui/backend/source/imgui_impl_glfw.cpp:844) | ImGui_ImplGlfw_UpdateMouseData
[02:33:46] [FATAL] [main | Main] (/home/mochaa/ghq/github.com/WerWolv/ImHex/main/gui/source/window/window.cpp:353) | hex::Window::frameBegin()
[02:33:46] [FATAL] [main | Main] (/home/mochaa/ghq/github.com/WerWolv/ImHex/main/gui/source/window/window.cpp:241) | hex::Window::fullFrame()
[02:33:46] [FATAL] [main | Main] (/home/mochaa/ghq/github.com/WerWolv/ImHex/main/gui/source/window/window.cpp:297) | hex::Window::loop()
[02:33:46] [FATAL] [main | Main] (/home/mochaa/ghq/github.com/WerWolv/ImHex/main/gui/source/init/run/native.cpp:43) | hex::init::runImHex()
[02:33:46] [FATAL] [main | Main] () | ??
[02:33:46] [FATAL] [main | Main] () | ??
[02:33:47] [FATAL] [main | Main] () | ??
[02:33:47] [FATAL] [main | Main] () | ??
```
After:
```
[02:30:19] [FATAL] [main | Main] Printing stacktrace using implementation 'std::stacktrace'
[02:30:19] [FATAL] [main | Main] (/home/mochaa/ghq/github.com/WerWolv/ImHex/lib/trace/source/stacktrace.cpp:41) | hex::trace::getStackTrace()
[02:30:19] [FATAL] [main | Main] (/home/mochaa/ghq/github.com/WerWolv/ImHex/main/gui/source/crash_handlers.cpp:75) | printStackTrace
[02:30:19] [FATAL] [main | Main] (/home/mochaa/ghq/github.com/WerWolv/ImHex/main/gui/source/crash_handlers.cpp:125) | hex::crash::handleCrash(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)
[02:30:19] [FATAL] [main | Main] (/home/mochaa/ghq/github.com/WerWolv/ImHex/main/gui/source/crash_handlers.cpp:211) | operator()
[02:30:19] [FATAL] [main | Main] (/lib64/libc.so.6) | libc.so.6+0x00019bef
[02:30:19] [FATAL] [main | Main] (/lib64/libc.so.6) | libc.so.6+0x00073c2c
[02:30:19] [FATAL] [main | Main] (/lib64/libc.so.6) | gsignal+0x1d
[02:30:19] [FATAL] [main | Main] (/lib64/libc.so.6) | abort+0x25
[02:30:19] [FATAL] [main | Main] (/lib64/libc.so.6) | libc.so.6+0x00001638
[02:30:19] [FATAL] [main | Main] (/lib64/libglfw.so.3) | libglfw.so.3+0x00002275
[02:30:19] [FATAL] [main | Main] (/home/mochaa/ghq/github.com/WerWolv/ImHex/lib/third_party/imgui/backend/source/imgui_impl_glfw.cpp:844) | ImGui_ImplGlfw_UpdateMouseData
[02:30:19] [FATAL] [main | Main] (/home/mochaa/ghq/github.com/WerWolv/ImHex/main/gui/source/window/window.cpp:353) | hex::Window::frameBegin()
[02:30:19] [FATAL] [main | Main] (/home/mochaa/ghq/github.com/WerWolv/ImHex/main/gui/source/window/window.cpp:241) | hex::Window::fullFrame()
[02:30:19] [FATAL] [main | Main] (/home/mochaa/ghq/github.com/WerWolv/ImHex/main/gui/source/window/window.cpp:297) | hex::Window::loop()
[02:30:19] [FATAL] [main | Main] (/home/mochaa/ghq/github.com/WerWolv/ImHex/main/gui/source/init/run/native.cpp:43) | hex::init::runImHex()
[02:30:19] [FATAL] [main | Main] (/lib64/libc.so.6) | libc.so.6+0x000035b4
[02:30:19] [FATAL] [main | Main] (/lib64/libc.so.6) | __libc_start_main+0x87
[02:30:19] [FATAL] [main | Main] (./build/imhex) | imhex+0x0000cd94
[02:30:19] [FATAL] [main | Main] (??) | +0xffffffffffffffff
```
### Additional things
None
|
2025-08-09 19:46:01 +02:00 |