Author: Jonas Devlieghere Date: 2020-01-15T20:25:44-08:00 New Revision: 982a77b69408d6d54526b331046b4508a68ef459
URL: https://github.com/llvm/llvm-project/commit/982a77b69408d6d54526b331046b4508a68ef459 DIFF: https://github.com/llvm/llvm-project/commit/982a77b69408d6d54526b331046b4508a68ef459.diff LOG: [lldb/Reproducers] Print more info for reproducer status Reproducer status now prints the capture/replay path. It will also print the status of auto generation when enabled. Added: Modified: lldb/include/lldb/Utility/Reproducer.h lldb/source/Commands/CommandObjectReproducer.cpp lldb/source/Utility/Reproducer.cpp lldb/test/Shell/Reproducer/TestDriverOptions.test Removed: ################################################################################ diff --git a/lldb/include/lldb/Utility/Reproducer.h b/lldb/include/lldb/Utility/Reproducer.h index 0524bcf6b24d..873ec3c76b52 100644 --- a/lldb/include/lldb/Utility/Reproducer.h +++ b/lldb/include/lldb/Utility/Reproducer.h @@ -234,6 +234,9 @@ class Generator final { /// Enable or disable auto generate. void SetAutoGenerate(bool b); + /// Return whether auto generate is enabled. + bool IsAutoGenerate() const; + /// Create and register a new provider. template <typename T> T *Create() { std::unique_ptr<ProviderBase> provider = std::make_unique<T>(m_root); diff --git a/lldb/source/Commands/CommandObjectReproducer.cpp b/lldb/source/Commands/CommandObjectReproducer.cpp index d15f622314d9..52c42a7336a4 100644 --- a/lldb/source/Commands/CommandObjectReproducer.cpp +++ b/lldb/source/Commands/CommandObjectReproducer.cpp @@ -258,6 +258,18 @@ class CommandObjectReproducerStatus : public CommandObjectParsed { result.GetOutputStream() << "Reproducer is off.\n"; } + if (r.IsCapturing() || r.IsReplaying()) { + result.GetOutputStream() + << "Path: " << r.GetReproducerPath().GetPath() << '\n'; + } + + // Auto generate is hidden unless enabled because this is mostly for + // development and testing. + if (Generator *g = r.GetGenerator()) { + if (g->IsAutoGenerate()) + result.GetOutputStream() << "Auto generate: on\n"; + } + result.SetStatus(eReturnStatusSuccessFinishResult); return result.Succeeded(); } diff --git a/lldb/source/Utility/Reproducer.cpp b/lldb/source/Utility/Reproducer.cpp index 8957763b7fd5..8987cfdac556 100644 --- a/lldb/source/Utility/Reproducer.cpp +++ b/lldb/source/Utility/Reproducer.cpp @@ -205,6 +205,8 @@ void Generator::Discard() { void Generator::SetAutoGenerate(bool b) { m_auto_generate = b; } +bool Generator::IsAutoGenerate() const { return m_auto_generate; } + const FileSpec &Generator::GetRoot() const { return m_root; } void Generator::AddProvidersToIndex() { diff --git a/lldb/test/Shell/Reproducer/TestDriverOptions.test b/lldb/test/Shell/Reproducer/TestDriverOptions.test index e249a401d15b..8bc8288e2e5f 100644 --- a/lldb/test/Shell/Reproducer/TestDriverOptions.test +++ b/lldb/test/Shell/Reproducer/TestDriverOptions.test @@ -10,15 +10,17 @@ # # RUN: %lldb --capture --capture-path %t.repro -b -o 'reproducer status' 2>&1 | FileCheck %s --check-prefix NO-WARNING --check-prefix STATUS-CAPTURE # RUN: %lldb --capture -b -o 'reproducer status' 2>&1 | FileCheck %s --check-prefix NO-WARNING --check-prefix STATUS-CAPTURE -# RUN: %lldb --capture-path %t.repro -b -o 'reproducer status' 2>&1 | FileCheck %s --check-prefix WARNING --check-prefix STATUS-CAPTURE +# RUN: %lldb --capture-path %t.repro -b -o 'reproducer status' 2>&1 | FileCheck %s --check-prefix WARNING --check-prefix STATUS-CAPTURE --check-prefix NOAUTOGEN # RUN: %lldb --capture-path %t.repro -b -o 'reproducer status' --reproducer-auto-generate 2>&1 | FileCheck %s --check-prefix WARNING2 # # NO-WARNING-NOT: warning: -capture-path specified without -capture # WARNING: warning: -capture-path specified without -capture # WARNING2: warning: -reproducer-auto-generate specified without -capture # STATUS-CAPTURE: Reproducer is in capture mode. +# NOAUTOGEN-NOT: Auto generate # Check auto generate. # RUN: rm -rf %t.repro -# RUN: %lldb --capture --capture-path %t.repro -b --reproducer-auto-generate -o 'reproducer status' 2>&1 | FileCheck %s --check-prefix NO-WARNING +# RUN: %lldb --capture --capture-path %t.repro -b --reproducer-auto-generate -o 'reproducer status' 2>&1 | FileCheck %s --check-prefix NO-WARNING --check-prefix AUTOGEN # RUN: cat %t.repro/index.yaml +# AUTOGEN: Auto generate: on _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits