[Lldb-commits] [lldb] 31fa76f - [lldb] Check that files exists before handing them off to FileCollector

Jonas Devlieghere via lldb-commits lldb-commits at lists.llvm.org
Thu Feb 18 16:16:23 PST 2021


Author: Jonas Devlieghere
Date: 2021-02-18T16:16:15-08:00
New Revision: 31fa76fd24adea755e4368674a59385d2c5b0cc7

URL: https://github.com/llvm/llvm-project/commit/31fa76fd24adea755e4368674a59385d2c5b0cc7
DIFF: https://github.com/llvm/llvm-project/commit/31fa76fd24adea755e4368674a59385d2c5b0cc7.diff

LOG: [lldb] Check that files exists before handing them off to FileCollector

The FileCollector asserts that paths passed to addDirectory are indeed
directories. For that to work, the file needs to actually exist. In the
downstream Swift fork we have tests that remove files during testing,
which resulted in this assertion getting triggered.

Added: 
    

Modified: 
    lldb/source/Utility/Reproducer.cpp

Removed: 
    


################################################################################
diff  --git a/lldb/source/Utility/Reproducer.cpp b/lldb/source/Utility/Reproducer.cpp
index f302cce4436f..d9207b1eb49f 100644
--- a/lldb/source/Utility/Reproducer.cpp
+++ b/lldb/source/Utility/Reproducer.cpp
@@ -374,7 +374,7 @@ static llvm::Error addPaths(StringRef path,
   SmallVector<StringRef, 0> paths;
   (*buffer)->getBuffer().split(paths, '\0');
   for (StringRef p : paths) {
-    if (!p.empty())
+    if (!p.empty() && llvm::sys::fs::exists(p))
       callback(p);
   }
 


        


More information about the lldb-commits mailing list