diff --git a/cmake/build_helpers.cmake b/cmake/build_helpers.cmake index 1314d6bfd..0bf2eeeb8 100644 --- a/cmake/build_helpers.cmake +++ b/cmake/build_helpers.cmake @@ -41,7 +41,7 @@ macro(addVersionDefines) set(IMHEX_VERSION_STRING ${IMHEX_VERSION_STRING}) elseif (CMAKE_BUILD_TYPE STREQUAL "Debug") set(IMHEX_VERSION_STRING ${IMHEX_VERSION_STRING}-Debug) - add_compile_definitions(DEBUG _GLIBCXX_DEBUG) + add_compile_definitions(DEBUG _GLIBCXX_DEBUG _GLIBCXX_VERBOSE) elseif (CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo") set(IMHEX_VERSION_STRING ${IMHEX_VERSION_STRING}-RelWithDebInfo) elseif (CMAKE_BUILD_TYPE STREQUAL "MinSizeRel") diff --git a/main/source/window/window.cpp b/main/source/window/window.cpp index 33d628274..d7c101452 100644 --- a/main/source/window/window.cpp +++ b/main/source/window/window.cpp @@ -9,11 +9,11 @@ #include #include #include -#include + +#include #include #include -#include #include #include #include @@ -82,7 +82,7 @@ namespace hex { std::signal(signalNumber, nullptr); #if defined(DEBUG) - assert(false); + assert(!"Debug build, triggering breakpoint"); #else std::raise(signalNumber); #endif @@ -170,7 +170,18 @@ namespace hex { HANDLE_SIGNAL(SIGABRT) HANDLE_SIGNAL(SIGFPE) #undef HANDLE_SIGNAL - std::set_terminate([]{ signalHandler(SIGABRT, "Unhandled C++ exception"); }); + std::set_terminate([]{ + try { + std::rethrow_exception(std::current_exception()); + } catch (std::exception &ex) { + log::fatal( + "Program terminated with uncaught exception: {}()::what() -> {}", + llvm::itaniumDemangle(typeid(ex).name(), nullptr, nullptr, nullptr), + ex.what() + ); + } + EventManager::post(0); + }); auto logoData = romfs::get("logo.png"); this->m_logoTexture = ImGui::Texture(reinterpret_cast(logoData.data()), logoData.size());