Commit Graph

7 Commits

Author SHA1 Message Date
WerWolv 0908d040fa fix: Prevent multiple getStackTrace functions from running at the same time 2025-08-18 20:36:54 +02:00
WerWolv f3d9f224b7 fix: Fixes for previous PR merge 2025-08-09 19:53:22 +02:00
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
WerWolv 6fcc3e8cb3 build: Move all demangler uses into the trace library 2025-07-30 20:57:53 +02:00
Nik 2c47e1a135
git: Added Windows ARM64 build (#2336)
Closes #1118
2025-07-15 20:28:54 +02:00
WerWolv a5eef3f34d build: Fix more linker errors 2025-05-26 21:57:27 +02:00
WerWolv ce74915c14 feat: Add full exception tracing support 2025-05-26 20:15:20 +02:00