Browse Source

Also trigger the debugger from Unix if possible

Michael Hansen 10 years ago
parent
commit
96bc3a1c7e
  1. 12
      Sources/Plasma/CoreLib/HeadSpin.cpp

12
Sources/Plasma/CoreLib/HeadSpin.cpp

@ -53,6 +53,11 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
# include <fcntl.h> # include <fcntl.h>
# include <unistd.h> # include <unistd.h>
#endif #endif
#if defined(HS_BUILD_FOR_UNIX)
# include <signal.h>
#endif
#pragma hdrstop #pragma hdrstop
#include "hsTemplates.h" #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-------"; char str[] = "-------\nASSERTION FAILED:\nFile: %s Line: %i\nMessage: %s\n-------";
DebugMsg(str, file, line, msg); DebugMsg(str, file, line, msg);
DebugBreakIfDebuggerPresent();
// In case the debug trap is ignored
abort(); abort();
} }
#endif // HS_DEBUGGING #endif // HS_DEBUGGING
@ -175,7 +183,7 @@ bool DebugIsDebuggerPresent()
void DebugBreakIfDebuggerPresent() void DebugBreakIfDebuggerPresent()
{ {
#ifdef _MSC_VER #if defined(_MSC_VER)
__try __try
{ {
__debugbreak(); __debugbreak();
@ -183,6 +191,8 @@ void DebugBreakIfDebuggerPresent()
// Debugger not present or some such shwiz. // Debugger not present or some such shwiz.
// Whatever. Don't crash here. // Whatever. Don't crash here.
} }
#elif defined(HS_BUILD_FOR_UNIX)
raise(SIGTRAP);
#endif // _MSC_VER #endif // _MSC_VER
} }

Loading…
Cancel
Save