JDevlieghere updated this revision to Diff 260978.
JDevlieghere added a comment.

Add reproducer instrumentation.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D79108/new/

https://reviews.llvm.org/D79108

Files:
  lldb/include/lldb/API/SBCommandInterpreter.h
  lldb/include/lldb/Interpreter/CommandInterpreter.h
  lldb/source/API/SBCommandInterpreter.cpp
  lldb/source/API/SBDebugger.cpp
  lldb/source/Interpreter/CommandInterpreter.cpp

Index: lldb/source/Interpreter/CommandInterpreter.cpp
===================================================================
--- lldb/source/Interpreter/CommandInterpreter.cpp
+++ lldb/source/Interpreter/CommandInterpreter.cpp
@@ -2951,7 +2951,6 @@
 }
 
 void CommandInterpreter::RunCommandInterpreter(
-    bool auto_handle_events, bool spawn_thread,
     CommandInterpreterRunOptions &options) {
   // Always re-create the command interpreter when we run it in case any file
   // handles have changed.
@@ -2959,15 +2958,15 @@
   m_debugger.RunIOHandlerAsync(GetIOHandler(force_create, &options));
   m_stopped_for_crash = false;
 
-  if (auto_handle_events)
+  if (options.GetAutoHandleEvents())
     m_debugger.StartEventHandlerThread();
 
-  if (spawn_thread) {
+  if (options.GetSpawnThread()) {
     m_debugger.StartIOHandlerThread();
   } else {
     m_debugger.RunIOHandlers();
 
-    if (auto_handle_events)
+    if (options.GetAutoHandleEvents())
       m_debugger.StopEventHandlerThread();
   }
 }
Index: lldb/source/API/SBDebugger.cpp
===================================================================
--- lldb/source/API/SBDebugger.cpp
+++ lldb/source/API/SBDebugger.cpp
@@ -1166,9 +1166,9 @@
 
   if (m_opaque_sp) {
     CommandInterpreterRunOptions options;
-
-    m_opaque_sp->GetCommandInterpreter().RunCommandInterpreter(
-        auto_handle_events, spawn_thread, options);
+    options.SetAutoHandleEvents(auto_handle_events);
+    options.SetSpawnThread(spawn_thread);
+    m_opaque_sp->GetCommandInterpreter().RunCommandInterpreter(options);
   }
 }
 
@@ -1186,9 +1186,10 @@
                      quit_requested, stopped_for_crash);
 
   if (m_opaque_sp) {
+    options.SetAutoHandleEvents(auto_handle_events);
+    options.SetSpawnThread(spawn_thread);
     CommandInterpreter &interp = m_opaque_sp->GetCommandInterpreter();
-    interp.RunCommandInterpreter(auto_handle_events, spawn_thread,
-                                 options.ref());
+    interp.RunCommandInterpreter(options.ref());
     num_errors = interp.GetNumErrors();
     quit_requested = interp.GetQuitRequested();
     stopped_for_crash = interp.GetStoppedForCrash();
Index: lldb/source/API/SBCommandInterpreter.cpp
===================================================================
--- lldb/source/API/SBCommandInterpreter.cpp
+++ lldb/source/API/SBCommandInterpreter.cpp
@@ -137,6 +137,35 @@
   m_opaque_up->SetAddToHistory(add_to_history);
 }
 
+bool SBCommandInterpreterRunOptions::GetAutoHandleEvents() const {
+  LLDB_RECORD_METHOD_CONST_NO_ARGS(bool, SBCommandInterpreterRunOptions,
+                                   GetAutoHandleEvents);
+
+  return m_opaque_up->GetAutoHandleEvents();
+}
+
+void SBCommandInterpreterRunOptions::SetAutoHandleEvents(
+    bool auto_handle_events) {
+  LLDB_RECORD_METHOD(void, SBCommandInterpreterRunOptions, SetAutoHandleEvents,
+                     (bool), auto_handle_events);
+
+  m_opaque_up->SetAutoHandleEvents(auto_handle_events);
+}
+
+bool SBCommandInterpreterRunOptions::GetSpawnThread() const {
+  LLDB_RECORD_METHOD_CONST_NO_ARGS(bool, SBCommandInterpreterRunOptions,
+                                   GetSpawnThread);
+
+  return m_opaque_up->GetSpawnThread();
+}
+
+void SBCommandInterpreterRunOptions::SetSpawnThread(bool spawn_thread) {
+  LLDB_RECORD_METHOD(void, SBCommandInterpreterRunOptions, SetSpawnThread,
+                     (bool), spawn_thread);
+
+  m_opaque_up->SetSpawnThread(spawn_thread);
+}
+
 lldb_private::CommandInterpreterRunOptions *
 SBCommandInterpreterRunOptions::get() const {
   return m_opaque_up.get();
@@ -892,6 +921,14 @@
                              GetAddToHistory, ());
   LLDB_REGISTER_METHOD(void, SBCommandInterpreterRunOptions, SetAddToHistory,
                        (bool));
+  LLDB_REGISTER_METHOD_CONST(bool, SBCommandInterpreterRunOptions,
+                             GetAutoHandleEvents, ());
+  LLDB_REGISTER_METHOD(void, SBCommandInterpreterRunOptions,
+                       SetAutoHandleEvents, (bool));
+  LLDB_REGISTER_METHOD_CONST(bool, SBCommandInterpreterRunOptions,
+                             GetSpawnThread, ());
+  LLDB_REGISTER_METHOD(void, SBCommandInterpreterRunOptions, SetSpawnThread,
+                       (bool));
   LLDB_REGISTER_CONSTRUCTOR(SBCommandInterpreter,
                             (lldb_private::CommandInterpreter *));
   LLDB_REGISTER_CONSTRUCTOR(SBCommandInterpreter,
Index: lldb/include/lldb/Interpreter/CommandInterpreter.h
===================================================================
--- lldb/include/lldb/Interpreter/CommandInterpreter.h
+++ lldb/include/lldb/Interpreter/CommandInterpreter.h
@@ -144,6 +144,20 @@
     m_add_to_history = add_to_history ? eLazyBoolYes : eLazyBoolNo;
   }
 
+  bool GetAutoHandleEvents() const {
+    return DefaultToYes(m_auto_handle_events);
+  }
+
+  void SetAutoHandleEvents(bool auto_handle_events) {
+    m_auto_handle_events = auto_handle_events ? eLazyBoolYes : eLazyBoolNo;
+  }
+
+  bool GetSpawnThread() const { return DefaultToNo(m_spawn_thread); }
+
+  void SetSpawnThread(bool spawn_thread) {
+    m_spawn_thread = spawn_thread ? eLazyBoolYes : eLazyBoolNo;
+  }
+
   LazyBool m_stop_on_continue;
   LazyBool m_stop_on_error;
   LazyBool m_stop_on_crash;
@@ -152,6 +166,8 @@
   LazyBool m_print_results;
   LazyBool m_print_errors;
   LazyBool m_add_to_history;
+  LazyBool m_auto_handle_events;
+  LazyBool m_spawn_thread;
 
 private:
   static bool DefaultToYes(LazyBool flag) {
@@ -426,8 +442,7 @@
 
   bool IsActive();
 
-  void RunCommandInterpreter(bool auto_handle_events, bool spawn_thread,
-                             CommandInterpreterRunOptions &options);
+  void RunCommandInterpreter(CommandInterpreterRunOptions &options);
 
   void GetLLDBCommandsFromIOHandler(const char *prompt,
                                     IOHandlerDelegate &delegate,
Index: lldb/include/lldb/API/SBCommandInterpreter.h
===================================================================
--- lldb/include/lldb/API/SBCommandInterpreter.h
+++ lldb/include/lldb/API/SBCommandInterpreter.h
@@ -52,6 +52,14 @@
 
   void SetAddToHistory(bool);
 
+  bool GetAutoHandleEvents() const;
+
+  void SetAutoHandleEvents(bool);
+
+  bool GetSpawnThread() const;
+
+  void SetSpawnThread(bool);
+
 private:
   lldb_private::CommandInterpreterRunOptions *get() const;
 
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to