From db5f8b25707a23dd5852a35539775f7e8cf8896e Mon Sep 17 00:00:00 2001 From: Justin Bogner Date: Fri, 27 Jun 2014 06:35:05 +0000 Subject: 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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@211876 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Driver/Driver.cpp | 9 ++++++++- test/Driver/crash-report-modules.m | 2 ++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/lib/Driver/Driver.cpp b/lib/Driver/Driver.cpp index e3b53a9983..a18312a84f 100644 --- a/lib/Driver/Driver.cpp +++ b/lib/Driver/Driver.cpp @@ -522,9 +522,13 @@ void Driver::generateCompilationDiagnostics(Compilation &C, 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::generateCompilationDiagnostics(Compilation &C, 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; } diff --git a/test/Driver/crash-report-modules.m b/test/Driver/crash-report-modules.m index ff805ed453..d1c7832019 100644 --- a/test/Driver/crash-report-modules.m +++ b/test/Driver/crash-report-modules.m @@ -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 -- cgit v1.2.3