If lldb was run in capture mode, but no reproducer was generated, make
sure we clean up the reproducer directory.
FileSpec m_root;
/// Flag to ensure that we never call both keep and discard.
- bool m_done;
+ bool m_done = false;
};
class Loader final {
return FileSpec(path, file_spec.GetPathStyle());
}
-Generator::Generator(FileSpec root)
- : m_root(MakeAbsolute(std::move(root))), m_done(false) {
+Generator::Generator(FileSpec root) : m_root(MakeAbsolute(std::move(root))) {
GetOrCreate<repro::WorkingDirectoryProvider>();
}
-Generator::~Generator() {}
+Generator::~Generator() {
+ if (!m_done)
+ Discard();
+}
ProviderBase *Generator::Register(std::unique_ptr<ProviderBase> provider) {
std::lock_guard<std::mutex> lock(m_providers_mutex);
--- /dev/null
+breakpoint set -f simple.c -l 12
+run
+bt
+cont
+reproducer status
--- /dev/null
+# UNSUPPORTED: system-windows
+# This ensures that the reproducer properly cleans up after itself.
+
+# Build the inferior.
+# RUN: mkdir -p %t
+# RUN: rm -rf %t.repro
+# RUN: %clang_host %S/Inputs/simple.c -g -o %t/reproducer.out
+
+# Capture but don't generate the reproducer.
+# RUN: %lldb -x -b -s %S/Inputs/Discard.in --capture --capture-path %t.repro %t/reproducer.out
+
+# Make sure the directory doesn't exist.
+# RUN: mkdir %t.repro