Skip to content

Commit

Permalink
Make TR:Trap() work on release builds
Browse files Browse the repository at this point in the history
assert(0) does nothing on a release build, so abort() instead.

Signed-off-by: Andrew Young <youngar17@gmail.com>
  • Loading branch information
youngar committed Oct 10, 2019
1 parent 396f0e5 commit b9194e9
Showing 1 changed file with 10 additions and 12 deletions.
22 changes: 10 additions & 12 deletions compiler/infra/Assert.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,7 @@
void OMR_NORETURN TR::trap()
{
static char * noDebug = feGetEnv("TR_NoDebuggerBreakPoint");
if (noDebug)
{
exit(1337);
}
else
if (!noDebug)
{
static char *crashLogOnAssume = feGetEnv("TR_crashLogOnAssume");
if (crashLogOnAssume)
Expand All @@ -55,24 +51,26 @@ void OMR_NORETURN TR::trap()
}

#ifdef _MSC_VER
static char *revertToDebugbreakWin = feGetEnv("TR_revertToDebugbreakWin");
#ifdef DEBUG
DebugBreak();
#else
static char *revertToDebugbreakWin = feGetEnv("TR_revertToDebugbreakWin");
if(revertToDebugbreakWin)
{
DebugBreak();
}
else
*(int*)(NULL) = 1;
#endif
{
*(volatile int*)(0) = 1;
}
#endif //ifdef DEBUG
#else // of _MSC_VER

assert(0);

abort();
#endif // ifdef _MSC_VER
}
exit(1337);
}


static void traceAssertionFailure(const char * file, int32_t line, const char *condition, const char *s, va_list ap)
{
TR::Compilation *comp = TR::comp();
Expand Down

0 comments on commit b9194e9

Please sign in to comment.