]> granicus.if.org Git - clang/commitdiff
Driver: Print the clang version and original command in crash scripts
authorJustin Bogner <mail@justinbogner.com>
Thu, 12 Mar 2015 00:14:35 +0000 (00:14 +0000)
committerJustin Bogner <mail@justinbogner.com>
Thu, 12 Mar 2015 00:14:35 +0000 (00:14 +0000)
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

lib/Driver/Driver.cpp
test/Driver/crash-report-modules.m
test/Driver/crash-report.c

index a0c9233dd549ddb79056c466746de61b3af4e6a4..509f37904a7f9827680f64bcf3c6faf89c682fae 100644 (file)
@@ -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;
   }
index 84b16044486b2e600df91be1e8cb0b13357610e0..dab92311e7164a5a2467ba1a0705615b3f8b5731 100644 (file)
@@ -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"
index 3370da88692fab3cd1b2aef899ff229478da8625..5caad79f192bd7cb946454bb898dc3db147063f0 100644 (file)
@@ -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/"