Skip to content

Commit 982a77b

Browse files
committed
[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.
1 parent cc5efa2 commit 982a77b

File tree

4 files changed

+21
-2
lines changed

4 files changed

+21
-2
lines changed

lldb/include/lldb/Utility/Reproducer.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,9 @@ class Generator final {
234234
/// Enable or disable auto generate.
235235
void SetAutoGenerate(bool b);
236236

237+
/// Return whether auto generate is enabled.
238+
bool IsAutoGenerate() const;
239+
237240
/// Create and register a new provider.
238241
template <typename T> T *Create() {
239242
std::unique_ptr<ProviderBase> provider = std::make_unique<T>(m_root);

lldb/source/Commands/CommandObjectReproducer.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,18 @@ class CommandObjectReproducerStatus : public CommandObjectParsed {
258258
result.GetOutputStream() << "Reproducer is off.\n";
259259
}
260260

261+
if (r.IsCapturing() || r.IsReplaying()) {
262+
result.GetOutputStream()
263+
<< "Path: " << r.GetReproducerPath().GetPath() << '\n';
264+
}
265+
266+
// Auto generate is hidden unless enabled because this is mostly for
267+
// development and testing.
268+
if (Generator *g = r.GetGenerator()) {
269+
if (g->IsAutoGenerate())
270+
result.GetOutputStream() << "Auto generate: on\n";
271+
}
272+
261273
result.SetStatus(eReturnStatusSuccessFinishResult);
262274
return result.Succeeded();
263275
}

lldb/source/Utility/Reproducer.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,8 @@ void Generator::Discard() {
205205

206206
void Generator::SetAutoGenerate(bool b) { m_auto_generate = b; }
207207

208+
bool Generator::IsAutoGenerate() const { return m_auto_generate; }
209+
208210
const FileSpec &Generator::GetRoot() const { return m_root; }
209211

210212
void Generator::AddProvidersToIndex() {

lldb/test/Shell/Reproducer/TestDriverOptions.test

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,17 @@
1010
#
1111
# RUN: %lldb --capture --capture-path %t.repro -b -o 'reproducer status' 2>&1 | FileCheck %s --check-prefix NO-WARNING --check-prefix STATUS-CAPTURE
1212
# RUN: %lldb --capture -b -o 'reproducer status' 2>&1 | FileCheck %s --check-prefix NO-WARNING --check-prefix STATUS-CAPTURE
13-
# RUN: %lldb --capture-path %t.repro -b -o 'reproducer status' 2>&1 | FileCheck %s --check-prefix WARNING --check-prefix STATUS-CAPTURE
13+
# RUN: %lldb --capture-path %t.repro -b -o 'reproducer status' 2>&1 | FileCheck %s --check-prefix WARNING --check-prefix STATUS-CAPTURE --check-prefix NOAUTOGEN
1414
# RUN: %lldb --capture-path %t.repro -b -o 'reproducer status' --reproducer-auto-generate 2>&1 | FileCheck %s --check-prefix WARNING2
1515
#
1616
# NO-WARNING-NOT: warning: -capture-path specified without -capture
1717
# WARNING: warning: -capture-path specified without -capture
1818
# WARNING2: warning: -reproducer-auto-generate specified without -capture
1919
# STATUS-CAPTURE: Reproducer is in capture mode.
20+
# NOAUTOGEN-NOT: Auto generate
2021

2122
# Check auto generate.
2223
# RUN: rm -rf %t.repro
23-
# RUN: %lldb --capture --capture-path %t.repro -b --reproducer-auto-generate -o 'reproducer status' 2>&1 | FileCheck %s --check-prefix NO-WARNING
24+
# 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
2425
# RUN: cat %t.repro/index.yaml
26+
# AUTOGEN: Auto generate: on

0 commit comments

Comments
 (0)