r212481 - Driver: Produce crash diagnostics more often on Windows

Reid Kleckner reid at kleckner.net
Mon Jul 7 13:23:27 PDT 2014


Author: rnk
Date: Mon Jul  7 15:23:27 2014
New Revision: 212481

URL: http://llvm.org/viewvc/llvm-project?rev=212481&view=rev
Log:
Driver: Produce crash diagnostics more often on Windows

Assertion failures call abort(), which return an exit code of 3 on
Windows.  The 'not' utility has the same check.

Unfortunately, the crash-report.c test requires a shell, so it does not
run for me locally, so I can only test this manually.

There's still more work to be done here: we should generate a batch
script instead of a shell script on Windows.

Modified:
    cfe/trunk/tools/driver/driver.cpp

Modified: cfe/trunk/tools/driver/driver.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/driver/driver.cpp?rev=212481&r1=212480&r2=212481&view=diff
==============================================================================
--- cfe/trunk/tools/driver/driver.cpp (original)
+++ cfe/trunk/tools/driver/driver.cpp Mon Jul  7 15:23:27 2014
@@ -433,8 +433,13 @@ int main(int argc_, const char **argv_)
 
     // If result status is < 0, then the driver command signalled an error.
     // If result status is 70, then the driver command reported a fatal error.
-    // In these cases, generate additional diagnostic information if possible.
-    if (CommandRes < 0 || CommandRes == 70) {
+    // On Windows, abort will return an exit code of 3.  In these cases,
+    // generate additional diagnostic information if possible.
+    bool DiagnoseCrash = CommandRes < 0 || CommandRes == 70;
+#ifdef LLVM_ON_WIN32
+    DiagnoseCrash |= CommandRes == 3;
+#endif
+    if (DiagnoseCrash) {
       TheDriver.generateCompilationDiagnostics(*C, FailingCommand);
       break;
     }





More information about the cfe-commits mailing list