[Lldb-commits] [PATCH] D64267: lldb_assert: abort when assertions are enabled.

Jonas Devlieghere via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Fri Jul 5 13:52:03 PDT 2019

JDevlieghere created this revision.
JDevlieghere added reviewers: davide, teemperor.
Herald added a subscriber: abidh.
Herald added a project: LLDB.

We had a long discussion in D59911 <https://reviews.llvm.org/D59911> about lldb_assert and what it means. The result was the //assert manifesto// on lldb.llvm.org:

> Soft assertions. LLDB provides lldb_assert() as a soft alternative to cover the middle ground of situations that indicate a recoverable bug in LLDB. In a Debug configuration lldb_assert() behaves like assert(). In a Release configuration it will print a warning and encourage the user to file a bug report, similar to LLVM’s crash handler, and then return execution.

However, currently lldb_assert doesn't behave they way it's being described there: it doesn't abort in a debug/assert build.




Index: lldb/source/Utility/LLDBAssert.cpp
--- lldb/source/Utility/LLDBAssert.cpp
+++ lldb/source/Utility/LLDBAssert.cpp
@@ -27,4 +27,7 @@
   errs() << "please file a bug report against lldb reporting this failure "
             "log, and as many details as possible\n";
+  // In a build with assertions enabled we want this to abort.
+  assert(false && "lldb_assert failed");

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D64267.208233.patch
Type: text/x-patch
Size: 488 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20190705/e5c6cb74/attachment.bin>

More information about the lldb-commits mailing list