[PATCH] D99199: Make -fcrash-diagnostics-dir control the Windows (mini-)dump location
Paul Robinson via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 6 09:35:39 PDT 2021
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG04b3c8c52c54: Pass -fcrash-diagnostics-dir along to LLVM (authored by probinson).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D99199/new/
https://reviews.llvm.org/D99199
Files:
clang/lib/Driver/ToolChains/Clang.cpp
clang/test/Driver/crash-diagnostics-dir-2.c
llvm/lib/Support/Signals.cpp
llvm/lib/Support/Windows/Signals.inc
Index: llvm/lib/Support/Windows/Signals.inc
===================================================================
--- llvm/lib/Support/Windows/Signals.inc
+++ llvm/lib/Support/Windows/Signals.inc
@@ -766,16 +766,18 @@
if (!GetDumpType(DefaultLocalDumpsKey, DumpType))
DumpType = MiniDumpNormal;
- // Look to see if a dump location is specified in the registry; first with the
+ // Look to see if a dump location is specified on the command line. If not,
+ // look to see if a dump location is specified in the registry; first with the
// app-specific key and failing that with the global key. If none are found
// we'll just create the dump file in the default temporary file location
// (GetDumpFolder will return false either if the key is NULL or if there is
// no valid DumpFolder value at its location).
bool ExplicitDumpDirectorySet = true;
- SmallString<MAX_PATH> DumpDirectory;
- if (!GetDumpFolder(AppSpecificKey, DumpDirectory))
- if (!GetDumpFolder(DefaultLocalDumpsKey, DumpDirectory))
- ExplicitDumpDirectorySet = false;
+ SmallString<MAX_PATH> DumpDirectory(CrashDiagnosticsDirectory);
+ if (DumpDirectory.empty())
+ if (!GetDumpFolder(AppSpecificKey, DumpDirectory))
+ if (!GetDumpFolder(DefaultLocalDumpsKey, DumpDirectory))
+ ExplicitDumpDirectorySet = false;
int FD;
SmallString<MAX_PATH> DumpPath;
Index: llvm/lib/Support/Signals.cpp
===================================================================
--- llvm/lib/Support/Signals.cpp
+++ llvm/lib/Support/Signals.cpp
@@ -43,6 +43,11 @@
DisableSymbolication("disable-symbolication",
cl::desc("Disable symbolizing crash backtraces."),
cl::location(DisableSymbolicationFlag), cl::Hidden);
+static std::string CrashDiagnosticsDirectory;
+static cl::opt<std::string, true>
+ CrashDiagnosticsDir("crash-diagnostics-dir", cl::value_desc("directory"),
+ cl::desc("Directory for crash diagnostic files."),
+ cl::location(CrashDiagnosticsDirectory), cl::Hidden);
constexpr char DisableSymbolizationEnv[] = "LLVM_DISABLE_SYMBOLIZATION";
constexpr char LLVMSymbolizerPathEnv[] = "LLVM_SYMBOLIZER_PATH";
Index: clang/test/Driver/crash-diagnostics-dir-2.c
===================================================================
--- /dev/null
+++ clang/test/Driver/crash-diagnostics-dir-2.c
@@ -0,0 +1,5 @@
+// RUN: %clang -### -fcrash-diagnostics-dir=mydumps -c %s 2>&1 \
+// RUN: | FileCheck %s --check-prefix=OPTION
+// OPTION: "-crash-diagnostics-dir=mydumps"
+// RUN: %clang -### -c %s 2>&1 | FileCheck %s --check-prefix=NOOPTION
+// NOOPTION-NOT: "-crash-diagnostics-dir
Index: clang/lib/Driver/ToolChains/Clang.cpp
===================================================================
--- clang/lib/Driver/ToolChains/Clang.cpp
+++ clang/lib/Driver/ToolChains/Clang.cpp
@@ -5156,6 +5156,14 @@
if (D.CCGenDiagnostics)
CmdArgs.push_back("-disable-pragma-debug-crash");
+ // Allow backend to put its diagnostic files in the same place as frontend
+ // crash diagnostics files.
+ if (Args.hasArg(options::OPT_fcrash_diagnostics_dir)) {
+ StringRef Dir = Args.getLastArgValue(options::OPT_fcrash_diagnostics_dir);
+ CmdArgs.push_back("-mllvm");
+ CmdArgs.push_back(Args.MakeArgString("-crash-diagnostics-dir=" + Dir));
+ }
+
bool UseSeparateSections = isUseSeparateSections(Triple);
if (Args.hasFlag(options::OPT_ffunction_sections,
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D99199.335551.patch
Type: text/x-patch
Size: 3495 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210406/89741510/attachment.bin>
More information about the llvm-commits
mailing list