2015-03-05 06:59:20 +08:00
|
|
|
//===--------------------- LLDBAssert.cpp --------------------------*- C++ -*-===//
|
|
|
|
//
|
|
|
|
// 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/raw_ostream.h"
|
|
|
|
#include "llvm/Support/Signals.h"
|
|
|
|
|
|
|
|
using namespace llvm;
|
2015-03-05 06:59:20 +08:00
|
|
|
using namespace lldb_private;
|
|
|
|
|
|
|
|
void
|
2015-05-08 17:53:31 +08:00
|
|
|
lldb_private::lldb_assert (bool expression,
|
2015-03-05 06:59:20 +08:00
|
|
|
const char* expr_text,
|
|
|
|
const char* func,
|
|
|
|
const char* file,
|
|
|
|
unsigned int line)
|
|
|
|
{
|
|
|
|
if (expression)
|
|
|
|
;
|
|
|
|
else
|
|
|
|
{
|
2015-03-07 04:45:43 +08:00
|
|
|
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
|
|
|
}
|
|
|
|
}
|