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"
11
12 #include "llvm/Support/Format.h"
13 #include "llvm/Support/Signals.h"
14 #include "llvm/Support/raw_ostream.h"
15
16 using namespace llvm;
17 using namespace lldb_private;
18
lldb_assert(bool expression,const char * expr_text,const char * func,const char * file,unsigned int line)19 void lldb_private::lldb_assert(bool expression, const char *expr_text,
20 const char *func, const char *file,
21 unsigned int line) {
22 if (LLVM_LIKELY(expression))
23 return;
24
25 errs() << format("Assertion failed: (%s), function %s, file %s, line %u\n",
26 expr_text, func, file, line);
27 errs() << "backtrace leading to the failure:\n";
28 llvm::sys::PrintStackTrace(errs());
29 errs() << "please file a bug report against lldb reporting this failure "
30 "log, and as many details as possible\n";
31 abort();
32 }
33