38#pragma comment(lib, "psapi.lib")
48#pragma GCC diagnostic ignored "-Wformat"
49#pragma GCC diagnostic ignored "-Wformat-extra-args"
51#if !defined(__MINGW64_VERSION_MAJOR)
56typedef struct _IMAGEHLP_LINE64 {
62} IMAGEHLP_LINE64, *PIMAGEHLP_LINE64;
64typedef struct _IMAGEHLP_SYMBOL64 {
71} IMAGEHLP_SYMBOL64, *PIMAGEHLP_SYMBOL64;
73typedef struct _tagADDRESS64 {
77} ADDRESS64, *LPADDRESS64;
79typedef struct _KDHELP64 {
81 DWORD ThCallbackStack;
82 DWORD ThCallbackBStore;
85 DWORD64 KiCallUserMode;
86 DWORD64 KeUserCallbackDispatcher;
87 DWORD64 SystemRangeStart;
88 DWORD64 KiUserExceptionDispatcher;
92} KDHELP64, *PKDHELP64;
94typedef struct _tagSTACKFRAME64 {
100 PVOID FuncTableEntry;
106} STACKFRAME64, *LPSTACKFRAME64;
110typedef BOOL(__stdcall *PREAD_PROCESS_MEMORY_ROUTINE64)(
111 HANDLE hProcess, DWORD64 qwBaseAddress, PVOID lpBuffer,
DWORD nSize,
112 LPDWORD lpNumberOfBytesRead);
114typedef PVOID(__stdcall *PFUNCTION_TABLE_ACCESS_ROUTINE64)(HANDLE ahProcess,
117typedef DWORD64(__stdcall *PGET_MODULE_BASE_ROUTINE64)(HANDLE hProcess,
120typedef DWORD64(__stdcall *PTRANSLATE_ADDRESS_ROUTINE64)(HANDLE hProcess,
124typedef BOOL(WINAPI *fpMiniDumpWriteDump)(HANDLE,
DWORD, HANDLE, MINIDUMP_TYPE,
125 PMINIDUMP_EXCEPTION_INFORMATION,
126 PMINIDUMP_USER_STREAM_INFORMATION,
127 PMINIDUMP_CALLBACK_INFORMATION);
128static fpMiniDumpWriteDump fMiniDumpWriteDump;
130typedef BOOL(WINAPI *fpStackWalk64)(
DWORD, HANDLE, HANDLE, LPSTACKFRAME64,
131 PVOID, PREAD_PROCESS_MEMORY_ROUTINE64,
132 PFUNCTION_TABLE_ACCESS_ROUTINE64,
133 PGET_MODULE_BASE_ROUTINE64,
134 PTRANSLATE_ADDRESS_ROUTINE64);
135static fpStackWalk64 fStackWalk64;
137typedef DWORD64(WINAPI *fpSymGetModuleBase64)(HANDLE, DWORD64);
138static fpSymGetModuleBase64 fSymGetModuleBase64;
140typedef BOOL(WINAPI *fpSymGetSymFromAddr64)(HANDLE, DWORD64, PDWORD64,
142static fpSymGetSymFromAddr64 fSymGetSymFromAddr64;
144typedef BOOL(WINAPI *fpSymGetLineFromAddr64)(HANDLE, DWORD64, PDWORD,
146static fpSymGetLineFromAddr64 fSymGetLineFromAddr64;
148typedef BOOL(WINAPI *fpSymGetModuleInfo64)(HANDLE hProcess, DWORD64 dwAddr,
149 PIMAGEHLP_MODULE64 ModuleInfo);
150static fpSymGetModuleInfo64 fSymGetModuleInfo64;
152typedef PVOID(WINAPI *fpSymFunctionTableAccess64)(HANDLE, DWORD64);
153static fpSymFunctionTableAccess64 fSymFunctionTableAccess64;
156static fpSymSetOptions fSymSetOptions;
158typedef BOOL(WINAPI *fpSymInitialize)(HANDLE, PCSTR, BOOL);
159static fpSymInitialize fSymInitialize;
161typedef BOOL(WINAPI *fpEnumerateLoadedModules)(HANDLE,
162 PENUMLOADED_MODULES_CALLBACK64,
164static fpEnumerateLoadedModules fEnumerateLoadedModules;
166static bool isDebugHelpInitialized() {
167 return fStackWalk64 && fSymInitialize && fSymSetOptions && fMiniDumpWriteDump;
170static bool load64BitDebugHelp(
void) {
172 ::LoadLibraryExA(
"Dbghelp.dll", NULL, LOAD_LIBRARY_SEARCH_SYSTEM32);
175 (fpMiniDumpWriteDump)::GetProcAddress(hLib,
"MiniDumpWriteDump");
176 fStackWalk64 = (fpStackWalk64)::GetProcAddress(hLib,
"StackWalk64");
177 fSymGetModuleBase64 =
178 (fpSymGetModuleBase64)::GetProcAddress(hLib,
"SymGetModuleBase64");
179 fSymGetSymFromAddr64 =
180 (fpSymGetSymFromAddr64)::GetProcAddress(hLib,
"SymGetSymFromAddr64");
181 fSymGetLineFromAddr64 =
182 (fpSymGetLineFromAddr64)::GetProcAddress(hLib,
"SymGetLineFromAddr64");
183 fSymGetModuleInfo64 =
184 (fpSymGetModuleInfo64)::GetProcAddress(hLib,
"SymGetModuleInfo64");
185 fSymFunctionTableAccess64 = (fpSymFunctionTableAccess64)::GetProcAddress(
186 hLib,
"SymFunctionTableAccess64");
187 fSymSetOptions = (fpSymSetOptions)::GetProcAddress(hLib,
"SymSetOptions");
188 fSymInitialize = (fpSymInitialize)::GetProcAddress(hLib,
"SymInitialize");
189 fEnumerateLoadedModules = (fpEnumerateLoadedModules)::GetProcAddress(
190 hLib,
"EnumerateLoadedModules64");
192 return isDebugHelpInitialized();
198static LONG WINAPI LLVMUnhandledExceptionFilter(LPEXCEPTION_POINTERS ep);
199static BOOL WINAPI LLVMConsoleCtrlHandler(DWORD dwCtrlType);
202static void (*InterruptFunction)() = 0;
204static std::vector<std::string> *FilesToRemove = NULL;
205static bool RegisteredUnhandledExceptionFilter =
false;
206static bool CleanupExecuted =
false;
207static PTOP_LEVEL_EXCEPTION_FILTER OldFilter = NULL;
210static std::atomic<void (*)()> OneShotPipeSignalFunction(
nullptr);
215static CRITICAL_SECTION CriticalSection;
216static bool CriticalSectionInitialized =
false;
223#elif defined(_M_ARM64)
225#elif defined(_M_IX86)
235 HANDLE hProcess, HANDLE hThread,
236 STACKFRAME64 &StackFrameOrig,
237 CONTEXT *ContextOrig) {
239 STACKFRAME64 StackFrame = StackFrameOrig;
245 CONTEXT
Context = *ContextOrig;
246 Context.ContextFlags = CONTEXT_CONTROL | CONTEXT_INTEGER;
248 static void *StackTrace[256];
250 while (fStackWalk64(NativeMachineType, hProcess, hThread, &StackFrame,
251 &Context, 0, fSymFunctionTableAccess64,
252 fSymGetModuleBase64, 0)) {
253 if (StackFrame.AddrFrame.Offset == 0)
255 StackTrace[
Depth++] = (
void *)(uintptr_t)StackFrame.AddrPC.Offset;
256 if (Depth >= std::size(StackTrace))
264struct FindModuleData {
267 const char **Modules;
273static BOOL CALLBACK findModuleCallback(PCSTR
ModuleName, DWORD64 ModuleBase,
274 ULONG ModuleSize,
void *VoidData) {
275 FindModuleData *Data = (FindModuleData *)VoidData;
276 intptr_t Beg = ModuleBase;
277 intptr_t
End = Beg + ModuleSize;
278 for (
int I = 0;
I < Data->Depth;
I++) {
279 if (Data->Modules[
I])
281 intptr_t
Addr = (intptr_t)Data->StackTrace[
I];
283 Data->Modules[
I] = Data->StrPool->save(
ModuleName).data();
284 Data->Offsets[
I] =
Addr - Beg;
291 const char **Modules, intptr_t *Offsets,
292 const char *MainExecutableName,
294 if (!fEnumerateLoadedModules)
297 Data.StackTrace = StackTrace;
299 Data.Modules = Modules;
301 Data.StrPool = &StrPool;
302 fEnumerateLoadedModules(GetCurrentProcess(), findModuleCallback, &Data);
307 const char *MainExecutableName) {
312 HANDLE hThread, STACKFRAME64 &StackFrame,
317 if (!isDebugHelpInitialized())
321 fSymSetOptions(SYMOPT_DEFERRED_LOADS | SYMOPT_LOAD_LINES);
322 fSymInitialize(hProcess, NULL, TRUE);
327 if (printStackTraceWithLLVMSymbolizer(
OS, hProcess, hThread, StackFrame,
333 if (!fStackWalk64(NativeMachineType, hProcess, hThread, &StackFrame,
334 Context, 0, fSymFunctionTableAccess64,
335 fSymGetModuleBase64, 0)) {
339 if (StackFrame.AddrFrame.Offset == 0)
342 using namespace llvm;
344 DWORD64 PC = StackFrame.AddrPC.Offset;
345#if defined(_M_X64) || defined(_M_ARM64)
347#elif defined(_M_IX86) || defined(_M_ARM)
352 if (!fSymGetModuleBase64(hProcess, PC)) {
353 OS <<
" <unknown module>\n";
358 memset(&M, 0,
sizeof(IMAGEHLP_MODULE64));
359 M.SizeOfStruct =
sizeof(IMAGEHLP_MODULE64);
360 if (fSymGetModuleInfo64(hProcess, fSymGetModuleBase64(hProcess, PC), &M)) {
361 DWORD64
const disp = PC -
M.BaseOfImage;
362 OS <<
format(
", %s(0x%016llX) + 0x%llX byte(s)",
363 static_cast<char *
>(
M.ImageName),
M.BaseOfImage,
364 static_cast<long long>(disp));
366 OS <<
", <unknown module>";
371 IMAGEHLP_SYMBOL64 *symbol =
reinterpret_cast<IMAGEHLP_SYMBOL64 *
>(buffer);
372 memset(symbol, 0,
sizeof(IMAGEHLP_SYMBOL64));
373 symbol->SizeOfStruct =
sizeof(IMAGEHLP_SYMBOL64);
374 symbol->MaxNameLength = 512 -
sizeof(IMAGEHLP_SYMBOL64);
377 if (!fSymGetSymFromAddr64(hProcess, PC, &dwDisp, symbol)) {
383 OS <<
format(
", %s() + 0x%llX byte(s)",
static_cast<char *
>(symbol->Name),
384 static_cast<long long>(dwDisp));
387 IMAGEHLP_LINE64 line = {};
389 line.SizeOfStruct =
sizeof(line);
390 if (fSymGetLineFromAddr64(hProcess, PC, &dwLineDisp, &line)) {
391 OS <<
format(
", %s, line %lu + 0x%lX byte(s)", line.FileName,
392 line.LineNumber, dwLineDisp);
411AvoidMessageBoxHook(
int ReportType,
char *Message,
int *Return) {
423extern "C" void HandleAbort(
int Sig) {
424 if (Sig == SIGABRT) {
429static void InitializeThreading() {
430 if (CriticalSectionInitialized)
435 InitializeCriticalSection(&CriticalSection);
436 CriticalSectionInitialized =
true;
439static void RegisterHandler() {
443 if (!load64BitDebugHelp()) {
444 assert(
false &&
"These APIs should always be available");
448 if (RegisteredUnhandledExceptionFilter) {
449 EnterCriticalSection(&CriticalSection);
453 InitializeThreading();
457 EnterCriticalSection(&CriticalSection);
459 RegisteredUnhandledExceptionFilter =
true;
460 OldFilter = SetUnhandledExceptionFilter(LLVMUnhandledExceptionFilter);
461 SetConsoleCtrlHandler(LLVMConsoleCtrlHandler, TRUE);
471 if (CleanupExecuted) {
473 *ErrMsg =
"Process terminating -- cannot register for removal";
477 if (FilesToRemove == NULL)
478 FilesToRemove =
new std::vector<std::string>;
480 FilesToRemove->push_back(std::string(Filename));
482 LeaveCriticalSection(&CriticalSection);
488 if (FilesToRemove == NULL)
493 std::vector<std::string>::reverse_iterator
I =
495 if (
I != FilesToRemove->rend())
496 FilesToRemove->erase(
I.base() - 1);
498 LeaveCriticalSection(&CriticalSection);
503 signal(SIGABRT, HandleAbort);
508 _set_abort_behavior(0, _WRITE_ABORT_MSG);
510 _set_abort_behavior(0, _CALL_REPORTFAULT);
511 _CrtSetReportHook(AvoidMessageBoxHook);
515 SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOGPFAULTERRORBOX |
516 SEM_NOOPENFILEERRORBOX);
517 _set_error_mode(_OUT_TO_STDERR);
523 bool DisableCrashReporting) {
526 if (DisableCrashReporting || getenv(
"LLVM_DISABLE_CRASH_REPORT"))
531 LeaveCriticalSection(&CriticalSection);
535#if defined(__MINGW32__) && !defined(__MINGW64_VERSION_MAJOR)
538extern "C" VOID WINAPI RtlCaptureContext(PCONTEXT ContextRecord);
542 STACKFRAME64 StackFrame{};
545 ::RtlCaptureContext(&Context);
549 StackFrame.AddrPC.Offset =
Context.Rip;
550 StackFrame.AddrStack.Offset =
Context.Rsp;
551 StackFrame.AddrFrame.Offset =
Context.Rbp;
552#elif defined(_M_IX86)
553 StackFrame.AddrPC.Offset =
Context.Eip;
554 StackFrame.AddrStack.Offset =
Context.Esp;
555 StackFrame.AddrFrame.Offset =
Context.Ebp;
556#elif defined(_M_ARM64)
557 StackFrame.AddrPC.Offset =
Context.Pc;
558 StackFrame.AddrStack.Offset =
Context.Sp;
559 StackFrame.AddrFrame.Offset =
Context.Fp;
561 StackFrame.AddrPC.Offset =
Context.Pc;
562 StackFrame.AddrStack.Offset =
Context.Sp;
563 StackFrame.AddrFrame.Offset =
Context.R11;
565 StackFrame.AddrPC.Mode = AddrModeFlat;
566 StackFrame.AddrStack.Mode = AddrModeFlat;
567 StackFrame.AddrFrame.Mode = AddrModeFlat;
568 PrintStackTraceForThread(
OS, GetCurrentProcess(), GetCurrentThread(),
574 LocalPrintStackTrace(
OS,
nullptr);
579 InterruptFunction =
IF;
580 LeaveCriticalSection(&CriticalSection);
588 OneShotPipeSignalFunction.exchange(Handler);
595void llvm::sys::CallOneShotPipeSignalHandler() {
596 if (
auto OldOneShotPipeFunction = OneShotPipeSignalFunction.exchange(
nullptr))
597 OldOneShotPipeFunction();
607 LeaveCriticalSection(&CriticalSection);
610static void Cleanup(
bool ExecuteSignalHandlers) {
614 EnterCriticalSection(&CriticalSection);
618 CleanupExecuted =
true;
621 if (FilesToRemove != NULL)
622 while (!FilesToRemove->empty()) {
624 FilesToRemove->pop_back();
627 if (ExecuteSignalHandlers)
630 LeaveCriticalSection(&CriticalSection);
638 InitializeThreading();
645static HKEY FindWERKey(
const llvm::Twine &RegistryLocation) {
647 if (ERROR_SUCCESS != ::RegOpenKeyExA(HKEY_LOCAL_MACHINE,
648 RegistryLocation.
str().c_str(), 0,
649 KEY_QUERY_VALUE | KEY_READ, &Key))
659static bool GetDumpFolder(HKEY Key,
661 using llvm::sys::windows::UTF16ToUTF8;
666 DWORD BufferLengthBytes = 0;
668 if (ERROR_SUCCESS != ::RegGetValueW(Key, 0, L
"DumpFolder", REG_EXPAND_SZ,
669 NULL, NULL, &BufferLengthBytes))
674 if (ERROR_SUCCESS != ::RegGetValueW(Key, 0, L
"DumpFolder", REG_EXPAND_SZ,
675 NULL, Buffer.data(), &BufferLengthBytes))
678 DWORD ExpandBufferSize = ::ExpandEnvironmentStringsW(Buffer.data(), NULL, 0);
680 if (!ExpandBufferSize)
685 if (ExpandBufferSize != ::ExpandEnvironmentStringsW(Buffer.data(),
690 if (UTF16ToUTF8(ExpandBuffer.data(), ExpandBufferSize - 1, ResultDirectory))
709static bool GetDumpType(HKEY Key, MINIDUMP_TYPE &ResultType) {
715 if (ERROR_SUCCESS != ::RegGetValueW(Key, NULL, L
"DumpType", RRF_RT_REG_DWORD,
722 if (ERROR_SUCCESS != ::RegGetValueW(Key, NULL, L
"CustomDumpFlags",
723 RRF_RT_REG_DWORD, NULL, &Flags,
727 ResultType =
static_cast<MINIDUMP_TYPE
>(
Flags);
731 ResultType = MiniDumpNormal;
734 ResultType = MiniDumpWithFullMemory;
747static std::error_code WINAPI
748WriteWindowsDumpFile(PMINIDUMP_EXCEPTION_INFORMATION ExceptionInfo) {
749 struct ScopedCriticalSection {
750 ScopedCriticalSection() { EnterCriticalSection(&CriticalSection); }
751 ~ScopedCriticalSection() { LeaveCriticalSection(&CriticalSection); }
754 using namespace llvm;
757 std::string MainExecutableName = fs::getMainExecutable(
nullptr,
nullptr);
760 if (MainExecutableName.empty()) {
767 ProgramName = path::filename(MainExecutableName.c_str());
774 "SOFTWARE\\Microsoft\\Windows\\Windows Error Reporting\\LocalDumps";
778 ScopedRegHandle DefaultLocalDumpsKey(FindWERKey(LocalDumpsRegistryLocation));
784 FindWERKey(
Twine(LocalDumpsRegistryLocation) +
"\\" + ProgramName));
790 MINIDUMP_TYPE DumpType;
791 if (!GetDumpType(AppSpecificKey, DumpType))
792 if (!GetDumpType(DefaultLocalDumpsKey, DumpType))
793 DumpType = MiniDumpNormal;
801 bool ExplicitDumpDirectorySet =
true;
803 if (DumpDirectory.empty())
804 if (!GetDumpFolder(AppSpecificKey, DumpDirectory))
805 if (!GetDumpFolder(DefaultLocalDumpsKey, DumpDirectory))
806 ExplicitDumpDirectorySet =
false;
811 if (ExplicitDumpDirectorySet) {
812 if (std::error_code EC = fs::create_directories(DumpDirectory))
814 if (std::error_code EC = fs::createUniqueFile(
815 Twine(DumpDirectory) +
"\\" + ProgramName +
".%%%%%%.dmp", FD,
818 }
else if (std::error_code EC =
819 fs::createTemporaryFile(ProgramName,
"dmp", FD, DumpPath))
825 if (!fMiniDumpWriteDump(::GetCurrentProcess(), ::GetCurrentProcessId(),
826 FileHandle, DumpType, ExceptionInfo, NULL, NULL))
829 llvm::errs() <<
"Wrote crash dump file \"" << DumpPath <<
"\"\n";
830 return std::error_code();
833void sys::CleanupOnSignal(uintptr_t Context) {
834 LPEXCEPTION_POINTERS EP = (LPEXCEPTION_POINTERS)Context;
839 unsigned RetCode = EP->ExceptionRecord->ExceptionCode;
840 if (RetCode == (0xE0000000 | EX_IOERR))
842 LLVMUnhandledExceptionFilter(EP);
845static LONG WINAPI LLVMUnhandledExceptionFilter(LPEXCEPTION_POINTERS ep) {
849 if (ep && ep->ExceptionRecord)
851 ep->ExceptionRecord->ExceptionCode)
859 MINIDUMP_EXCEPTION_INFORMATION ExceptionInfo;
860 ExceptionInfo.ThreadId = ::GetCurrentThreadId();
861 ExceptionInfo.ExceptionPointers = ep;
862 ExceptionInfo.ClientPointers = FALSE;
864 if (std::error_code EC = WriteWindowsDumpFile(&ExceptionInfo))
865 llvm::errs() <<
"Could not write crash dump file: " <<
EC.message()
873 memcpy(&ContextCopy, ep->ContextRecord,
sizeof(ContextCopy));
875 LocalPrintStackTrace(
llvm::errs(), ep ? &ContextCopy :
nullptr);
877 return EXCEPTION_EXECUTE_HANDLER;
880static BOOL WINAPI LLVMConsoleCtrlHandler(DWORD dwCtrlType) {
882 EnterCriticalSection(&CriticalSection);
890 void (*IF)() = InterruptFunction;
891 InterruptFunction = 0;
897 LeaveCriticalSection(&CriticalSection);
902 LeaveCriticalSection(&CriticalSection);
911#pragma GCC diagnostic warning "-Wformat"
912#pragma GCC diagnostic warning "-Wformat-extra-args"
915void sys::unregisterHandlers() {}
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 ...
#define LLVM_ATTRIBUTE_UNUSED
This file contains definitions of exit codes for exit() function.
static const HTTPClientCleanup Cleanup
Provides a library for accessing information about this process and other processes on the operating ...
static cl::opt< RegAllocEvictionAdvisorAnalysis::AdvisorMode > Mode("regalloc-enable-advisor", cl::Hidden, cl::init(RegAllocEvictionAdvisorAnalysis::AdvisorMode::Default), cl::desc("Enable regalloc advisor mode"), cl::values(clEnumValN(RegAllocEvictionAdvisorAnalysis::AdvisorMode::Default, "default", "Default"), clEnumValN(RegAllocEvictionAdvisorAnalysis::AdvisorMode::Release, "release", "precompiled"), clEnumValN(RegAllocEvictionAdvisorAnalysis::AdvisorMode::Development, "development", "for training")))
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
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...
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 void PreventCoreFiles()
This function makes the necessary calls to the operating system to prevent core files or any other ki...
static void Exit(int RetCode, bool NoCleanup=false)
Equivalent to ::exit(), except when running inside a CrashRecoveryContext.
static bool AreCoreFilesPrevented()
true if PreventCoreFiles has been called, false otherwise.
@ IMAGE_FILE_MACHINE_ARM64
@ IMAGE_FILE_MACHINE_UNKNOWN
@ IMAGE_FILE_MACHINE_AMD64
@ IMAGE_FILE_MACHINE_I386
@ IMAGE_FILE_MACHINE_ARMNT
std::error_code remove(const Twine &path, bool IgnoreNonExisting=true)
Remove path.
void SetInterruptFunction(void(*IF)())
This function registers a function to be called when the user "interrupts" the program (typically by ...
void PrintStackTrace(raw_ostream &OS, int Depth=0)
Print the stack trace using the given raw_ostream object.
void DisableSystemDialogsOnCrash()
Disable all system dialog boxes that appear when the process crashes.
void SetOneShotPipeSignalFunction(void(*Handler)())
Registers a function to be called in a "one-shot" manner when a pipe signal is delivered to the proce...
void DontRemoveFileOnSignal(StringRef Filename)
This function removes a file from the list of files to be removed on signal delivery.
void DefaultOneShotPipeSignalHandler()
On Unix systems and Windows, this function exits with an "IO error" exit code.
void(*)(void *) SignalHandlerCallback
void AddSignalHandler(SignalHandlerCallback FnPtr, void *Cookie)
Add a function to be called when an abort/kill signal is delivered to the process.
void SetInfoSignalFunction(void(*Handler)())
Registers a function to be called when an "info" signal is delivered to the process.
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 RunInterruptHandlers()
This function runs all the registered interrupt handlers, including the removal of files registered b...
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...
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.
auto reverse(ContainerTy &&C)
format_object< Ts... > format(const char *Fmt, const Ts &... Vals)
These are helper functions used to produce formatted output.
raw_fd_ostream & errs()
This returns a reference to a raw_ostream for standard error.
std::error_code mapWindowsError(unsigned EV)