aboutsummaryrefslogtreecommitdiffstats
path: root/source/Initialization/SystemInitializerCommon.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/Initialization/SystemInitializerCommon.cpp')
-rw-r--r--source/Initialization/SystemInitializerCommon.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/source/Initialization/SystemInitializerCommon.cpp b/source/Initialization/SystemInitializerCommon.cpp
index 8558911c2f4c..7ae8ef5d4d66 100644
--- a/source/Initialization/SystemInitializerCommon.cpp
+++ b/source/Initialization/SystemInitializerCommon.cpp
@@ -25,6 +25,7 @@
#if defined(_WIN32)
#include "Plugins/Process/Windows/Common/ProcessWindowsLog.h"
#include "lldb/Host/windows/windows.h"
+#include <crtdbg.h>
#endif
#include "llvm/Support/TargetSelect.h"
@@ -77,6 +78,17 @@ llvm::Error SystemInitializerCommon::Initialize() {
} else {
FileSystem::Initialize();
}
+ if (llvm::Expected<std::string> cwd =
+ loader->LoadBuffer<WorkingDirectoryProvider>()) {
+ llvm::StringRef working_dir = llvm::StringRef(*cwd).rtrim();
+ if (std::error_code ec = FileSystem::Instance()
+ .GetVirtualFileSystem()
+ ->setCurrentWorkingDirectory(working_dir)) {
+ return llvm::errorCodeToError(ec);
+ }
+ } else {
+ return cwd.takeError();
+ }
} else if (repro::Generator *g = r.GetGenerator()) {
repro::VersionProvider &vp = g->GetOrCreate<repro::VersionProvider>();
vp.SetVersion(lldb_private::GetVersion());