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) {
171 HMODULE hLib = ::LoadLibraryW(L
"Dbghelp.dll");
174 (fpMiniDumpWriteDump)::GetProcAddress(hLib,
"MiniDumpWriteDump");
175 fStackWalk64 = (fpStackWalk64)::GetProcAddress(hLib,
"StackWalk64");
176 fSymGetModuleBase64 =
177 (fpSymGetModuleBase64)::GetProcAddress(hLib,
"SymGetModuleBase64");
178 fSymGetSymFromAddr64 =
179 (fpSymGetSymFromAddr64)::GetProcAddress(hLib,
"SymGetSymFromAddr64");
180 fSymGetLineFromAddr64 =
181 (fpSymGetLineFromAddr64)::GetProcAddress(hLib,
"SymGetLineFromAddr64");
182 fSymGetModuleInfo64 =
183 (fpSymGetModuleInfo64)::GetProcAddress(hLib,
"SymGetModuleInfo64");
184 fSymFunctionTableAccess64 = (fpSymFunctionTableAccess64)::GetProcAddress(
185 hLib,
"SymFunctionTableAccess64");
186 fSymSetOptions = (fpSymSetOptions)::GetProcAddress(hLib,
"SymSetOptions");
187 fSymInitialize = (fpSymInitialize)::GetProcAddress(hLib,
"SymInitialize");
188 fEnumerateLoadedModules = (fpEnumerateLoadedModules)::GetProcAddress(
189 hLib,
"EnumerateLoadedModules64");
191 return isDebugHelpInitialized();
197static LONG WINAPI LLVMUnhandledExceptionFilter(LPEXCEPTION_POINTERS ep);
198static BOOL WINAPI LLVMConsoleCtrlHandler(DWORD dwCtrlType);
201static void (*InterruptFunction)() = 0;
203static std::vector<std::string> *FilesToRemove = NULL;
204static bool RegisteredUnhandledExceptionFilter =
false;
205static bool CleanupExecuted =
false;
206static PTOP_LEVEL_EXCEPTION_FILTER OldFilter = NULL;
209static std::atomic<void (*)()> OneShotPipeSignalFunction(
nullptr);
214static CRITICAL_SECTION CriticalSection;
215static bool CriticalSectionInitialized =
false;
222#elif defined(_M_ARM64)
224#elif defined(_M_IX86)
234 HANDLE hProcess, HANDLE hThread,
235 STACKFRAME64 &StackFrameOrig,
236 CONTEXT *ContextOrig) {
238 STACKFRAME64 StackFrame = StackFrameOrig;
244 CONTEXT
Context = *ContextOrig;
245 Context.ContextFlags = CONTEXT_CONTROL | CONTEXT_INTEGER;
247 static void *StackTrace[256];
249 while (fStackWalk64(NativeMachineType, hProcess, hThread, &StackFrame,
250 &Context, 0, fSymFunctionTableAccess64,
251 fSymGetModuleBase64, 0)) {
252 if (StackFrame.AddrFrame.Offset == 0)
254 StackTrace[
Depth++] = (
void *)(uintptr_t)StackFrame.AddrPC.Offset;
255 if (Depth >= std::size(StackTrace))
263struct FindModuleData {
266 const char **Modules;
272static BOOL CALLBACK findModuleCallback(PCSTR
ModuleName, DWORD64 ModuleBase,
273 ULONG ModuleSize,
void *VoidData) {
274 FindModuleData *Data = (FindModuleData *)VoidData;
275 intptr_t Beg = ModuleBase;
276 intptr_t
End = Beg + ModuleSize;
277 for (
int I = 0;
I < Data->Depth;
I++) {
278 if (Data->Modules[
I])
280 intptr_t
Addr = (intptr_t)Data->StackTrace[
I];
282 Data->Modules[
I] = Data->StrPool->save(
ModuleName).data();
283 Data->Offsets[
I] =
Addr - Beg;
290 const char **Modules, intptr_t *Offsets,
291 const char *MainExecutableName,
293 if (!fEnumerateLoadedModules)
296 Data.StackTrace = StackTrace;
298 Data.Modules = Modules;
300 Data.StrPool = &StrPool;
301 fEnumerateLoadedModules(GetCurrentProcess(), findModuleCallback, &Data);
306 const char *MainExecutableName) {
311 HANDLE hThread, STACKFRAME64 &StackFrame,
316 if (!isDebugHelpInitialized())
320 fSymSetOptions(SYMOPT_DEFERRED_LOADS | SYMOPT_LOAD_LINES);
321 fSymInitialize(hProcess, NULL, TRUE);
326 if (printStackTraceWithLLVMSymbolizer(
OS, hProcess, hThread, StackFrame,
332 if (!fStackWalk64(NativeMachineType, hProcess, hThread, &StackFrame,
333 Context, 0, fSymFunctionTableAccess64,
334 fSymGetModuleBase64, 0)) {
338 if (StackFrame.AddrFrame.Offset == 0)
341 using namespace llvm;
343 DWORD64 PC = StackFrame.AddrPC.Offset;
344#if defined(_M_X64) || defined(_M_ARM64)
346#elif defined(_M_IX86) || defined(_M_ARM)
351 if (!fSymGetModuleBase64(hProcess, PC)) {
352 OS <<
" <unknown module>\n";
357 memset(&M, 0,
sizeof(IMAGEHLP_MODULE64));
358 M.SizeOfStruct =
sizeof(IMAGEHLP_MODULE64);
359 if (fSymGetModuleInfo64(hProcess, fSymGetModuleBase64(hProcess, PC), &M)) {
360 DWORD64
const disp = PC -
M.BaseOfImage;
361 OS <<
format(
", %s(0x%016llX) + 0x%llX byte(s)",
362 static_cast<char *
>(
M.ImageName),
M.BaseOfImage,
363 static_cast<long long>(disp));
365 OS <<
", <unknown module>";
370 IMAGEHLP_SYMBOL64 *symbol =
reinterpret_cast<IMAGEHLP_SYMBOL64 *
>(buffer);
371 memset(symbol, 0,
sizeof(IMAGEHLP_SYMBOL64));
372 symbol->SizeOfStruct =
sizeof(IMAGEHLP_SYMBOL64);
373 symbol->MaxNameLength = 512 -
sizeof(IMAGEHLP_SYMBOL64);
376 if (!fSymGetSymFromAddr64(hProcess, PC, &dwDisp, symbol)) {
382 OS <<
format(
", %s() + 0x%llX byte(s)",
static_cast<char *
>(symbol->Name),
383 static_cast<long long>(dwDisp));
386 IMAGEHLP_LINE64 line = {};
388 line.SizeOfStruct =
sizeof(line);
389 if (fSymGetLineFromAddr64(hProcess, PC, &dwLineDisp, &line)) {
390 OS <<
format(
", %s, line %lu + 0x%lX byte(s)", line.FileName,
391 line.LineNumber, dwLineDisp);
410AvoidMessageBoxHook(
int ReportType,
char *Message,
int *Return) {
422extern "C" void HandleAbort(
int Sig) {
423 if (Sig == SIGABRT) {
428static void InitializeThreading() {
429 if (CriticalSectionInitialized)
434 InitializeCriticalSection(&CriticalSection);
435 CriticalSectionInitialized =
true;
438static void RegisterHandler() {
442 if (!load64BitDebugHelp()) {
443 assert(
false &&
"These APIs should always be available");
447 if (RegisteredUnhandledExceptionFilter) {
448 EnterCriticalSection(&CriticalSection);
452 InitializeThreading();
456 EnterCriticalSection(&CriticalSection);
458 RegisteredUnhandledExceptionFilter =
true;
459 OldFilter = SetUnhandledExceptionFilter(LLVMUnhandledExceptionFilter);
460 SetConsoleCtrlHandler(LLVMConsoleCtrlHandler, TRUE);
470 if (CleanupExecuted) {
472 *ErrMsg =
"Process terminating -- cannot register for removal";
476 if (FilesToRemove == NULL)
477 FilesToRemove =
new std::vector<std::string>;
479 FilesToRemove->push_back(std::string(Filename));
481 LeaveCriticalSection(&CriticalSection);
487 if (FilesToRemove == NULL)
492 std::vector<std::string>::reverse_iterator
I =
494 if (
I != FilesToRemove->rend())
495 FilesToRemove->erase(
I.base() - 1);
497 LeaveCriticalSection(&CriticalSection);
502 signal(SIGABRT, HandleAbort);
507 _set_abort_behavior(0, _WRITE_ABORT_MSG);
509 _set_abort_behavior(0, _CALL_REPORTFAULT);
510 _CrtSetReportHook(AvoidMessageBoxHook);
514 SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOGPFAULTERRORBOX |
515 SEM_NOOPENFILEERRORBOX);
516 _set_error_mode(_OUT_TO_STDERR);
522 bool DisableCrashReporting) {
525 if (DisableCrashReporting || getenv(
"LLVM_DISABLE_CRASH_REPORT"))
530 LeaveCriticalSection(&CriticalSection);
534#if defined(__MINGW32__) && !defined(__MINGW64_VERSION_MAJOR)
537extern "C" VOID WINAPI RtlCaptureContext(PCONTEXT ContextRecord);
541 STACKFRAME64 StackFrame{};
544 ::RtlCaptureContext(&Context);
548 StackFrame.AddrPC.Offset =
Context.Rip;
549 StackFrame.AddrStack.Offset =
Context.Rsp;
550 StackFrame.AddrFrame.Offset =
Context.Rbp;
551#elif defined(_M_IX86)
552 StackFrame.AddrPC.Offset =
Context.Eip;
553 StackFrame.AddrStack.Offset =
Context.Esp;
554 StackFrame.AddrFrame.Offset =
Context.Ebp;
555#elif defined(_M_ARM64)
556 StackFrame.AddrPC.Offset =
Context.Pc;
557 StackFrame.AddrStack.Offset =
Context.Sp;
558 StackFrame.AddrFrame.Offset =
Context.Fp;
560 StackFrame.AddrPC.Offset =
Context.Pc;
561 StackFrame.AddrStack.Offset =
Context.Sp;
562 StackFrame.AddrFrame.Offset =
Context.R11;
564 StackFrame.AddrPC.Mode = AddrModeFlat;
565 StackFrame.AddrStack.Mode = AddrModeFlat;
566 StackFrame.AddrFrame.Mode = AddrModeFlat;
567 PrintStackTraceForThread(
OS, GetCurrentProcess(), GetCurrentThread(),
573 LocalPrintStackTrace(
OS,
nullptr);
578 InterruptFunction =
IF;
579 LeaveCriticalSection(&CriticalSection);
587 OneShotPipeSignalFunction.exchange(Handler);
594void llvm::sys::CallOneShotPipeSignalHandler() {
595 if (
auto OldOneShotPipeFunction = OneShotPipeSignalFunction.exchange(
nullptr))
596 OldOneShotPipeFunction();
606 LeaveCriticalSection(&CriticalSection);
609static void Cleanup(
bool ExecuteSignalHandlers) {
613 EnterCriticalSection(&CriticalSection);
617 CleanupExecuted =
true;
620 if (FilesToRemove != NULL)
621 while (!FilesToRemove->empty()) {
623 FilesToRemove->pop_back();
626 if (ExecuteSignalHandlers)
629 LeaveCriticalSection(&CriticalSection);
637 InitializeThreading();
644static HKEY FindWERKey(
const llvm::Twine &RegistryLocation) {
646 if (ERROR_SUCCESS != ::RegOpenKeyExA(HKEY_LOCAL_MACHINE,
647 RegistryLocation.
str().c_str(), 0,
648 KEY_QUERY_VALUE | KEY_READ, &Key))
658static bool GetDumpFolder(HKEY Key,
660 using llvm::sys::windows::UTF16ToUTF8;
665 DWORD BufferLengthBytes = 0;
667 if (ERROR_SUCCESS != ::RegGetValueW(Key, 0, L
"DumpFolder", REG_EXPAND_SZ,
668 NULL, NULL, &BufferLengthBytes))
673 if (ERROR_SUCCESS != ::RegGetValueW(Key, 0, L
"DumpFolder", REG_EXPAND_SZ,
674 NULL, Buffer.data(), &BufferLengthBytes))
677 DWORD ExpandBufferSize = ::ExpandEnvironmentStringsW(Buffer.data(), NULL, 0);
679 if (!ExpandBufferSize)
684 if (ExpandBufferSize != ::ExpandEnvironmentStringsW(Buffer.data(),
689 if (UTF16ToUTF8(ExpandBuffer.data(), ExpandBufferSize - 1, ResultDirectory))
708static bool GetDumpType(HKEY Key, MINIDUMP_TYPE &ResultType) {
714 if (ERROR_SUCCESS != ::RegGetValueW(Key, NULL, L
"DumpType", RRF_RT_REG_DWORD,
721 if (ERROR_SUCCESS != ::RegGetValueW(Key, NULL, L
"CustomDumpFlags",
722 RRF_RT_REG_DWORD, NULL, &Flags,
726 ResultType =
static_cast<MINIDUMP_TYPE
>(
Flags);
730 ResultType = MiniDumpNormal;
733 ResultType = MiniDumpWithFullMemory;
746static std::error_code WINAPI
747WriteWindowsDumpFile(PMINIDUMP_EXCEPTION_INFORMATION ExceptionInfo) {
748 struct ScopedCriticalSection {
749 ScopedCriticalSection() { EnterCriticalSection(&CriticalSection); }
750 ~ScopedCriticalSection() { LeaveCriticalSection(&CriticalSection); }
753 using namespace llvm;
756 std::string MainExecutableName = fs::getMainExecutable(
nullptr,
nullptr);
759 if (MainExecutableName.empty()) {
766 ProgramName = path::filename(MainExecutableName.c_str());
773 "SOFTWARE\\Microsoft\\Windows\\Windows Error Reporting\\LocalDumps";
777 ScopedRegHandle DefaultLocalDumpsKey(FindWERKey(LocalDumpsRegistryLocation));
783 FindWERKey(
Twine(LocalDumpsRegistryLocation) +
"\\" + ProgramName));
789 MINIDUMP_TYPE DumpType;
790 if (!GetDumpType(AppSpecificKey, DumpType))
791 if (!GetDumpType(DefaultLocalDumpsKey, DumpType))
792 DumpType = MiniDumpNormal;
800 bool ExplicitDumpDirectorySet =
true;
802 if (DumpDirectory.empty())
803 if (!GetDumpFolder(AppSpecificKey, DumpDirectory))
804 if (!GetDumpFolder(DefaultLocalDumpsKey, DumpDirectory))
805 ExplicitDumpDirectorySet =
false;
810 if (ExplicitDumpDirectorySet) {
811 if (std::error_code EC = fs::create_directories(DumpDirectory))
813 if (std::error_code EC = fs::createUniqueFile(
814 Twine(DumpDirectory) +
"\\" + ProgramName +
".%%%%%%.dmp", FD,
817 }
else if (std::error_code EC =
818 fs::createTemporaryFile(ProgramName,
"dmp", FD, DumpPath))
824 if (!fMiniDumpWriteDump(::GetCurrentProcess(), ::GetCurrentProcessId(),
825 FileHandle, DumpType, ExceptionInfo, NULL, NULL))
828 llvm::errs() <<
"Wrote crash dump file \"" << DumpPath <<
"\"\n";
829 return std::error_code();
832void sys::CleanupOnSignal(uintptr_t Context) {
833 LPEXCEPTION_POINTERS EP = (LPEXCEPTION_POINTERS)Context;
838 unsigned RetCode = EP->ExceptionRecord->ExceptionCode;
839 if (RetCode == (0xE0000000 | EX_IOERR))
841 LLVMUnhandledExceptionFilter(EP);
844static LONG WINAPI LLVMUnhandledExceptionFilter(LPEXCEPTION_POINTERS ep) {
848 if (ep && ep->ExceptionRecord)
850 ep->ExceptionRecord->ExceptionCode)
858 MINIDUMP_EXCEPTION_INFORMATION ExceptionInfo;
859 ExceptionInfo.ThreadId = ::GetCurrentThreadId();
860 ExceptionInfo.ExceptionPointers = ep;
861 ExceptionInfo.ClientPointers = FALSE;
863 if (std::error_code EC = WriteWindowsDumpFile(&ExceptionInfo))
864 llvm::errs() <<
"Could not write crash dump file: " <<
EC.message()
872 memcpy(&ContextCopy, ep->ContextRecord,
sizeof(ContextCopy));
874 LocalPrintStackTrace(
llvm::errs(), ep ? &ContextCopy :
nullptr);
876 return EXCEPTION_EXECUTE_HANDLER;
879static BOOL WINAPI LLVMConsoleCtrlHandler(DWORD dwCtrlType) {
881 EnterCriticalSection(&CriticalSection);
889 void (*IF)() = InterruptFunction;
890 InterruptFunction = 0;
896 LeaveCriticalSection(&CriticalSection);
901 LeaveCriticalSection(&CriticalSection);
910#pragma GCC diagnostic warning "-Wformat"
911#pragma GCC diagnostic warning "-Wformat-extra-args"
914void 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)