Skip to content

Commit d52d3ad

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. (cherry picked from commit 982a77b)
1 parent fd2418a commit d52d3ad

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
@@ -248,6 +248,9 @@ class Generator final {
248248
/// Enable or disable auto generate.
249249
void SetAutoGenerate(bool b);
250250

251+
/// Return whether auto generate is enabled.
252+
bool IsAutoGenerate() const;
253+
251254
/// Create and register a new provider.
252255
template <typename T> T *Create() {
253256
std::unique_ptr<ProviderBase> provider = llvm::make_unique<T>(m_root);

lldb/lit/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

lldb/source/Commands/CommandObjectReproducer.cpp

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

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

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() {

0 commit comments

Comments
 (0)