From 96bc3a1c7ec1dd39c4c96097444e57effbb8c706 Mon Sep 17 00:00:00 2001 From: Michael Hansen Date: Sun, 5 Jul 2015 13:18:25 -0700 Subject: [PATCH] Also trigger the debugger from Unix if possible --- Sources/Plasma/CoreLib/HeadSpin.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/Sources/Plasma/CoreLib/HeadSpin.cpp b/Sources/Plasma/CoreLib/HeadSpin.cpp index 2be9e794..530d7eb7 100644 --- a/Sources/Plasma/CoreLib/HeadSpin.cpp +++ b/Sources/Plasma/CoreLib/HeadSpin.cpp @@ -53,6 +53,11 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com # include # include #endif + +#if defined(HS_BUILD_FOR_UNIX) +# include +#endif + #pragma hdrstop #include "hsTemplates.h" @@ -136,6 +141,9 @@ void ErrorAssert(int line, const char* file, const char* fmt, ...) { char str[] = "-------\nASSERTION FAILED:\nFile: %s Line: %i\nMessage: %s\n-------"; DebugMsg(str, file, line, msg); + DebugBreakIfDebuggerPresent(); + + // In case the debug trap is ignored abort(); } #endif // HS_DEBUGGING @@ -175,7 +183,7 @@ bool DebugIsDebuggerPresent() void DebugBreakIfDebuggerPresent() { -#ifdef _MSC_VER +#if defined(_MSC_VER) __try { __debugbreak(); @@ -183,6 +191,8 @@ void DebugBreakIfDebuggerPresent() // Debugger not present or some such shwiz. // Whatever. Don't crash here. } +#elif defined(HS_BUILD_FOR_UNIX) + raise(SIGTRAP); #endif // _MSC_VER }