summaryrefslogtreecommitdiff
path: root/include/lldb/Utility/Reproducer.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/lldb/Utility/Reproducer.h')
-rw-r--r--include/lldb/Utility/Reproducer.h21
1 files changed, 21 insertions, 0 deletions
diff --git a/include/lldb/Utility/Reproducer.h b/include/lldb/Utility/Reproducer.h
index 7fde9c3e5..1bc8d7af0 100644
--- a/include/lldb/Utility/Reproducer.h
+++ b/include/lldb/Utility/Reproducer.h
@@ -132,6 +132,27 @@ public:
static char ID;
};
+/// Provider for the LLDB current working directroy.
+///
+/// When the reproducer is kept, it writes lldb's current working directory to
+/// a file named cwd.txt in the reproducer root.
+class WorkingDirectoryProvider : public Provider<WorkingDirectoryProvider> {
+public:
+ WorkingDirectoryProvider(const FileSpec &directory) : Provider(directory) {
+ llvm::SmallString<128> cwd;
+ if (std::error_code EC = llvm::sys::fs::current_path(cwd))
+ return;
+ m_cwd = cwd.str();
+ }
+ struct Info {
+ static const char *name;
+ static const char *file;
+ };
+ void Keep() override;
+ std::string m_cwd;
+ static char ID;
+};
+
class DataRecorder {
public:
DataRecorder(const FileSpec &filename, std::error_code &ec)