r211876 - Driver: Pass -ivfsoverlay to module crashdumps

Justin Bogner mail at justinbogner.com
Thu Jun 26 23:35:06 PDT 2014


Author: bogner
Date: Fri Jun 27 01:35:05 2014
New Revision: 211876

URL: http://llvm.org/viewvc/llvm-project?rev=211876&view=rev
Log:
Driver: Pass -ivfsoverlay to module crashdumps

When we create a crashdump involving modules, we build a VFS to
reproduce the problem with. This updates the reproduction script to
use that VFS.

Modified:
    cfe/trunk/lib/Driver/Driver.cpp
    cfe/trunk/test/Driver/crash-report-modules.m

Modified: cfe/trunk/lib/Driver/Driver.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Driver.cpp?rev=211876&r1=211875&r2=211876&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Driver.cpp (original)
+++ cfe/trunk/lib/Driver/Driver.cpp Fri Jun 27 01:35:05 2014
@@ -522,9 +522,13 @@ void Driver::generateCompilationDiagnost
       std::string Script = StringRef(*it).rsplit('.').first;
       // In some cases (modules) we'll dump extra data to help with reproducing
       // the crash into a directory next to the output.
-      if (llvm::sys::fs::exists(Script + ".cache"))
+      SmallString<128> VFS;
+      if (llvm::sys::fs::exists(Script + ".cache")) {
         Diag(clang::diag::note_drv_command_failed_diag_msg)
             << Script + ".cache";
+        VFS = llvm::sys::path::filename(Script + ".cache");
+        llvm::sys::path::append(VFS, "vfs", "vfs.yaml");
+      }
 
       std::string Err;
       Script += ".sh";
@@ -546,6 +550,9 @@ void Driver::generateCompilationDiagnost
         E = I + OldFilename.size();
         I = Cmd.rfind(" ", I) + 1;
         Cmd.replace(I, E - I, NewFilename.data(), NewFilename.size());
+        // Add the VFS overlay to the reproduction script.
+        I += NewFilename.size();
+        Cmd.insert(I, std::string(" -ivfsoverlay ") + VFS.c_str());
         ScriptOS << Cmd;
         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=211876&r1=211875&r2=211876&view=diff
==============================================================================
--- cfe/trunk/test/Driver/crash-report-modules.m (original)
+++ cfe/trunk/test/Driver/crash-report-modules.m Fri Jun 27 01:35:05 2014
@@ -28,3 +28,5 @@ const int x = MODULE_MACRO;
 // CHECKSH: -cc1
 // CHECKSH: -D "FOO=BAR"
 // CHECKSH-NOT: -fmodules-cache-path=/tmp/
+// CHECKSH: crash-report-modules-{{[^ ]*}}.m
+// CHECKSH: -ivfsoverlay crash-report-modules-{{[^ ]*}}.cache/vfs/vfs.yaml





More information about the cfe-commits mailing list