12#include "llvm/Config/llvm-config.h"
38#pragma comment(lib, "psapi.lib")
48#pragma GCC diagnostic ignored "-Wformat"
49#pragma GCC diagnostic ignored "-Wformat-extra-args"
52typedef BOOL(__stdcall *PREAD_PROCESS_MEMORY_ROUTINE64)(
53 HANDLE hProcess, DWORD64 qwBaseAddress, PVOID lpBuffer, DWORD nSize,
54 LPDWORD lpNumberOfBytesRead);
56typedef PVOID(__stdcall *PFUNCTION_TABLE_ACCESS_ROUTINE64)(HANDLE ahProcess,
59typedef DWORD64(__stdcall *PGET_MODULE_BASE_ROUTINE64)(HANDLE hProcess,
62typedef DWORD64(__stdcall *PTRANSLATE_ADDRESS_ROUTINE64)(HANDLE hProcess,
66typedef BOOL(WINAPI *fpMiniDumpWriteDump)(HANDLE, DWORD, HANDLE, MINIDUMP_TYPE,
67 PMINIDUMP_EXCEPTION_INFORMATION,
68 PMINIDUMP_USER_STREAM_INFORMATION,
69 PMINIDUMP_CALLBACK_INFORMATION);
70static fpMiniDumpWriteDump fMiniDumpWriteDump;
72typedef BOOL(WINAPI *fpStackWalk64)(DWORD, HANDLE, HANDLE, LPSTACKFRAME64,
73 PVOID, PREAD_PROCESS_MEMORY_ROUTINE64,
74 PFUNCTION_TABLE_ACCESS_ROUTINE64,
75 PGET_MODULE_BASE_ROUTINE64,
76 PTRANSLATE_ADDRESS_ROUTINE64);
77static fpStackWalk64 fStackWalk64;
79typedef DWORD64(WINAPI *fpSymGetModuleBase64)(HANDLE, DWORD64);
80static fpSymGetModuleBase64 fSymGetModuleBase64;
82typedef BOOL(WINAPI *fpSymGetSymFromAddr64)(HANDLE, DWORD64, PDWORD64,
84static fpSymGetSymFromAddr64 fSymGetSymFromAddr64;
86typedef BOOL(WINAPI *fpSymGetLineFromAddr64)(HANDLE, DWORD64, PDWORD,
88static fpSymGetLineFromAddr64 fSymGetLineFromAddr64;
90typedef BOOL(WINAPI *fpSymGetModuleInfo64)(HANDLE hProcess, DWORD64 dwAddr,
91 PIMAGEHLP_MODULE64 ModuleInfo);
92static fpSymGetModuleInfo64 fSymGetModuleInfo64;
94typedef PVOID(WINAPI *fpSymFunctionTableAccess64)(HANDLE, DWORD64);
95static fpSymFunctionTableAccess64 fSymFunctionTableAccess64;
97typedef DWORD(WINAPI *fpSymSetOptions)(DWORD);
98static fpSymSetOptions fSymSetOptions;
100typedef BOOL(WINAPI *fpSymInitialize)(HANDLE, PCSTR, BOOL);
101static fpSymInitialize fSymInitialize;
103typedef BOOL(WINAPI *fpEnumerateLoadedModules)(HANDLE,
104 PENUMLOADED_MODULES_CALLBACK64,
106static fpEnumerateLoadedModules fEnumerateLoadedModules;
108static bool isDebugHelpInitialized() {
109 return fStackWalk64 && fSymInitialize && fSymSetOptions && fMiniDumpWriteDump;
112static bool load64BitDebugHelp(
void) {
114 ::LoadLibraryExA(
"Dbghelp.dll", NULL, LOAD_LIBRARY_SEARCH_SYSTEM32);
116 fMiniDumpWriteDump = (fpMiniDumpWriteDump)(
void *)::GetProcAddress(
117 hLib,
"MiniDumpWriteDump");
118 fStackWalk64 = (fpStackWalk64)(
void *)::GetProcAddress(hLib,
"StackWalk64");
119 fSymGetModuleBase64 = (fpSymGetModuleBase64)(
void *)::GetProcAddress(
120 hLib,
"SymGetModuleBase64");
121 fSymGetSymFromAddr64 = (fpSymGetSymFromAddr64)(
void *)::GetProcAddress(
122 hLib,
"SymGetSymFromAddr64");
123 fSymGetLineFromAddr64 = (fpSymGetLineFromAddr64)(
void *)::GetProcAddress(
124 hLib,
"SymGetLineFromAddr64");
125 fSymGetModuleInfo64 = (fpSymGetModuleInfo64)(
void *)::GetProcAddress(
126 hLib,
"SymGetModuleInfo64");
127 fSymFunctionTableAccess64 =
128 (fpSymFunctionTableAccess64)(
void *)::GetProcAddress(
129 hLib,
"SymFunctionTableAccess64");
131 (fpSymSetOptions)(
void *)::GetProcAddress(hLib,
"SymSetOptions");
133 (fpSymInitialize)(
void *)::GetProcAddress(hLib,
"SymInitialize");
134 fEnumerateLoadedModules =
135 (fpEnumerateLoadedModules)(
void *)::GetProcAddress(
136 hLib,
"EnumerateLoadedModules64");
138 return isDebugHelpInitialized();
144static LONG WINAPI LLVMUnhandledExceptionFilter(LPEXCEPTION_POINTERS ep);
145static BOOL WINAPI LLVMConsoleCtrlHandler(DWORD dwCtrlType);
148static void (*InterruptFunction)() = 0;
150static std::vector<std::string> *FilesToRemove = NULL;
151static bool RegisteredUnhandledExceptionFilter =
false;
152static bool CleanupExecuted =
false;
153static PTOP_LEVEL_EXCEPTION_FILTER OldFilter = NULL;
156static std::atomic<void (*)()> OneShotPipeSignalFunction(
nullptr);
161static CRITICAL_SECTION CriticalSection;
162static bool CriticalSectionInitialized =
false;
169#elif defined(_M_ARM64)
171#elif defined(_M_IX86)
181 HANDLE hProcess, HANDLE hThread,
182 STACKFRAME64 &StackFrameOrig,
183 CONTEXT *ContextOrig) {
185 STACKFRAME64 StackFrame = StackFrameOrig;
191 CONTEXT Context = *ContextOrig;
192 Context.ContextFlags = CONTEXT_CONTROL | CONTEXT_INTEGER;
194 static void *StackTrace[256];
196 while (fStackWalk64(NativeMachineType, hProcess, hThread, &StackFrame,
197 &Context, 0, fSymFunctionTableAccess64,
198 fSymGetModuleBase64, 0)) {
199 if (StackFrame.AddrFrame.Offset == 0)
201 StackTrace[
Depth++] = (
void *)(uintptr_t)StackFrame.AddrPC.Offset;
202 if (
Depth >= std::size(StackTrace))
210struct FindModuleData {
213 const char **Modules;
215 StringSaver *StrPool;
219static BOOL CALLBACK findModuleCallback(PCSTR
ModuleName, DWORD64 ModuleBase,
220 ULONG ModuleSize,
void *VoidData) {
221 FindModuleData *
Data = (FindModuleData *)VoidData;
222 intptr_t Beg = ModuleBase;
223 intptr_t End = Beg + ModuleSize;
224 for (
int I = 0;
I <
Data->Depth;
I++) {
225 if (
Data->Modules[
I])
227 intptr_t Addr = (intptr_t)
Data->StackTrace[
I];
228 if (Beg <= Addr && Addr < End) {
230 Data->Offsets[
I] = Addr - Beg;
237 const char **Modules, intptr_t *Offsets,
238 const char *MainExecutableName,
240 if (!fEnumerateLoadedModules)
243 Data.StackTrace = StackTrace;
245 Data.Modules = Modules;
247 Data.StrPool = &StrPool;
248 fEnumerateLoadedModules(GetCurrentProcess(), findModuleCallback, &
Data);
253 const char *MainExecutableName) {
258 HANDLE hThread, STACKFRAME64 &StackFrame,
263 if (!isDebugHelpInitialized())
267 fSymSetOptions(SYMOPT_DEFERRED_LOADS | SYMOPT_LOAD_LINES);
268 fSymInitialize(hProcess, NULL, TRUE);
273 if (printStackTraceWithLLVMSymbolizer(OS, hProcess, hThread, StackFrame,
279 if (!fStackWalk64(NativeMachineType, hProcess, hThread, &StackFrame,
280 Context, 0, fSymFunctionTableAccess64,
281 fSymGetModuleBase64, 0)) {
285 if (StackFrame.AddrFrame.Offset == 0)
288 using namespace llvm;
290 DWORD64 PC = StackFrame.AddrPC.Offset;
291#if defined(_M_X64) || defined(_M_ARM64)
292 OS <<
format(
"0x%016llX", PC);
293#elif defined(_M_IX86) || defined(_M_ARM)
294 OS <<
format(
"0x%08lX",
static_cast<DWORD
>(PC));
298 if (!fSymGetModuleBase64(hProcess, PC)) {
299 OS <<
" <unknown module>\n";
304 memset(&M, 0,
sizeof(IMAGEHLP_MODULE64));
305 M.SizeOfStruct =
sizeof(IMAGEHLP_MODULE64);
306 if (fSymGetModuleInfo64(hProcess, fSymGetModuleBase64(hProcess, PC), &M)) {
307 DWORD64
const disp = PC - M.BaseOfImage;
308 OS <<
format(
", %s(0x%016llX) + 0x%llX byte(s)",
309 static_cast<char *
>(M.ImageName), M.BaseOfImage,
310 static_cast<long long>(disp));
312 OS <<
", <unknown module>";
317 IMAGEHLP_SYMBOL64 *symbol =
reinterpret_cast<IMAGEHLP_SYMBOL64 *
>(buffer);
318 memset(symbol, 0,
sizeof(IMAGEHLP_SYMBOL64));
319 symbol->SizeOfStruct =
sizeof(IMAGEHLP_SYMBOL64);
320 symbol->MaxNameLength = 512 -
sizeof(IMAGEHLP_SYMBOL64);
323 if (!fSymGetSymFromAddr64(hProcess, PC, &dwDisp, symbol)) {
329 OS <<
format(
", %s() + 0x%llX byte(s)",
static_cast<char *
>(symbol->Name),
330 static_cast<long long>(dwDisp));
333 IMAGEHLP_LINE64 line = {};
335 line.SizeOfStruct =
sizeof(line);
336 if (fSymGetLineFromAddr64(hProcess, PC, &dwLineDisp, &line)) {
337 OS <<
format(
", %s, line %lu + 0x%lX byte(s)", line.FileName,
338 line.LineNumber, dwLineDisp);
356[[maybe_unused]]
static int AvoidMessageBoxHook(
int ReportType,
char *Message,
369extern "C" void HandleAbort(
int Sig) {
370 if (Sig == SIGABRT) {
375static void InitializeThreading() {
376 if (CriticalSectionInitialized)
381 InitializeCriticalSection(&CriticalSection);
382 CriticalSectionInitialized =
true;
385static void RegisterHandler() {
389 if (!load64BitDebugHelp()) {
390 assert(
false &&
"These APIs should always be available");
394 if (RegisteredUnhandledExceptionFilter) {
395 EnterCriticalSection(&CriticalSection);
399 InitializeThreading();
403 EnterCriticalSection(&CriticalSection);
405 RegisteredUnhandledExceptionFilter =
true;
406 OldFilter = SetUnhandledExceptionFilter(LLVMUnhandledExceptionFilter);
407 SetConsoleCtrlHandler(LLVMConsoleCtrlHandler, TRUE);
417 if (CleanupExecuted) {
419 *ErrMsg =
"Process terminating -- cannot register for removal";
423 if (FilesToRemove == NULL) {
424 FilesToRemove =
new std::vector<std::string>;
426 delete FilesToRemove;
427 FilesToRemove = NULL;
431 FilesToRemove->push_back(std::string(
Filename));
433 LeaveCriticalSection(&CriticalSection);
439 if (FilesToRemove == NULL)
444 std::vector<std::string>::reverse_iterator
I =
446 if (
I != FilesToRemove->rend())
447 FilesToRemove->erase(
I.base() - 1);
449 LeaveCriticalSection(&CriticalSection);
454 signal(SIGABRT, HandleAbort);
459 _set_abort_behavior(0, _WRITE_ABORT_MSG);
461 _set_abort_behavior(0, _CALL_REPORTFAULT);
462 _CrtSetReportHook(AvoidMessageBoxHook);
466 SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOGPFAULTERRORBOX |
467 SEM_NOOPENFILEERRORBOX);
468 _set_error_mode(_OUT_TO_STDERR);
474 bool DisableCrashReporting) {
477 if (DisableCrashReporting || getenv(
"LLVM_DISABLE_CRASH_REPORT"))
482 LeaveCriticalSection(&CriticalSection);
486#if LLVM_ENABLE_DEBUGLOC_TRACKING_ORIGIN
487#error DebugLoc origin-tracking currently unimplemented for Windows.
490static void LocalPrintStackTrace(
raw_ostream &OS, PCONTEXT
C) {
491 STACKFRAME64 StackFrame{};
494 ::RtlCaptureContext(&Context);
498 StackFrame.AddrPC.Offset = Context.Rip;
499 StackFrame.AddrStack.Offset = Context.Rsp;
500 StackFrame.AddrFrame.Offset = Context.Rbp;
501#elif defined(_M_IX86)
502 StackFrame.AddrPC.Offset = Context.Eip;
503 StackFrame.AddrStack.Offset = Context.Esp;
504 StackFrame.AddrFrame.Offset = Context.Ebp;
505#elif defined(_M_ARM64)
506 StackFrame.AddrPC.Offset = Context.Pc;
507 StackFrame.AddrStack.Offset = Context.Sp;
508 StackFrame.AddrFrame.Offset = Context.Fp;
510 StackFrame.AddrPC.Offset = Context.Pc;
511 StackFrame.AddrStack.Offset = Context.Sp;
512 StackFrame.AddrFrame.Offset = Context.R11;
514 StackFrame.AddrPC.Mode = AddrModeFlat;
515 StackFrame.AddrStack.Mode = AddrModeFlat;
516 StackFrame.AddrFrame.Mode = AddrModeFlat;
517 PrintStackTraceForThread(OS, GetCurrentProcess(), GetCurrentThread(),
523 LocalPrintStackTrace(OS,
nullptr);
528 InterruptFunction = IF;
529 LeaveCriticalSection(&CriticalSection);
537 OneShotPipeSignalFunction.exchange(Handler);
544void llvm::sys::CallOneShotPipeSignalHandler() {
545 if (
auto OldOneShotPipeFunction = OneShotPipeSignalFunction.exchange(
nullptr))
546 OldOneShotPipeFunction();
556 LeaveCriticalSection(&CriticalSection);
559static void Cleanup(
bool ExecuteSignalHandlers) {
563 EnterCriticalSection(&CriticalSection);
567 CleanupExecuted =
true;
570 if (FilesToRemove != NULL)
571 while (!FilesToRemove->empty()) {
573 FilesToRemove->pop_back();
576 if (ExecuteSignalHandlers)
579 LeaveCriticalSection(&CriticalSection);
590 InitializeThreading();
597static HKEY FindWERKey(
const llvm::Twine &RegistryLocation) {
599 if (ERROR_SUCCESS != ::RegOpenKeyExA(HKEY_LOCAL_MACHINE,
600 RegistryLocation.
str().c_str(), 0,
601 KEY_QUERY_VALUE | KEY_READ, &
Key))
611static bool GetDumpFolder(HKEY
Key,
613 using llvm::sys::windows::UTF16ToUTF8;
618 DWORD BufferLengthBytes = 0;
620 if (ERROR_SUCCESS != ::RegGetValueW(
Key, 0, L
"DumpFolder", REG_EXPAND_SZ,
621 NULL, NULL, &BufferLengthBytes))
626 if (ERROR_SUCCESS != ::RegGetValueW(
Key, 0, L
"DumpFolder", REG_EXPAND_SZ,
627 NULL, Buffer.data(), &BufferLengthBytes))
630 DWORD ExpandBufferSize = ::ExpandEnvironmentStringsW(Buffer.data(), NULL, 0);
632 if (!ExpandBufferSize)
637 if (ExpandBufferSize != ::ExpandEnvironmentStringsW(Buffer.data(),
642 if (UTF16ToUTF8(ExpandBuffer.data(), ExpandBufferSize - 1, ResultDirectory))
661static bool GetDumpType(HKEY
Key, MINIDUMP_TYPE &ResultType) {
667 if (ERROR_SUCCESS != ::RegGetValueW(
Key, NULL, L
"DumpType", RRF_RT_REG_DWORD,
674 if (ERROR_SUCCESS != ::RegGetValueW(
Key, NULL, L
"CustomDumpFlags",
675 RRF_RT_REG_DWORD, NULL, &Flags,
679 ResultType =
static_cast<MINIDUMP_TYPE
>(Flags);
683 ResultType = MiniDumpNormal;
686 ResultType = MiniDumpWithFullMemory;
699static std::error_code WINAPI
700WriteWindowsDumpFile(PMINIDUMP_EXCEPTION_INFORMATION ExceptionInfo) {
701 struct ScopedCriticalSection {
702 ScopedCriticalSection() { EnterCriticalSection(&CriticalSection); }
703 ~ScopedCriticalSection() { LeaveCriticalSection(&CriticalSection); }
706 using namespace llvm;
712 if (MainExecutableName.empty()) {
726 "SOFTWARE\\Microsoft\\Windows\\Windows Error Reporting\\LocalDumps";
730 ScopedRegHandle DefaultLocalDumpsKey(FindWERKey(LocalDumpsRegistryLocation));
736 FindWERKey(
Twine(LocalDumpsRegistryLocation) +
"\\" + ProgramName));
742 MINIDUMP_TYPE DumpType;
743 if (!GetDumpType(AppSpecificKey, DumpType))
744 if (!GetDumpType(DefaultLocalDumpsKey, DumpType))
745 DumpType = MiniDumpNormal;
753 bool ExplicitDumpDirectorySet =
true;
755 if (DumpDirectory.empty())
756 if (!GetDumpFolder(AppSpecificKey, DumpDirectory))
757 if (!GetDumpFolder(DefaultLocalDumpsKey, DumpDirectory))
758 ExplicitDumpDirectorySet =
false;
763 if (ExplicitDumpDirectorySet) {
767 Twine(DumpDirectory) +
"\\" + ProgramName +
".%%%%%%.dmp", FD,
770 }
else if (std::error_code EC =
777 if (!fMiniDumpWriteDump(::GetCurrentProcess(), ::GetCurrentProcessId(),
778 FileHandle, DumpType, ExceptionInfo, NULL, NULL))
781 llvm::errs() <<
"Wrote crash dump file \"" << DumpPath <<
"\"\n";
782 return std::error_code();
789 LPEXCEPTION_POINTERS EP = (LPEXCEPTION_POINTERS)Context;
794 unsigned RetCode = EP->ExceptionRecord->ExceptionCode;
795 if (RetCode == (0xE0000000 | EX_IOERR))
797 LLVMUnhandledExceptionFilter(EP);
800static LONG WINAPI LLVMUnhandledExceptionFilter(LPEXCEPTION_POINTERS ep) {
804 if (ep && ep->ExceptionRecord)
806 ep->ExceptionRecord->ExceptionCode)
814 MINIDUMP_EXCEPTION_INFORMATION ExceptionInfo;
815 ExceptionInfo.ThreadId = ::GetCurrentThreadId();
816 ExceptionInfo.ExceptionPointers = ep;
817 ExceptionInfo.ClientPointers = FALSE;
819 if (std::error_code EC = WriteWindowsDumpFile(&ExceptionInfo))
820 llvm::errs() <<
"Could not write crash dump file: " <<
EC.message()
828 memcpy(&ContextCopy, ep->ContextRecord,
sizeof(ContextCopy));
830 LocalPrintStackTrace(
llvm::errs(), ep ? &ContextCopy :
nullptr);
832 return EXCEPTION_EXECUTE_HANDLER;
835static BOOL WINAPI LLVMConsoleCtrlHandler(DWORD dwCtrlType) {
837 EnterCriticalSection(&CriticalSection);
845 void (*IF)() = InterruptFunction;
846 InterruptFunction = 0;
852 LeaveCriticalSection(&CriticalSection);
857 LeaveCriticalSection(&CriticalSection);
866#pragma GCC diagnostic warning "-Wformat"
867#pragma GCC diagnostic warning "-Wformat-extra-args"
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
static GCRegistry::Add< ShadowStackGC > C("shadow-stack", "Very portable GC for uncooperative code generators")
#define LLVM_BUILTIN_TRAP
LLVM_BUILTIN_UNREACHABLE - On compilers which support it, expands to an expression which states that ...
This file contains definitions of exit codes for exit() function.
static const HTTPClientCleanup Cleanup
static constexpr StringLiteral Filename
Provides a library for accessing information about this process and other processes on the operating ...
static LLVM_ATTRIBUTE_USED bool printSymbolizedStackTrace(StringRef Argv0, void **StackTrace, int Depth, llvm::raw_ostream &OS)
Helper that launches llvm-symbolizer and symbolizes a backtrace.
static bool findModulesAndOffsets(void **StackTrace, int Depth, const char **Modules, intptr_t *Offsets, const char *MainExecutableName, StringSaver &StrPool)
static ManagedStatic< std::string > CrashDiagnosticsDirectory
static bool printMarkupContext(raw_ostream &OS, const char *MainExecutableName)
static void insertSignalHandler(sys::SignalHandlerCallback FnPtr, void *Cookie)
SmallString - A SmallString is just a SmallVector with methods and accessors that make it work better...
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
StringRef - Represent a constant reference to a string, i.e.
Saves strings in the provided stable storage and returns a StringRef with a stable character pointer.
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
LLVM_ABI std::string str() const
Return the twine contents as a std::string.
This class implements an extremely fast bulk output stream that can only output to a stream.
static LLVM_ABI void Exit(int RetCode, bool NoCleanup=false)
Equivalent to exit(), except when running inside a CrashRecoveryContext.
static LLVM_ABI bool AreCoreFilesPrevented()
true if PreventCoreFiles has been called, false otherwise.
static LLVM_ABI void PreventCoreFiles()
This function makes the necessary calls to the operating system to prevent core files or any other ki...
@ IMAGE_FILE_MACHINE_ARM64
@ IMAGE_FILE_MACHINE_UNKNOWN
@ IMAGE_FILE_MACHINE_AMD64
@ IMAGE_FILE_MACHINE_I386
@ IMAGE_FILE_MACHINE_ARMNT
LLVM_ABI std::error_code createUniqueFile(const Twine &Model, int &ResultFD, SmallVectorImpl< char > &ResultPath, OpenFlags Flags=OF_None, unsigned Mode=all_read|all_write)
Create a uniquely named file.
LLVM_ABI std::error_code remove(const Twine &path, bool IgnoreNonExisting=true)
Remove path.
LLVM_ABI std::string getMainExecutable(const char *argv0, void *MainExecAddr)
Return the path to the main executable, given the value of argv[0] from program startup and the addre...
LLVM_ABI std::error_code create_directories(const Twine &path, bool IgnoreExisting=true, perms Perms=owner_all|group_all)
Create all the non-existent directories in path.
LLVM_ABI std::error_code createTemporaryFile(const Twine &Prefix, StringRef Suffix, int &ResultFD, SmallVectorImpl< char > &ResultPath, OpenFlags Flags=OF_None)
Create a file in the system temporary directory.
LLVM_ABI StringRef filename(StringRef path LLVM_LIFETIME_BOUND, Style style=Style::native)
Get filename.
ScopedSetting scopedDisable()
LLVM_ABI void DefaultOneShotPipeSignalHandler()
On Unix systems and Windows, this function exits with an "IO error" exit code.
LLVM_ABI void PrintStackTrace(raw_ostream &OS, int Depth=0)
Print the stack trace using the given raw_ostream object.
LLVM_ABI void DisableSystemDialogsOnCrash()
Disable all system dialog boxes that appear when the process crashes.
LLVM_ABI void unregisterHandlers()
LLVM_ABI void DontRemoveFileOnSignal(StringRef Filename)
This function removes a file from the list of files to be removed on signal delivery.
LLVM_ABI bool RemoveFileOnSignal(StringRef Filename, std::string *ErrMsg=nullptr)
This function registers signal handlers to ensure that if a signal gets delivered that the named file...
LLVM_ABI void SetInfoSignalFunction(void(*Handler)())
Registers a function to be called when an "info" signal is delivered to the process.
LLVM_ABI void SetOneShotPipeSignalFunction(void(*Handler)())
Registers a function to be called in a "one-shot" manner when a pipe signal is delivered to the proce...
LLVM_ABI void SetInterruptFunction(void(*IF)())
This function registers a function to be called when the user "interrupts" the program (typically by ...
LLVM_ABI void RunSignalHandlers()
LLVM_ABI void AddSignalHandler(SignalHandlerCallback FnPtr, void *Cookie)
Add a function to be called when an abort/kill signal is delivered to the process.
LLVM_ABI void CleanupOnSignal(uintptr_t Context)
This function does the following:
LLVM_ABI void RunInterruptHandlers()
This function runs all the registered interrupt handlers, including the removal of files registered b...
LLVM_ABI void PrintStackTraceOnErrorSignal(StringRef Argv0, bool DisableCrashReporting=false)
When an error signal (such as SIGABRT or SIGSEGV) is delivered to the process, print a stack trace an...
void(*)(void *) SignalHandlerCallback
This is an optimization pass for GlobalISel generic memory operations.
auto find(R &&Range, const T &Val)
Provide wrappers to std::find which take ranges instead of having to pass begin/end explicitly.
ScopedHandle< CommonHandleTraits > ScopedCommonHandle
auto reverse(ContainerTy &&C)
format_object< Ts... > format(const char *Fmt, const Ts &... Vals)
These are helper functions used to produce formatted output.
LLVM_ATTRIBUTE_VISIBILITY_DEFAULT AnalysisKey InnerAnalysisManagerProxy< AnalysisManagerT, IRUnitT, ExtraArgTs... >::Key
LLVM_ABI raw_fd_ostream & errs()
This returns a reference to a raw_ostream for standard error.
FunctionAddr VTableAddr uintptr_t uintptr_t Data
ScopedHandle< RegTraits > ScopedRegHandle
LLVM_ABI std::error_code mapWindowsError(unsigned EV)