[PATCH] D33960: ErrorHandling: Replace exit() with abort() for debug builds.

Matthias Braun via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 6 14:22:45 PDT 2017


MatzeB created this revision.
Herald added a subscriber: mcrosier.

Any issues with this?

Call abort() instead of exit() in report_fatal_error() for debug builds,
so debuggers stop at the point of the error and allow inspecting the
backtrace.


Repository:
  rL LLVM

https://reviews.llvm.org/D33960

Files:
  lib/Support/ErrorHandling.cpp


Index: lib/Support/ErrorHandling.cpp
===================================================================
--- lib/Support/ErrorHandling.cpp
+++ lib/Support/ErrorHandling.cpp
@@ -101,7 +101,13 @@
   // files registered with RemoveFileOnSignal.
   sys::RunInterruptHandlers();
 
+#ifdef NDEBUG
   exit(1);
+#else
+  // Call abort() in debug builds so the debugger stops at the point of the
+  // error and allows to inspect the backtrace.
+  abort();
+#endif
 }
 
 void llvm::llvm_unreachable_internal(const char *msg, const char *file,


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D33960.101624.patch
Type: text/x-patch
Size: 534 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170606/093ed1f7/attachment.bin>


More information about the llvm-commits mailing list