Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 1 | //===--------------------- LLDBAssert.cpp --------------------------*- C++ |
| 2 | //-*-===// |
Enrico Granata | 53ed89c | 2015-03-04 22:59:20 +0000 | [diff] [blame] | 3 | // |
| 4 | // The LLVM Compiler Infrastructure |
| 5 | // |
| 6 | // This file is distributed under the University of Illinois Open Source |
| 7 | // License. See LICENSE.TXT for details. |
| 8 | // |
| 9 | //===----------------------------------------------------------------------===// |
| 10 | |
| 11 | #include "lldb/Utility/LLDBAssert.h" |
Enrico Granata | 53ed89c | 2015-03-04 22:59:20 +0000 | [diff] [blame] | 12 | |
Zachary Turner | a893d30 | 2015-03-06 20:45:43 +0000 | [diff] [blame] | 13 | #include "llvm/Support/Format.h" |
Zachary Turner | a893d30 | 2015-03-06 20:45:43 +0000 | [diff] [blame] | 14 | #include "llvm/Support/Signals.h" |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 15 | #include "llvm/Support/raw_ostream.h" |
Zachary Turner | a893d30 | 2015-03-06 20:45:43 +0000 | [diff] [blame] | 16 | |
| 17 | using namespace llvm; |
Enrico Granata | 53ed89c | 2015-03-04 22:59:20 +0000 | [diff] [blame] | 18 | using namespace lldb_private; |
| 19 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 20 | void lldb_private::lldb_assert(bool expression, const char *expr_text, |
| 21 | const char *func, const char *file, |
| 22 | unsigned int line) { |
| 23 | if (expression) |
| 24 | ; |
| 25 | else { |
| 26 | errs() << format("Assertion failed: (%s), function %s, file %s, line %u\n", |
| 27 | expr_text, func, file, line); |
| 28 | errs() << "backtrace leading to the failure:\n"; |
| 29 | llvm::sys::PrintStackTrace(errs()); |
| 30 | errs() << "please file a bug report against lldb reporting this failure " |
| 31 | "log, and as many details as possible\n"; |
| 32 | } |
Enrico Granata | 53ed89c | 2015-03-04 22:59:20 +0000 | [diff] [blame] | 33 | } |