clang-tools 20.0.0git
|
Allows setting per-thread abort/kill signal callbacks, to print additional information about the crash depending on which thread got signalled. More...
#include <ThreadCrashReporter.h>
Public Types | |
using | SignalCallback = llvm::unique_function< void(void)> |
Public Member Functions | |
ThreadCrashReporter (SignalCallback ThreadLocalCallback) | |
Registers the callback as the first one in thread-local callback chain. | |
~ThreadCrashReporter () | |
Resets the current thread's callback to nullptr. | |
ThreadCrashReporter (ThreadCrashReporter &&RHS)=delete | |
Moves are disabled to ease nesting and escaping considerations. | |
ThreadCrashReporter (const ThreadCrashReporter &)=delete | |
ThreadCrashReporter & | operator= (ThreadCrashReporter &&)=delete |
ThreadCrashReporter & | operator= (const ThreadCrashReporter &)=delete |
Static Public Member Functions | |
static void | runCrashHandlers () |
Calls all currently-active ThreadCrashReporters for the current thread. | |
Allows setting per-thread abort/kill signal callbacks, to print additional information about the crash depending on which thread got signalled.
Definition at line 19 of file ThreadCrashReporter.h.
using clang::clangd::ThreadCrashReporter::SignalCallback = llvm::unique_function<void(void)> |
Definition at line 21 of file ThreadCrashReporter.h.
clang::clangd::ThreadCrashReporter::ThreadCrashReporter | ( | SignalCallback | ThreadLocalCallback | ) |
Registers the callback as the first one in thread-local callback chain.
Asserts if the current thread's callback is already set. The callback is likely to be invoked in a signal handler. Most LLVM signal handling is not strictly async-signal-safe. However reporters should avoid accessing data structures likely to be in a bad state on crash.
Definition at line 35 of file ThreadCrashReporter.cpp.
References clang::clangd::CurrentReporter.
clang::clangd::ThreadCrashReporter::~ThreadCrashReporter | ( | ) |
Resets the current thread's callback to nullptr.
Definition at line 44 of file ThreadCrashReporter.cpp.
References clang::clangd::CurrentReporter.
|
delete |
Moves are disabled to ease nesting and escaping considerations.
|
delete |
|
delete |
|
delete |
|
static |
Calls all currently-active ThreadCrashReporters for the current thread.
To be called from sys::AddSignalHandler() callback. Any signal filtering is the responsibility of the caller. While this function is intended to be called from signal handlers, it is not strictly async-signal-safe - see constructor comment.
When several reporters are nested, the callbacks are called in LIFO order.
Definition at line 17 of file ThreadCrashReporter.cpp.
References clang::clangd::CurrentReporter.
Referenced by clang::clangd::clangdMain().