#include "lldb/Utility/FileSpec.h"
#include "llvm/ADT/DenseMap.h"
+#include "llvm/ADT/StringRef.h"
#include "llvm/Support/Error.h"
#include "llvm/Support/FileCollector.h"
#include "llvm/Support/YAMLTraits.h"
}
void Update(llvm::StringRef path) { m_cwd = std::string(path); }
+ llvm::StringRef GetWorkingDirectory() { return m_cwd; }
struct Info {
static const char *name;
void SBReproducer::SetWorkingDirectory(const char *path) {
if (auto *g = lldb_private::repro::Reproducer::Instance().GetGenerator()) {
- g->GetOrCreate<WorkingDirectoryProvider>().Update(path);
+ auto &wp = g->GetOrCreate<repro::WorkingDirectoryProvider>();
+ wp.Update(path);
+ auto &fp = g->GetOrCreate<repro::FileProvider>();
+ fp.RecordInterestingDirectory(wp.GetWorkingDirectory());
}
}
vp.SetVersion(lldb_private::GetVersion());
repro::FileProvider &fp = g->GetOrCreate<repro::FileProvider>();
FileSystem::Initialize(fp.GetFileCollector());
+ repro::WorkingDirectoryProvider &wp = g->GetOrCreate<repro::WorkingDirectoryProvider>();
+ fp.RecordInterestingDirectory(wp.GetWorkingDirectory());
} else {
FileSystem::Initialize();
}
# RUN: cat %t.repro/cwd.txt | FileCheck %t.check
# RUN: %lldb --replay %t.repro | FileCheck %t.check
+
+# Make sure the current working directory is recorded even when it's not
+# referenced.
+
+# RUN: rm -rf %t.repro
+# RUN: mkdir -p %t/probably_unique
+# RUN: cd %t/probably_unique
+# RUN: %lldb -x -b -o 'reproducer generate' --capture --capture-path %t.repro
+# RUN: cat %t.repro/cwd.txt | FileCheck %s
+# CHECK: probably_unique