[compiler-rt] r286501 - [asan/win] Move breakpoint from Abort to internal__exit

Reid Kleckner via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 10 12:44:05 PST 2016


Author: rnk
Date: Thu Nov 10 14:44:05 2016
New Revision: 286501

URL: http://llvm.org/viewvc/llvm-project?rev=286501&view=rev
Log:
[asan/win] Move breakpoint from Abort to internal__exit

Now that we use TerminateProcess, the debugger doesn't stop on program
exit. Add this breakpoint so that the debugger stops after asan reports
an error and is prepared to exit the program.

Modified:
    compiler-rt/trunk/lib/sanitizer_common/sanitizer_win.cc

Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_win.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_win.cc?rev=286501&r1=286500&r2=286501&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_win.cc (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_win.cc Thu Nov 10 14:44:05 2016
@@ -425,8 +425,6 @@ u64 NanoTime() {
 }
 
 void Abort() {
-  if (::IsDebuggerPresent())
-    __debugbreak();
   internal__exit(3);
 }
 
@@ -657,6 +655,10 @@ uptr internal_sched_yield() {
 
 void internal__exit(int exitcode) {
   // ExitProcess runs some finalizers, so use TerminateProcess to avoid that.
+  // The debugger doesn't stop on TerminateProcess like it does on ExitProcess,
+  // so add our own breakpoint here.
+  if (::IsDebuggerPresent())
+    __debugbreak();
   TerminateProcess(GetCurrentProcess(), 3);
 }
 




More information about the llvm-commits mailing list