[Lldb-commits] [lldb] r341387 - Terminate debugger if an assert was hit

David Bolvansky via lldb-commits lldb-commits at lists.llvm.org
Tue Sep 4 10:19:16 PDT 2018


Author: xbolva00
Date: Tue Sep  4 10:19:15 2018
New Revision: 341387

URL: http://llvm.org/viewvc/llvm-project?rev=341387&view=rev
Log:
Terminate debugger if an assert was hit

Reviewers: JDevlieghere, teemperor, #lldb

Reviewed By: JDevlieghere

Subscribers: clayborg, lemo, lldb-commits

Differential Revision: https://reviews.llvm.org/D51604

Modified:
    lldb/trunk/source/Utility/LLDBAssert.cpp

Modified: lldb/trunk/source/Utility/LLDBAssert.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Utility/LLDBAssert.cpp?rev=341387&r1=341386&r2=341387&view=diff
==============================================================================
--- lldb/trunk/source/Utility/LLDBAssert.cpp (original)
+++ lldb/trunk/source/Utility/LLDBAssert.cpp Tue Sep  4 10:19:15 2018
@@ -19,14 +19,14 @@ using namespace lldb_private;
 void lldb_private::lldb_assert(bool expression, const char *expr_text,
                                const char *func, const char *file,
                                unsigned int line) {
-  if (expression)
-    ;
-  else {
-    errs() << format("Assertion failed: (%s), function %s, file %s, line %u\n",
-                     expr_text, func, file, line);
-    errs() << "backtrace leading to the failure:\n";
-    llvm::sys::PrintStackTrace(errs());
-    errs() << "please file a bug report against lldb reporting this failure "
-              "log, and as many details as possible\n";
-  }
+  if (LLVM_LIKELY(expression))
+    return;
+
+  errs() << format("Assertion failed: (%s), function %s, file %s, line %u\n",
+                   expr_text, func, file, line);
+  errs() << "backtrace leading to the failure:\n";
+  llvm::sys::PrintStackTrace(errs());
+  errs() << "please file a bug report against lldb reporting this failure "
+            "log, and as many details as possible\n";
+  abort();
 }




More information about the lldb-commits mailing list