summaryrefslogtreecommitdiff
path: root/source/Commands/CommandObjectReproducer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/Commands/CommandObjectReproducer.cpp')
-rw-r--r--source/Commands/CommandObjectReproducer.cpp45
1 files changed, 31 insertions, 14 deletions
diff --git a/source/Commands/CommandObjectReproducer.cpp b/source/Commands/CommandObjectReproducer.cpp
index f393f17d9aec..4b0e9e36d202 100644
--- a/source/Commands/CommandObjectReproducer.cpp
+++ b/source/Commands/CommandObjectReproducer.cpp
@@ -1,9 +1,8 @@
//===-- CommandObjectReproducer.cpp -----------------------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
@@ -22,8 +21,12 @@ using namespace lldb_private;
class CommandObjectReproducerGenerate : public CommandObjectParsed {
public:
CommandObjectReproducerGenerate(CommandInterpreter &interpreter)
- : CommandObjectParsed(interpreter, "reproducer generate",
- "Generate reproducer on disk.", nullptr) {}
+ : CommandObjectParsed(
+ interpreter, "reproducer generate",
+ "Generate reproducer on disk. When the debugger is in capture "
+ "mode, this command will output the reproducer to a directory on "
+ "disk. In replay mode this command in a no-op.",
+ nullptr) {}
~CommandObjectReproducerGenerate() override = default;
@@ -38,13 +41,21 @@ protected:
auto &r = repro::Reproducer::Instance();
if (auto generator = r.GetGenerator()) {
generator->Keep();
+ } else if (r.GetLoader()) {
+ // Make this operation a NOP in replay mode.
+ result.SetStatus(eReturnStatusSuccessFinishNoResult);
+ return result.Succeeded();
} else {
result.AppendErrorWithFormat("Unable to get the reproducer generator");
+ result.SetStatus(eReturnStatusFailed);
return false;
}
result.GetOutputStream()
<< "Reproducer written to '" << r.GetReproducerPath() << "'\n";
+ result.GetOutputStream()
+ << "Please have a look at the directory to assess if you're willing to "
+ "share the contained information.\n";
result.SetStatus(eReturnStatusSuccessFinishResult);
return result.Succeeded();
@@ -54,8 +65,14 @@ protected:
class CommandObjectReproducerStatus : public CommandObjectParsed {
public:
CommandObjectReproducerStatus(CommandInterpreter &interpreter)
- : CommandObjectParsed(interpreter, "reproducer status",
- "Show the current reproducer status.", nullptr) {}
+ : CommandObjectParsed(
+ interpreter, "reproducer status",
+ "Show the current reproducer status. In capture mode the debugger "
+ "is collecting all the information it needs to create a "
+ "reproducer. In replay mode the reproducer is replaying a "
+ "reproducer. When the reproducers are off, no data is collected "
+ "and no reproducer can be generated.",
+ nullptr) {}
~CommandObjectReproducerStatus() override = default;
@@ -68,12 +85,11 @@ protected:
}
auto &r = repro::Reproducer::Instance();
- if (auto generator = r.GetGenerator()) {
+ if (r.GetGenerator()) {
result.GetOutputStream() << "Reproducer is in capture mode.\n";
- } else if (auto generator = r.GetLoader()) {
+ } else if (r.GetLoader()) {
result.GetOutputStream() << "Reproducer is in replay mode.\n";
} else {
-
result.GetOutputStream() << "Reproducer is off.\n";
}
@@ -84,9 +100,10 @@ protected:
CommandObjectReproducer::CommandObjectReproducer(
CommandInterpreter &interpreter)
- : CommandObjectMultiword(interpreter, "reproducer",
- "Commands controlling LLDB reproducers.",
- "log <subcommand> [<command-options>]") {
+ : CommandObjectMultiword(
+ interpreter, "reproducer",
+ "Commands to inspect and manipulate the reproducer functionality.",
+ "log <subcommand> [<command-options>]") {
LoadSubCommand(
"generate",
CommandObjectSP(new CommandObjectReproducerGenerate(interpreter)));