2017-04-07 02:12:24 +08:00
|
|
|
//===--------------------- LLDBAssert.cpp ------------------------*- C++-*-===//
|
2015-03-05 06:59:20 +08:00
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#include "lldb/Utility/LLDBAssert.h"
|
|
|
|
|
2015-03-07 04:45:43 +08:00
|
|
|
#include "llvm/Support/Format.h"
|
|
|
|
#include "llvm/Support/Signals.h"
|
2016-09-07 04:57:50 +08:00
|
|
|
#include "llvm/Support/raw_ostream.h"
|
2015-03-07 04:45:43 +08:00
|
|
|
|
|
|
|
using namespace llvm;
|
2015-03-05 06:59:20 +08:00
|
|
|
using namespace lldb_private;
|
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
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";
|
|
|
|
}
|
2015-03-05 06:59:20 +08:00
|
|
|
}
|