sys: Improved exception debug output
This commit is contained in:
parent
e078d810de
commit
7e17059154
@ -41,7 +41,7 @@ macro(addVersionDefines)
|
|||||||
set(IMHEX_VERSION_STRING ${IMHEX_VERSION_STRING})
|
set(IMHEX_VERSION_STRING ${IMHEX_VERSION_STRING})
|
||||||
elseif (CMAKE_BUILD_TYPE STREQUAL "Debug")
|
elseif (CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||||
set(IMHEX_VERSION_STRING ${IMHEX_VERSION_STRING}-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")
|
elseif (CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo")
|
||||||
set(IMHEX_VERSION_STRING ${IMHEX_VERSION_STRING}-RelWithDebInfo)
|
set(IMHEX_VERSION_STRING ${IMHEX_VERSION_STRING}-RelWithDebInfo)
|
||||||
elseif (CMAKE_BUILD_TYPE STREQUAL "MinSizeRel")
|
elseif (CMAKE_BUILD_TYPE STREQUAL "MinSizeRel")
|
||||||
|
@ -9,11 +9,11 @@
|
|||||||
#include <hex/helpers/utils.hpp>
|
#include <hex/helpers/utils.hpp>
|
||||||
#include <hex/helpers/fs.hpp>
|
#include <hex/helpers/fs.hpp>
|
||||||
#include <hex/helpers/logger.hpp>
|
#include <hex/helpers/logger.hpp>
|
||||||
#include <fmt/printf.h>
|
|
||||||
|
#include <llvm/Demangle/Demangle.h>
|
||||||
|
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
#include <csignal>
|
#include <csignal>
|
||||||
#include <iostream>
|
|
||||||
#include <set>
|
#include <set>
|
||||||
#include <thread>
|
#include <thread>
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
@ -82,7 +82,7 @@ namespace hex {
|
|||||||
std::signal(signalNumber, nullptr);
|
std::signal(signalNumber, nullptr);
|
||||||
|
|
||||||
#if defined(DEBUG)
|
#if defined(DEBUG)
|
||||||
assert(false);
|
assert(!"Debug build, triggering breakpoint");
|
||||||
#else
|
#else
|
||||||
std::raise(signalNumber);
|
std::raise(signalNumber);
|
||||||
#endif
|
#endif
|
||||||
@ -170,7 +170,18 @@ namespace hex {
|
|||||||
HANDLE_SIGNAL(SIGABRT)
|
HANDLE_SIGNAL(SIGABRT)
|
||||||
HANDLE_SIGNAL(SIGFPE)
|
HANDLE_SIGNAL(SIGFPE)
|
||||||
#undef HANDLE_SIGNAL
|
#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<EventAbnormalTermination>(0);
|
||||||
|
});
|
||||||
|
|
||||||
auto logoData = romfs::get("logo.png");
|
auto logoData = romfs::get("logo.png");
|
||||||
this->m_logoTexture = ImGui::Texture(reinterpret_cast<const ImU8 *>(logoData.data()), logoData.size());
|
this->m_logoTexture = ImGui::Texture(reinterpret_cast<const ImU8 *>(logoData.data()), logoData.size());
|
||||||
|
Loading…
Reference in New Issue
Block a user