sys: Trigger breakpoint in debug mode when a signal is raised

This commit is contained in:
WerWolv
2022-01-11 20:28:57 +01:00
parent b9034523b5
commit 1b853c6a84
2 changed files with 17 additions and 2 deletions

View File

@@ -319,10 +319,14 @@
ImGui::SetCursorPosX(ImGui::GetWindowWidth() - buttonSize.x * 6);
#if defined(DEBUG)
if (ImGui::TitleBarButton(ICON_VS_DEBUG, buttonSize)) {
if (ImGui::GetIO().KeyCtrl && ImGui::GetIO().KeyShift) {
if (ImGui::GetIO().KeyCtrl) {
// Explicitly trigger a segfault by writing to an invalid memory location
// Used for debugging crashes
*reinterpret_cast<u8*>(0x10) = 0x10;
} else if (ImGui::GetIO().KeyShift) {
// Explicitly trigger an abort by throwing an uncaught exception
// Used for debugging exception errors
throw std::runtime_error("Debug Error");
} else {
hex::openWebpage("https://imhex.werwolv.net/debug");
}