mirror of
https://github.com/WerWolv/ImHex.git
synced 2026-03-28 15:57:03 -05:00
feat: Added stacktrace printing on crashes (#892)
* feat: Added simple stack trace output * feat: Added backtrace wrapper * build: Added libbacktrace include dirs to build * build: Fixed libbacktrace variables * build: More backtrace variable fixes * build: Try to find backtrace include * build: Get backtrace header from cmake script * feat: Added backtrace support for execinfo * feat: Added support for StackWalk on Windows
This commit is contained in:
@@ -9,8 +9,7 @@
|
||||
#include <hex/helpers/utils.hpp>
|
||||
#include <hex/helpers/fs.hpp>
|
||||
#include <hex/helpers/logger.hpp>
|
||||
|
||||
#include <llvm/Demangle/Demangle.h>
|
||||
#include <hex/helpers/stacktrace.hpp>
|
||||
|
||||
#include <chrono>
|
||||
#include <csignal>
|
||||
@@ -19,6 +18,7 @@
|
||||
#include <cassert>
|
||||
|
||||
#include <romfs/romfs.hpp>
|
||||
#include <llvm/Demangle/Demangle.h>
|
||||
|
||||
#include <imgui.h>
|
||||
#define IMGUI_DEFINE_MATH_OPERATORS
|
||||
@@ -78,8 +78,15 @@ namespace hex {
|
||||
log::fatal("Uncaught exception thrown!");
|
||||
}
|
||||
|
||||
// Let's not loop on this...
|
||||
std::signal(signalNumber, nullptr);
|
||||
std::signal(signalNumber, SIG_DFL);
|
||||
|
||||
for (const auto &stackFrame : stacktrace::getStackTrace()) {
|
||||
if (stackFrame.line == 0)
|
||||
log::fatal(" {}", stackFrame.function);
|
||||
else
|
||||
log::fatal(" ({}:{}) | {}", stackFrame.file, stackFrame.line, stackFrame.function);
|
||||
}
|
||||
|
||||
|
||||
#if defined(DEBUG)
|
||||
assert(!"Debug build, triggering breakpoint");
|
||||
@@ -89,6 +96,8 @@ namespace hex {
|
||||
}
|
||||
|
||||
Window::Window() {
|
||||
stacktrace::initialize();
|
||||
|
||||
{
|
||||
for (const auto &[argument, value] : ImHexApi::System::getInitArguments()) {
|
||||
if (argument == "no-plugins") {
|
||||
|
||||
Reference in New Issue
Block a user