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
25 llvm::StringRef backtrace,
26 llvm::StringRef prompt) {
27 llvm::errs() << message <<
'\n';
28 llvm::errs() << backtrace;
29 llvm::errs() << prompt <<
'\n';
35void _lldb_assert(
bool expression,
const char *expr_text,
const char *func,
36 const char *file,
unsigned int line) {
37 if (LLVM_LIKELY(expression))
40#if LLVM_SUPPORT_XCODE_SIGNPOSTS
41 if (__builtin_available(macos 10.12, iOS 10, tvOS 10, watchOS 3, *)) {
42 os_log_fault(OS_LOG_DEFAULT,
43 "Assertion failed: (%s), function %s, file %s, line %u\n",
44 expr_text, func, file, line);
49 llvm::raw_string_ostream backtrace(buffer);
50 llvm::sys::PrintStackTrace(backtrace);
53 llvm::formatv(
"Assertion failed: ({0}), function {1}, file {2}, line {3}",
54 expr_text, func, file, line)
57 "Please file a bug report against lldb reporting this failure log, and "
58 "as many details as possible");
A class that represents a running process on the host machine.
static void DefaultAssertCallback(llvm::StringRef message, llvm::StringRef backtrace, llvm::StringRef prompt)
The default callback prints to stderr.
void _lldb_assert(bool expression, const char *expr_text, const char *func, const char *file, unsigned int line)
Don't use _lldb_assert directly.
void SetLLDBAssertCallback(LLDBAssertCallback callback)
Replace the LLDB assert callback.
void(* LLDBAssertCallback)(llvm::StringRef message, llvm::StringRef backtrace, llvm::StringRef prompt)
The default LLDB assert callback, which prints to stderr.
static std::atomic< LLDBAssertCallback > g_lldb_assert_callback