[Reproducer] Quit the debugger after generating a reproducer
authorJonas Devlieghere <jonas@devlieghere.com>
Mon, 11 Nov 2019 22:16:52 +0000 (14:16 -0800)
committerJonas Devlieghere <jonas@devlieghere.com>
Mon, 11 Nov 2019 22:29:53 +0000 (14:29 -0800)
Currently nothing prevents you from continuing your debug session after
generating the reproducer. This can cause the reproducer to end up in an
inconsistent state. Most of the time this doesn't matter, but I want to
prevent this from causing bugs in the future.

lldb/source/Commands/CommandObjectReproducer.cpp

index dc4579c..560df25 100644 (file)
@@ -78,7 +78,7 @@ public:
             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.",
+            "disk and quit. In replay mode this command in a no-op.",
             nullptr) {}
 
   ~CommandObjectReproducerGenerate() override = default;
@@ -110,7 +110,9 @@ protected:
         << "Please have a look at the directory to assess if you're willing to "
            "share the contained information.\n";
 
-    result.SetStatus(eReturnStatusSuccessFinishResult);
+    m_interpreter.BroadcastEvent(
+        CommandInterpreter::eBroadcastBitQuitCommandReceived);
+    result.SetStatus(eReturnStatusQuit);
     return result.Succeeded();
   }
 };