summaryrefslogtreecommitdiff
path: root/src/utilcode
diff options
context:
space:
mode:
authorJan Kotas <jkotas@microsoft.com>2018-08-28 15:04:04 -0700
committerGitHub <noreply@github.com>2018-08-28 15:04:04 -0700
commit5e83757c500f9c26cac8da254e0fe9e3a7580390 (patch)
tree0dcb90e0290dea975a0dd05895a4483f825fd29a /src/utilcode
parent1f5c48d10e97fb94aaf66efbfa1e989752a4ee02 (diff)
downloadcoreclr-5e83757c500f9c26cac8da254e0fe9e3a7580390.tar.gz
coreclr-5e83757c500f9c26cac8da254e0fe9e3a7580390.tar.bz2
coreclr-5e83757c500f9c26cac8da254e0fe9e3a7580390.zip
Break into debugger on assertion failures (#19702)
* Break into debugger on assertion failures Assertion failures terminated the process by default that made them hard to debug. Changed them to break into debugger or trigger fail fast when the debugger is not attached. This should make the day-to-day CoreCLR developer experience better and it is simular to what we had on .NET Framework in the past. * Fix Unix build break Add RaiseFailFastException to Unix PAL
Diffstat (limited to 'src/utilcode')
-rw-r--r--src/utilcode/debug.cpp15
1 files changed, 6 insertions, 9 deletions
diff --git a/src/utilcode/debug.cpp b/src/utilcode/debug.cpp
index 3d8704826b..a19e7a4f63 100644
--- a/src/utilcode/debug.cpp
+++ b/src/utilcode/debug.cpp
@@ -180,7 +180,7 @@ VOID TerminateOnAssert()
STATIC_CONTRACT_DEBUG_ONLY;
ShutdownLogging();
- TerminateProcess(GetCurrentProcess(), 123456789);
+ RaiseFailFastException(NULL, NULL, 0);
}
// Whether this thread is already displaying an assert dialog.
@@ -431,14 +431,14 @@ bool _DbgBreakCheck(
return false; // don't stop debugger. No gui.
}
- if (NoGuiOnAssert())
+ if (IsDebuggerPresent() || DebugBreakOnAssert())
{
- TerminateOnAssert();
+ return true; // like a retry
}
- if (DebugBreakOnAssert())
+ if (NoGuiOnAssert())
{
- return true; // like a retry
+ TerminateOnAssert();
}
if (IsDisplayingAssertDlg())
@@ -870,12 +870,9 @@ void DECLSPEC_NORETURN __FreeBuildAssertFail(const char *szFile, int iLine, cons
_flushall();
- // TerminateOnAssert();
ShutdownLogging();
- // Failing here implies an error in the runtime - hence we use
- // COR_E_EXECUTIONENGINE
- TerminateProcess(GetCurrentProcess(), COR_E_EXECUTIONENGINE);
+ RaiseFailFastException(NULL, NULL, 0);
UNREACHABLE();
}