[Lldb-commits] [lldb] r346919 - [reproducer] Post-commit cleanup

Jonas Devlieghere via lldb-commits lldb-commits at lists.llvm.org
Wed Nov 14 17:05:40 PST 2018


Author: jdevlieghere
Date: Wed Nov 14 17:05:40 2018
New Revision: 346919

URL: http://llvm.org/viewvc/llvm-project?rev=346919&view=rev
Log:
[reproducer] Post-commit cleanup

After committing the initial reproducer feature I noticed a few small
issues which warranted addressing here. It fixes incorrect documentation
in the command object and extract some duplicated code into the debugger
object.

Modified:
    lldb/trunk/include/lldb/Core/Debugger.h
    lldb/trunk/source/Commands/CommandObjectReproducer.cpp
    lldb/trunk/source/Core/Debugger.cpp

Modified: lldb/trunk/include/lldb/Core/Debugger.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/Debugger.h?rev=346919&r1=346918&r2=346919&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/Debugger.h (original)
+++ lldb/trunk/include/lldb/Core/Debugger.h Wed Nov 14 17:05:40 2018
@@ -266,6 +266,8 @@ public:
   void SetReproducerPath(llvm::StringRef p);
   void SetReproducerPath(const char *) = delete;
 
+  llvm::Error SetReproducerCapture(bool b);
+
   bool GetUseExternalEditor() const;
 
   bool SetUseExternalEditor(bool use_external_editor_p);

Modified: lldb/trunk/source/Commands/CommandObjectReproducer.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectReproducer.cpp?rev=346919&r1=346918&r2=346919&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectReproducer.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectReproducer.cpp Wed Nov 14 17:05:40 2018
@@ -11,6 +11,7 @@
 
 #include "lldb/Utility/Reproducer.h"
 
+#include "lldb/Interpreter/CommandInterpreter.h"
 #include "lldb/Interpreter/CommandReturnObject.h"
 #include "lldb/Interpreter/OptionArgParser.h"
 #include "lldb/Interpreter/OptionGroupBoolean.h"
@@ -40,8 +41,7 @@ protected:
       return false;
     }
 
-    auto &r = repro::Reproducer::Instance();
-    if (auto e = r.SetGenerateReproducer(true)) {
+    if (auto e = m_interpreter.GetDebugger().SetReproducerCapture(true)) {
       AppendErrorToResult(std::move(e), result);
       return false;
     }
@@ -68,8 +68,7 @@ protected:
       return false;
     }
 
-    auto &r = repro::Reproducer::Instance();
-    if (auto e = r.SetGenerateReproducer(false)) {
+    if (auto e = m_interpreter.GetDebugger().SetReproducerCapture(false)) {
       AppendErrorToResult(std::move(e), result);
       return false;
     }
@@ -114,10 +113,8 @@ protected:
 class CommandObjectReproducerReplay : public CommandObjectParsed {
 public:
   CommandObjectReproducerReplay(CommandInterpreter &interpreter)
-      : CommandObjectParsed(interpreter, "reproducer capture",
-                            "Enable or disable gathering of information needed "
-                            "to generate a reproducer.",
-                            nullptr) {
+      : CommandObjectParsed(interpreter, "reproducer replay",
+                            "Replay a reproducer.", nullptr) {
     CommandArgumentEntry arg1;
     CommandArgumentData path_arg;
 

Modified: lldb/trunk/source/Core/Debugger.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Debugger.cpp?rev=346919&r1=346918&r2=346919&view=diff
==============================================================================
--- lldb/trunk/source/Core/Debugger.cpp (original)
+++ lldb/trunk/source/Core/Debugger.cpp Wed Nov 14 17:05:40 2018
@@ -424,6 +424,13 @@ void Debugger::SetReproducerPath(llvm::S
     llvm::consumeError(std::move(e));
 }
 
+llvm::Error Debugger::SetReproducerCapture(bool b) {
+  auto &r = repro::Reproducer::Instance();
+  if (auto e = r.SetGenerateReproducer(false))
+    return e;
+  return llvm::Error::success();
+}
+
 const FormatEntity::Entry *Debugger::GetThreadFormat() const {
   const uint32_t idx = ePropertyThreadFormat;
   return m_collection_sp->GetPropertyAtIndexAsFormatEntity(nullptr, idx);




More information about the lldb-commits mailing list