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