10#include "llvm/Config/llvm-config.h"
11#include "llvm/Support/FormatVariadic.h"
12#include "llvm/Support/Signals.h"
13#include "llvm/Support/raw_ostream.h"
15#if LLVM_SUPPORT_XCODE_SIGNPOSTS
24 llvm::StringRef backtrace,
25 llvm::StringRef prompt) {
26 llvm::errs() << message <<
'\n';
27 llvm::errs() << backtrace;
28 llvm::errs() << prompt <<
'\n';
34void lldb_assert(
bool expression,
const char *expr_text,
const char *func,
35 const char *file,
unsigned int line) {
36 if (LLVM_LIKELY(expression))
39#if LLVM_SUPPORT_XCODE_SIGNPOSTS
40 if (__builtin_available(macos 10.12, iOS 10, tvOS 10, watchOS 3, *)) {
41 os_log_fault(OS_LOG_DEFAULT,
42 "Assertion failed: (%s), function %s, file %s, line %u\n",
43 expr_text, func, file, line);
50 llvm::raw_string_ostream backtrace(buffer);
51 llvm::sys::PrintStackTrace(backtrace);
54 llvm::formatv(
"Assertion failed: ({0}), function {1}, file {2}, line {3}",
55 expr_text, func, file, line)
58 "Please file a bug report against lldb reporting this failure log, and "
59 "as many details as possible");
A class that represents a running process on the host machine.
void lldb_assert(bool expression, const char *expr_text, const char *func, const char *file, unsigned int line)
static void DefaultAssertCallback(llvm::StringRef message, llvm::StringRef backtrace, llvm::StringRef prompt)
void SetLLDBAssertCallback(LLDBAssertCallback callback)
void(* LLDBAssertCallback)(llvm::StringRef message, llvm::StringRef backtrace, llvm::StringRef prompt)
static std::atomic< LLDBAssertCallback > g_lldb_assert_callback