From: Justin Bogner Date: Thu, 12 Mar 2015 00:14:35 +0000 (+0000) Subject: Driver: Print the clang version and original command in crash scripts X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=08f212bd342478e6b099591c8ee3fdcb0406de30;p=clang Driver: Print the clang version and original command in crash scripts When a crash report script doesn't work for a reproduction on your machine for one reason or another, it can be really tricky to figure out why not. The compiler version that crashed and the original command line before stripping flags are very helpful when this comes up. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@231989 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Driver/Driver.cpp b/lib/Driver/Driver.cpp index a0c9233dd5..509f37904a 100644 --- a/lib/Driver/Driver.cpp +++ b/lib/Driver/Driver.cpp @@ -551,6 +551,9 @@ void Driver::generateCompilationDiagnostics(Compilation &C, Diag(clang::diag::note_drv_command_failed_diag_msg) << "Error generating run script: " + Script + " " + EC.message(); } else { + ScriptOS << "# Crash reproducer for " << getClangFullVersion() << "\n" + << "# Original command: "; + Cmd.Print(ScriptOS, "\n", /*Quote=*/true); Cmd.Print(ScriptOS, "\n", /*Quote=*/true, &CrashInfo); Diag(clang::diag::note_drv_command_failed_diag_msg) << Script; } diff --git a/test/Driver/crash-report-modules.m b/test/Driver/crash-report-modules.m index 84b1604448..dab92311e7 100644 --- a/test/Driver/crash-report-modules.m +++ b/test/Driver/crash-report-modules.m @@ -25,7 +25,9 @@ const int x = MODULE_MACRO; // CHECKSRC: @import simple; // CHECKSRC: const int x = 10; -// CHECKSH: "-cc1" +// CHECKSH: # Crash reproducer +// CHECKSH-NEXT: # Original command: {{.*$}} +// CHECKSH-NEXT: "-cc1" // CHECKSH: "-D" "FOO=BAR" // CHECKSH-NOT: "-fmodules-cache-path=/tmp/" // CHECKSH: "crash-report-modules-{{[^ ]*}}.m" diff --git a/test/Driver/crash-report.c b/test/Driver/crash-report.c index 3370da8869..5caad79f19 100644 --- a/test/Driver/crash-report.c +++ b/test/Driver/crash-report.c @@ -18,7 +18,9 @@ // CHECK-NEXT: note: diagnostic msg: {{.*}}crash-report-{{.*}}.c FOO // CHECKSRC: FOO -// CHECKSH: "-cc1" +// CHECKSH: # Crash reproducer +// CHECKSH-NEXT: # Original command: {{.*$}} +// CHECKSH-NEXT: "-cc1" // CHECKSH: "-main-file-name" "crash-report.c" // CHECKSH: "-D" "FOO=BAR" // CHECKSH-NOT: "-F/tmp/"