Lines Matching +full:string +full:- +full:support
1 //===- Signals.cpp - Signal Handling support --------------------*- C++ -*-===//
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
12 //===----------------------------------------------------------------------===//
14 #include "llvm/Support/Signals.h"
19 #include "llvm/Config/llvm-config.h"
20 #include "llvm/Support/CommandLine.h"
21 #include "llvm/Support/ErrorOr.h"
22 #include "llvm/Support/FileSystem.h"
23 #include "llvm/Support/FileUtilities.h"
24 #include "llvm/Support/Format.h"
25 #include "llvm/Support/FormatVariadic.h"
26 #include "llvm/Support/ManagedStatic.h"
27 #include "llvm/Support/MemoryBuffer.h"
28 #include "llvm/Support/Path.h"
29 #include "llvm/Support/Program.h"
30 #include "llvm/Support/StringSaver.h"
31 #include "llvm/Support/raw_ostream.h"
36 //===----------------------------------------------------------------------===//
39 //===----------------------------------------------------------------------===//
45 static ManagedStatic<std::string> CrashDiagnosticsDirectory;
50 "disable-symbolication",
57 return new cl::opt<std::string, true>(
58 "crash-diagnostics-dir", cl::value_desc("directory"),
67 static ManagedStatic<cl::opt<std::string, true>, CreateCrashDiagnosticsDir>
77 // Callbacks to run in signal handler must be lock-free because a signal handler
90 // -Werror=global-constructors in c++20 and above
97 // Signal-safe.
111 // Signal-safe.
140 /// Helper that launches llvm-symbolizer and symbolizes a backtrace.
147 // Don't recursively invoke the llvm-symbolizer binary.
148 if (Argv0.contains("llvm-symbolizer"))
153 // Use llvm-symbolizer tool to symbolize the stack traces. First look for it
155 ErrorOr<std::string> LLVMSymbolizerPathOrErr = std::error_code();
161 LLVMSymbolizerPathOrErr = sys::findProgramByName("llvm-symbolizer", Parent);
164 LLVMSymbolizerPathOrErr = sys::findProgramByName("llvm-symbolizer");
167 const std::string &LLVMSymbolizerPath = *LLVMSymbolizerPathOrErr;
171 std::string MainExecutableName =
172 sys::fs::exists(Argv0) ? (std::string)std::string(Argv0)
183 sys::fs::createTemporaryFile("symbolizer-input", "", InputFD, InputFile);
184 sys::fs::createTemporaryFile("symbolizer-output", "", OutputFile);
198 StringRef Args[] = {"llvm-symbolizer", "--functions=linkage", "--inlining",
200 // Pass --relative-address on Windows so that we don't
202 // FIXME: Make this the default for llvm-symbolizer.
203 "--relative-address",
205 "--demangle"};
212 // sanitizer_stacktrace_printer.cc in compiler-rt.
216 StringRef Output = OutputBuf.get()->getBuffer();
265 std::string MainExecutableName =
266 sys::fs::exists(Argv0) ? std::string(Argv0)
275 // Include the platform-specific parts of this class.