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);
174 fMiniDumpWriteDump = (fpMiniDumpWriteDump)(
void *)::GetProcAddress(
175 hLib,
"MiniDumpWriteDump");
176 fStackWalk64 = (fpStackWalk64)(
void *)::GetProcAddress(hLib,
"StackWalk64");
177 fSymGetModuleBase64 = (fpSymGetModuleBase64)(
void *)::GetProcAddress(
178 hLib,
"SymGetModuleBase64");
179 fSymGetSymFromAddr64 = (fpSymGetSymFromAddr64)(
void *)::GetProcAddress(
180 hLib,
"SymGetSymFromAddr64");
181 fSymGetLineFromAddr64 = (fpSymGetLineFromAddr64)(
void *)::GetProcAddress(
182 hLib,
"SymGetLineFromAddr64");
183 fSymGetModuleInfo64 = (fpSymGetModuleInfo64)(
void *)::GetProcAddress(
184 hLib,
"SymGetModuleInfo64");
185 fSymFunctionTableAccess64 =
186 (fpSymFunctionTableAccess64)(
void *)::GetProcAddress(
187 hLib,
"SymFunctionTableAccess64");
189 (fpSymSetOptions)(
void *)::GetProcAddress(hLib,
"SymSetOptions");
191 (fpSymInitialize)(
void *)::GetProcAddress(hLib,
"SymInitialize");
192 fEnumerateLoadedModules =
193 (fpEnumerateLoadedModules)(
void *)::GetProcAddress(
194 hLib,
"EnumerateLoadedModules64");
196 return isDebugHelpInitialized();
202static LONG WINAPI LLVMUnhandledExceptionFilter(LPEXCEPTION_POINTERS ep);
203static BOOL WINAPI LLVMConsoleCtrlHandler(DWORD dwCtrlType);
206static void (*InterruptFunction)() = 0;
208static std::vector<std::string> *FilesToRemove = NULL;
209static bool RegisteredUnhandledExceptionFilter =
false;
210static bool CleanupExecuted =
false;
211static PTOP_LEVEL_EXCEPTION_FILTER OldFilter = NULL;
214static std::atomic<void (*)()> OneShotPipeSignalFunction(
nullptr);
219static CRITICAL_SECTION CriticalSection;
220static bool CriticalSectionInitialized =
false;
227#elif defined(_M_ARM64)
229#elif defined(_M_IX86)
239 HANDLE hProcess, HANDLE hThread,
240 STACKFRAME64 &StackFrameOrig,
241 CONTEXT *ContextOrig) {
243 STACKFRAME64 StackFrame = StackFrameOrig;
249 CONTEXT Context = *ContextOrig;
250 Context.ContextFlags = CONTEXT_CONTROL | CONTEXT_INTEGER;
252 static void *StackTrace[256];
254 while (fStackWalk64(NativeMachineType, hProcess, hThread, &StackFrame,
255 &Context, 0, fSymFunctionTableAccess64,
256 fSymGetModuleBase64, 0)) {
257 if (StackFrame.AddrFrame.Offset == 0)
259 StackTrace[
Depth++] = (
void *)(uintptr_t)StackFrame.AddrPC.Offset;
260 if (Depth >= std::size(StackTrace))
268struct FindModuleData {
271 const char **Modules;
277static BOOL CALLBACK findModuleCallback(PCSTR
ModuleName, DWORD64 ModuleBase,
278 ULONG ModuleSize,
void *VoidData) {
279 FindModuleData *Data = (FindModuleData *)VoidData;
280 intptr_t Beg = ModuleBase;
281 intptr_t
End = Beg + ModuleSize;
282 for (
int I = 0;
I < Data->Depth;
I++) {
283 if (Data->Modules[
I])
285 intptr_t
Addr = (intptr_t)Data->StackTrace[
I];
287 Data->Modules[
I] = Data->StrPool->save(
ModuleName).data();
288 Data->Offsets[
I] =
Addr - Beg;
295 const char **Modules, intptr_t *Offsets,
296 const char *MainExecutableName,
298 if (!fEnumerateLoadedModules)
301 Data.StackTrace = StackTrace;
303 Data.Modules = Modules;
305 Data.StrPool = &StrPool;
306 fEnumerateLoadedModules(GetCurrentProcess(), findModuleCallback, &Data);
311 const char *MainExecutableName) {
316 HANDLE hThread, STACKFRAME64 &StackFrame,
321 if (!isDebugHelpInitialized())
325 fSymSetOptions(SYMOPT_DEFERRED_LOADS | SYMOPT_LOAD_LINES);
326 fSymInitialize(hProcess, NULL, TRUE);
331 if (printStackTraceWithLLVMSymbolizer(
OS, hProcess, hThread, StackFrame,
337 if (!fStackWalk64(NativeMachineType, hProcess, hThread, &StackFrame,
338 Context, 0, fSymFunctionTableAccess64,
339 fSymGetModuleBase64, 0)) {
343 if (StackFrame.AddrFrame.Offset == 0)
346 using namespace llvm;
348 DWORD64 PC = StackFrame.AddrPC.Offset;
349#if defined(_M_X64) || defined(_M_ARM64)
351#elif defined(_M_IX86) || defined(_M_ARM)
356 if (!fSymGetModuleBase64(hProcess, PC)) {
357 OS <<
" <unknown module>\n";
362 memset(&M, 0,
sizeof(IMAGEHLP_MODULE64));
363 M.SizeOfStruct =
sizeof(IMAGEHLP_MODULE64);
364 if (fSymGetModuleInfo64(hProcess, fSymGetModuleBase64(hProcess, PC), &M)) {
365 DWORD64
const disp = PC -
M.BaseOfImage;
366 OS <<
format(
", %s(0x%016llX) + 0x%llX byte(s)",
367 static_cast<char *
>(
M.ImageName),
M.BaseOfImage,
368 static_cast<long long>(disp));
370 OS <<
", <unknown module>";
375 IMAGEHLP_SYMBOL64 *symbol =
reinterpret_cast<IMAGEHLP_SYMBOL64 *
>(buffer);
376 memset(symbol, 0,
sizeof(IMAGEHLP_SYMBOL64));
377 symbol->SizeOfStruct =
sizeof(IMAGEHLP_SYMBOL64);
378 symbol->MaxNameLength = 512 -
sizeof(IMAGEHLP_SYMBOL64);
381 if (!fSymGetSymFromAddr64(hProcess, PC, &dwDisp, symbol)) {
387 OS <<
format(
", %s() + 0x%llX byte(s)",
static_cast<char *
>(symbol->Name),
388 static_cast<long long>(dwDisp));
391 IMAGEHLP_LINE64 line = {};
393 line.SizeOfStruct =
sizeof(line);
394 if (fSymGetLineFromAddr64(hProcess, PC, &dwLineDisp, &line)) {
395 OS <<
format(
", %s, line %lu + 0x%lX byte(s)", line.FileName,
396 line.LineNumber, dwLineDisp);
415AvoidMessageBoxHook(
int ReportType,
char *Message,
int *Return) {
427extern "C" void HandleAbort(
int Sig) {
428 if (Sig == SIGABRT) {
433static void InitializeThreading() {
434 if (CriticalSectionInitialized)
439 InitializeCriticalSection(&CriticalSection);
440 CriticalSectionInitialized =
true;
443static void RegisterHandler() {
447 if (!load64BitDebugHelp()) {
448 assert(
false &&
"These APIs should always be available");
452 if (RegisteredUnhandledExceptionFilter) {
453 EnterCriticalSection(&CriticalSection);
457 InitializeThreading();
461 EnterCriticalSection(&CriticalSection);
463 RegisteredUnhandledExceptionFilter =
true;
464 OldFilter = SetUnhandledExceptionFilter(LLVMUnhandledExceptionFilter);
465 SetConsoleCtrlHandler(LLVMConsoleCtrlHandler, TRUE);
475 if (CleanupExecuted) {
477 *ErrMsg =
"Process terminating -- cannot register for removal";
481 if (FilesToRemove == NULL)
482 FilesToRemove =
new std::vector<std::string>;
484 FilesToRemove->push_back(std::string(Filename));
486 LeaveCriticalSection(&CriticalSection);
492 if (FilesToRemove == NULL)
497 std::vector<std::string>::reverse_iterator
I =
499 if (
I != FilesToRemove->rend())
500 FilesToRemove->erase(
I.base() - 1);
502 LeaveCriticalSection(&CriticalSection);
507 signal(SIGABRT, HandleAbort);
512 _set_abort_behavior(0, _WRITE_ABORT_MSG);
514 _set_abort_behavior(0, _CALL_REPORTFAULT);
515 _CrtSetReportHook(AvoidMessageBoxHook);
519 SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOGPFAULTERRORBOX |
520 SEM_NOOPENFILEERRORBOX);
521 _set_error_mode(_OUT_TO_STDERR);
527 bool DisableCrashReporting) {
530 if (DisableCrashReporting || getenv(
"LLVM_DISABLE_CRASH_REPORT"))
535 LeaveCriticalSection(&CriticalSection);
539#if defined(__MINGW32__) && !defined(__MINGW64_VERSION_MAJOR)
542extern "C" VOID WINAPI RtlCaptureContext(PCONTEXT ContextRecord);
546 STACKFRAME64 StackFrame{};
549 ::RtlCaptureContext(&Context);
553 StackFrame.AddrPC.Offset = Context.Rip;
554 StackFrame.AddrStack.Offset = Context.Rsp;
555 StackFrame.AddrFrame.Offset = Context.Rbp;
556#elif defined(_M_IX86)
557 StackFrame.AddrPC.Offset = Context.Eip;
558 StackFrame.AddrStack.Offset = Context.Esp;
559 StackFrame.AddrFrame.Offset = Context.Ebp;
560#elif defined(_M_ARM64)
561 StackFrame.AddrPC.Offset = Context.Pc;
562 StackFrame.AddrStack.Offset = Context.Sp;
563 StackFrame.AddrFrame.Offset = Context.Fp;
565 StackFrame.AddrPC.Offset = Context.Pc;
566 StackFrame.AddrStack.Offset = Context.Sp;
567 StackFrame.AddrFrame.Offset = Context.R11;
569 StackFrame.AddrPC.Mode = AddrModeFlat;
570 StackFrame.AddrStack.Mode = AddrModeFlat;
571 StackFrame.AddrFrame.Mode = AddrModeFlat;
572 PrintStackTraceForThread(
OS, GetCurrentProcess(), GetCurrentThread(),
578 LocalPrintStackTrace(
OS,
nullptr);
583 InterruptFunction =
IF;
584 LeaveCriticalSection(&CriticalSection);
592 OneShotPipeSignalFunction.exchange(Handler);
599void llvm::sys::CallOneShotPipeSignalHandler() {
600 if (
auto OldOneShotPipeFunction = OneShotPipeSignalFunction.exchange(
nullptr))
601 OldOneShotPipeFunction();
611 LeaveCriticalSection(&CriticalSection);
614static void Cleanup(
bool ExecuteSignalHandlers) {
618 EnterCriticalSection(&CriticalSection);
622 CleanupExecuted =
true;
625 if (FilesToRemove != NULL)
626 while (!FilesToRemove->empty()) {
628 FilesToRemove->pop_back();
631 if (ExecuteSignalHandlers)
634 LeaveCriticalSection(&CriticalSection);
642 InitializeThreading();
649static HKEY FindWERKey(
const llvm::Twine &RegistryLocation) {
651 if (ERROR_SUCCESS != ::RegOpenKeyExA(HKEY_LOCAL_MACHINE,
652 RegistryLocation.
str().c_str(), 0,
653 KEY_QUERY_VALUE | KEY_READ, &Key))
663static bool GetDumpFolder(HKEY Key,
665 using llvm::sys::windows::UTF16ToUTF8;
670 DWORD BufferLengthBytes = 0;
672 if (ERROR_SUCCESS != ::RegGetValueW(Key, 0, L
"DumpFolder", REG_EXPAND_SZ,
673 NULL, NULL, &BufferLengthBytes))
678 if (ERROR_SUCCESS != ::RegGetValueW(Key, 0, L
"DumpFolder", REG_EXPAND_SZ,
679 NULL, Buffer.data(), &BufferLengthBytes))
682 DWORD ExpandBufferSize = ::ExpandEnvironmentStringsW(Buffer.data(), NULL, 0);
684 if (!ExpandBufferSize)
689 if (ExpandBufferSize != ::ExpandEnvironmentStringsW(Buffer.data(),
694 if (UTF16ToUTF8(ExpandBuffer.data(), ExpandBufferSize - 1, ResultDirectory))
713static bool GetDumpType(HKEY Key, MINIDUMP_TYPE &ResultType) {
719 if (ERROR_SUCCESS != ::RegGetValueW(Key, NULL, L
"DumpType", RRF_RT_REG_DWORD,
726 if (ERROR_SUCCESS != ::RegGetValueW(Key, NULL, L
"CustomDumpFlags",
727 RRF_RT_REG_DWORD, NULL, &Flags,
731 ResultType =
static_cast<MINIDUMP_TYPE
>(
Flags);
735 ResultType = MiniDumpNormal;
738 ResultType = MiniDumpWithFullMemory;
751static std::error_code WINAPI
752WriteWindowsDumpFile(PMINIDUMP_EXCEPTION_INFORMATION ExceptionInfo) {
753 struct ScopedCriticalSection {
754 ScopedCriticalSection() { EnterCriticalSection(&CriticalSection); }
755 ~ScopedCriticalSection() { LeaveCriticalSection(&CriticalSection); }
758 using namespace llvm;
761 std::string MainExecutableName = fs::getMainExecutable(
nullptr,
nullptr);
764 if (MainExecutableName.empty()) {
771 ProgramName = path::filename(MainExecutableName.c_str());
778 "SOFTWARE\\Microsoft\\Windows\\Windows Error Reporting\\LocalDumps";
782 ScopedRegHandle DefaultLocalDumpsKey(FindWERKey(LocalDumpsRegistryLocation));
788 FindWERKey(
Twine(LocalDumpsRegistryLocation) +
"\\" + ProgramName));
794 MINIDUMP_TYPE DumpType;
795 if (!GetDumpType(AppSpecificKey, DumpType))
796 if (!GetDumpType(DefaultLocalDumpsKey, DumpType))
797 DumpType = MiniDumpNormal;
805 bool ExplicitDumpDirectorySet =
true;
807 if (DumpDirectory.empty())
808 if (!GetDumpFolder(AppSpecificKey, DumpDirectory))
809 if (!GetDumpFolder(DefaultLocalDumpsKey, DumpDirectory))
810 ExplicitDumpDirectorySet =
false;
815 if (ExplicitDumpDirectorySet) {
816 if (std::error_code EC = fs::create_directories(DumpDirectory))
818 if (std::error_code EC = fs::createUniqueFile(
819 Twine(DumpDirectory) +
"\\" + ProgramName +
".%%%%%%.dmp", FD,
822 }
else if (std::error_code EC =
823 fs::createTemporaryFile(ProgramName,
"dmp", FD, DumpPath))
829 if (!fMiniDumpWriteDump(::GetCurrentProcess(), ::GetCurrentProcessId(),
830 FileHandle, DumpType, ExceptionInfo, NULL, NULL))
833 llvm::errs() <<
"Wrote crash dump file \"" << DumpPath <<
"\"\n";
834 return std::error_code();
837void sys::CleanupOnSignal(uintptr_t Context) {
838 LPEXCEPTION_POINTERS EP = (LPEXCEPTION_POINTERS)Context;
843 unsigned RetCode = EP->ExceptionRecord->ExceptionCode;
844 if (RetCode == (0xE0000000 | EX_IOERR))
846 LLVMUnhandledExceptionFilter(EP);
849static LONG WINAPI LLVMUnhandledExceptionFilter(LPEXCEPTION_POINTERS ep) {
853 if (ep && ep->ExceptionRecord)
855 ep->ExceptionRecord->ExceptionCode)
863 MINIDUMP_EXCEPTION_INFORMATION ExceptionInfo;
864 ExceptionInfo.ThreadId = ::GetCurrentThreadId();
865 ExceptionInfo.ExceptionPointers = ep;
866 ExceptionInfo.ClientPointers = FALSE;
868 if (std::error_code EC = WriteWindowsDumpFile(&ExceptionInfo))
869 llvm::errs() <<
"Could not write crash dump file: " <<
EC.message()
877 memcpy(&ContextCopy, ep->ContextRecord,
sizeof(ContextCopy));
879 LocalPrintStackTrace(
llvm::errs(), ep ? &ContextCopy :
nullptr);
881 return EXCEPTION_EXECUTE_HANDLER;
884static BOOL WINAPI LLVMConsoleCtrlHandler(DWORD dwCtrlType) {
886 EnterCriticalSection(&CriticalSection);
894 void (*IF)() = InterruptFunction;
895 InterruptFunction = 0;
901 LeaveCriticalSection(&CriticalSection);
906 LeaveCriticalSection(&CriticalSection);
915#pragma GCC diagnostic warning "-Wformat"
916#pragma GCC diagnostic warning "-Wformat-extra-args"
919void 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)