diff --git a/source/mijin/debug/assert.hpp b/source/mijin/debug/assert.hpp index 12ff2db..915caae 100644 --- a/source/mijin/debug/assert.hpp +++ b/source/mijin/debug/assert.hpp @@ -14,14 +14,24 @@ extern "C" __declspec(dllimport) void __stdcall DebugBreak(); #define MIJIN_TRAP() DebugBreak() #define MIJIN_FUNC() __FUNCSIG__ #else // _WIN32 -#include -#define MIJIN_TRAP() (void) std::raise(SIGTRAP) +#include +#define MIJIN_TRAP() \ +{ \ + const pid_t tid = gettid(); \ + const pid_t pid = getpid(); \ + __asm__ __volatile__ \ + ( \ + "syscall" \ + : \ + : "D"(pid), "S"(tid), "d"(5), "a"(0xea) \ + : "rcx", "r11", "memory" \ + ); \ +} #define MIJIN_FUNC() "" // TODO: __PRETTY_FUNCTION__ is not working for some reason -.- #endif // !_WIN32 namespace mijin { - // // public defines // @@ -35,7 +45,7 @@ switch (mijin::handleError(msg, source_loc)) \ break; \ case mijin::ErrorHandling::TRAP: \ MIJIN_TRAP(); \ - [[fallthrough]]; \ + break; \ default: /* ABORT */ \ std::abort(); \ } @@ -76,7 +86,7 @@ if (!static_cast(condition)) #define MIJIN_ASSERT_FATAL(condition, msg) \ if (!static_cast(condition)) \ { \ - MIJIN_ERROR("Debug assertion failed: " #condition "\nMessage: " msg); \ + MIJIN_FATAL("Debug assertion failed: " #condition "\nMessage: " msg); \ } #else // MIJIN_DEBUG #define MIJIN_ERROR(...)