[Lldb-commits] [lldb] r375146 - [Reproducer] Surface error if setting the cwd fails

Jonas Devlieghere via lldb-commits lldb-commits at lists.llvm.org
Thu Oct 17 10:58:44 PDT 2019


Author: jdevlieghere
Date: Thu Oct 17 10:58:44 2019
New Revision: 375146

URL: http://llvm.org/viewvc/llvm-project?rev=375146&view=rev
Log:
[Reproducer] Surface error if setting the cwd fails

Make sure that we surface an error if setting the current working
directory fails during replay.

Modified:
    lldb/trunk/source/Initialization/SystemInitializerCommon.cpp

Modified: lldb/trunk/source/Initialization/SystemInitializerCommon.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Initialization/SystemInitializerCommon.cpp?rev=375146&r1=375145&r2=375146&view=diff
==============================================================================
--- lldb/trunk/source/Initialization/SystemInitializerCommon.cpp (original)
+++ lldb/trunk/source/Initialization/SystemInitializerCommon.cpp Thu Oct 17 10:58:44 2019
@@ -80,8 +80,13 @@ llvm::Error SystemInitializerCommon::Ini
     }
     if (llvm::Expected<std::string> cwd =
             loader->LoadBuffer<WorkingDirectoryProvider>()) {
-      FileSystem::Instance().GetVirtualFileSystem()->setCurrentWorkingDirectory(
-          *cwd);
+      cwd->erase(std::remove_if(cwd->begin(), cwd->end(), std::iscntrl),
+                 cwd->end());
+      if (std::error_code ec = FileSystem::Instance()
+                                   .GetVirtualFileSystem()
+                                   ->setCurrentWorkingDirectory(*cwd)) {
+        return llvm::errorCodeToError(ec);
+      }
     } else {
       return cwd.takeError();
     }




More information about the lldb-commits mailing list