r231989 - Driver: Print the clang version and original command in crash scripts

Robinson, Paul Paul_Robinson at playstation.sony.com
Thu Mar 12 07:43:13 PDT 2015


> -----Original Message-----
> From: Justin Bogner [mailto:justin at justinbogner.com] On Behalf Of Justin
> Bogner
> Sent: Wednesday, March 11, 2015 10:44 PM
> To: Robinson, Paul
> Cc: cfe-commits at cs.uiuc.edu
> Subject: Re: r231989 - Driver: Print the clang version and original
> command in crash scripts
> 
> "Robinson, Paul" <Paul_Robinson at playstation.sony.com> writes:
> >> -----Original Message-----
> >> From: cfe-commits-bounces at cs.uiuc.edu [mailto:cfe-commits-
> >> bounces at cs.uiuc.edu] On Behalf Of Justin Bogner
> >> Sent: Wednesday, March 11, 2015 5:15 PM
> >> To: cfe-commits at cs.uiuc.edu
> >> Subject: r231989 - Driver: Print the clang version and original command
> in
> >> crash scripts
> >>
> >> Author: bogner
> >> Date: Wed Mar 11 19:14:35 2015
> >> New Revision: 231989
> >>
> >> URL: http://llvm.org/viewvc/llvm-project?rev=231989&view=rev
> >> Log:
> >> 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.
> >>
> >> Modified:
> >>     cfe/trunk/lib/Driver/Driver.cpp
> >>     cfe/trunk/test/Driver/crash-report-modules.m
> >>     cfe/trunk/test/Driver/crash-report.c
> >>
> >> Modified: cfe/trunk/lib/Driver/Driver.cpp
> >> URL: http://llvm.org/viewvc/llvm-
> >>
> project/cfe/trunk/lib/Driver/Driver.cpp?rev=231989&r1=231988&r2=231989&vie
> >> w=diff
> >>
> ==========================================================================
> >> ====
> >> --- cfe/trunk/lib/Driver/Driver.cpp (original)
> >> +++ cfe/trunk/lib/Driver/Driver.cpp Wed Mar 11 19:14:35 2015
> >> @@ -551,6 +551,9 @@ void Driver::generateCompilationDiagnost
> >>      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;
> >>    }
> >>
> >> Modified: cfe/trunk/test/Driver/crash-report-modules.m
> >> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/crash-
> >> report-modules.m?rev=231989&r1=231988&r2=231989&view=diff
> >>
> ==========================================================================
> >> ====
> >> --- cfe/trunk/test/Driver/crash-report-modules.m (original)
> >> +++ cfe/trunk/test/Driver/crash-report-modules.m Wed Mar 11 19:14:35
> 2015
> >> @@ -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"
> >
> > I thought -NEXT did the equivalent of {{.*$}} for you?
> > Explicitly adding the regex seems harmless but makes me wonder if I'm
> > misunderstanding something.
> 
> Without the regex FileCheck complained that it found the -NEXT match on
> the same line. I guess this makes sense to check for in some other
> cases. I added the regex to make sure we read past the whole line.

Okay, that's a subtle aspect of -NEXT but makes sense. Thanks for
the explanation.

So the "Original command" would actually be the compiler command line,
not the driver command line.  If that was your intent, then okay.
--paulr

> 
> >>  // CHECKSH: "-D" "FOO=BAR"
> >>  // CHECKSH-NOT: "-fmodules-cache-path=/tmp/"
> >>  // CHECKSH: "crash-report-modules-{{[^ ]*}}.m"
> >>
> >> Modified: cfe/trunk/test/Driver/crash-report.c
> >> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/crash-
> >> report.c?rev=231989&r1=231988&r2=231989&view=diff
> >>
> ==========================================================================
> >> ====
> >> --- cfe/trunk/test/Driver/crash-report.c (original)
> >> +++ cfe/trunk/test/Driver/crash-report.c Wed Mar 11 19:14:35 2015
> >> @@ -18,7 +18,9 @@
> >>  // CHECK-NEXT: note: diagnostic msg: {{.*}}crash-report-{{.*}}.c
> >>  FOO
> >>  // CHECKSRC: FOO
> >> -// CHECKSH: "-cc1"
> >> +// CHECKSH: # Crash reproducer
> >> +// CHECKSH-NEXT: # Original command: {{.*$}}
> >
> > Ditto here.
> > Thanks,
> > --paulr
> >
> >> +// CHECKSH-NEXT: "-cc1"
> >>  // CHECKSH: "-main-file-name" "crash-report.c"
> >>  // CHECKSH: "-D" "FOO=BAR"
> >>  // CHECKSH-NOT: "-F/tmp/"
> >>
> >>
> >> _______________________________________________
> >> cfe-commits mailing list
> >> cfe-commits at cs.uiuc.edu
> >> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits




More information about the cfe-commits mailing list