[Lldb-commits] [PATCH] D149717: [lldb] Make some functions useful to REPLs public

2023-05-04 Thread walter erquinigo via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGdb5f745a2bfc: [lldb] Make some functions useful to REPLs 
public (authored by wallace).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D149717

Files:
  lldb/include/lldb/Core/Debugger.h


Index: lldb/include/lldb/Core/Debugger.h
===
--- lldb/include/lldb/Core/Debugger.h
+++ lldb/include/lldb/Core/Debugger.h
@@ -500,6 +500,19 @@
   SetDestroyCallback(lldb_private::DebuggerDestroyCallback destroy_callback,
  void *baton);
 
+  /// Manually start the global event handler thread. It is useful to plugins
+  /// that directly use the \a lldb_private namespace and want to use the
+  /// debugger's default event handler thread instead of defining their own.
+  bool StartEventHandlerThread();
+
+  /// Manually stop the debugger's default event handler.
+  void StopEventHandlerThread();
+
+  /// Force flushing the process's pending stdout and stderr to the debugger's
+  /// asynchronous stdout and stderr streams.
+  void FlushProcessOutput(Process , bool flush_stdout,
+  bool flush_stderr);
+
 protected:
   friend class CommandInterpreter;
   friend class REPL;
@@ -548,10 +561,6 @@
 
   void PrintProgress(const ProgressEventData );
 
-  bool StartEventHandlerThread();
-
-  void StopEventHandlerThread();
-
   void PushIOHandler(const lldb::IOHandlerSP _sp,
  bool cancel_top_handler = true);
 
@@ -587,8 +596,6 @@
 
   // Ensures two threads don't attempt to flush process output in parallel.
   std::mutex m_output_flush_mutex;
-  void FlushProcessOutput(Process , bool flush_stdout,
-  bool flush_stderr);
 
   SourceManager::SourceFileCache () {
 return m_source_file_cache;


Index: lldb/include/lldb/Core/Debugger.h
===
--- lldb/include/lldb/Core/Debugger.h
+++ lldb/include/lldb/Core/Debugger.h
@@ -500,6 +500,19 @@
   SetDestroyCallback(lldb_private::DebuggerDestroyCallback destroy_callback,
  void *baton);
 
+  /// Manually start the global event handler thread. It is useful to plugins
+  /// that directly use the \a lldb_private namespace and want to use the
+  /// debugger's default event handler thread instead of defining their own.
+  bool StartEventHandlerThread();
+
+  /// Manually stop the debugger's default event handler.
+  void StopEventHandlerThread();
+
+  /// Force flushing the process's pending stdout and stderr to the debugger's
+  /// asynchronous stdout and stderr streams.
+  void FlushProcessOutput(Process , bool flush_stdout,
+  bool flush_stderr);
+
 protected:
   friend class CommandInterpreter;
   friend class REPL;
@@ -548,10 +561,6 @@
 
   void PrintProgress(const ProgressEventData );
 
-  bool StartEventHandlerThread();
-
-  void StopEventHandlerThread();
-
   void PushIOHandler(const lldb::IOHandlerSP _sp,
  bool cancel_top_handler = true);
 
@@ -587,8 +596,6 @@
 
   // Ensures two threads don't attempt to flush process output in parallel.
   std::mutex m_output_flush_mutex;
-  void FlushProcessOutput(Process , bool flush_stdout,
-  bool flush_stderr);
 
   SourceManager::SourceFileCache () {
 return m_source_file_cache;
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D149717: [lldb] Make some functions useful to REPLs public

2023-05-04 Thread Alex Langford via Phabricator via lldb-commits
bulbazord accepted this revision.
bulbazord added a comment.
This revision is now accepted and ready to land.

LGTM


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D149717

___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D149717: [lldb] Make some functions useful to REPLs public

2023-05-04 Thread walter erquinigo via Phabricator via lldb-commits
wallace updated this revision to Diff 519542.
wallace added a comment.

address comments


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D149717

Files:
  lldb/include/lldb/Core/Debugger.h


Index: lldb/include/lldb/Core/Debugger.h
===
--- lldb/include/lldb/Core/Debugger.h
+++ lldb/include/lldb/Core/Debugger.h
@@ -500,6 +500,19 @@
   SetDestroyCallback(lldb_private::DebuggerDestroyCallback destroy_callback,
  void *baton);
 
+  /// Manually start the global event handler thread. It is useful to plugins
+  /// that directly use the \a lldb_private namespace and want to use the
+  /// debugger's default event handler thread instead of defining their own.
+  bool StartEventHandlerThread();
+
+  /// Manually stop the debugger's default event handler.
+  void StopEventHandlerThread();
+
+  /// Force flushing the process's pending stdout and stderr to the debugger's
+  /// asynchronous stdout and stderr streams.
+  void FlushProcessOutput(Process , bool flush_stdout,
+  bool flush_stderr);
+
 protected:
   friend class CommandInterpreter;
   friend class REPL;
@@ -548,10 +561,6 @@
 
   void PrintProgress(const ProgressEventData );
 
-  bool StartEventHandlerThread();
-
-  void StopEventHandlerThread();
-
   void PushIOHandler(const lldb::IOHandlerSP _sp,
  bool cancel_top_handler = true);
 
@@ -587,8 +596,6 @@
 
   // Ensures two threads don't attempt to flush process output in parallel.
   std::mutex m_output_flush_mutex;
-  void FlushProcessOutput(Process , bool flush_stdout,
-  bool flush_stderr);
 
   SourceManager::SourceFileCache () {
 return m_source_file_cache;


Index: lldb/include/lldb/Core/Debugger.h
===
--- lldb/include/lldb/Core/Debugger.h
+++ lldb/include/lldb/Core/Debugger.h
@@ -500,6 +500,19 @@
   SetDestroyCallback(lldb_private::DebuggerDestroyCallback destroy_callback,
  void *baton);
 
+  /// Manually start the global event handler thread. It is useful to plugins
+  /// that directly use the \a lldb_private namespace and want to use the
+  /// debugger's default event handler thread instead of defining their own.
+  bool StartEventHandlerThread();
+
+  /// Manually stop the debugger's default event handler.
+  void StopEventHandlerThread();
+
+  /// Force flushing the process's pending stdout and stderr to the debugger's
+  /// asynchronous stdout and stderr streams.
+  void FlushProcessOutput(Process , bool flush_stdout,
+  bool flush_stderr);
+
 protected:
   friend class CommandInterpreter;
   friend class REPL;
@@ -548,10 +561,6 @@
 
   void PrintProgress(const ProgressEventData );
 
-  bool StartEventHandlerThread();
-
-  void StopEventHandlerThread();
-
   void PushIOHandler(const lldb::IOHandlerSP _sp,
  bool cancel_top_handler = true);
 
@@ -587,8 +596,6 @@
 
   // Ensures two threads don't attempt to flush process output in parallel.
   std::mutex m_output_flush_mutex;
-  void FlushProcessOutput(Process , bool flush_stdout,
-  bool flush_stderr);
 
   SourceManager::SourceFileCache () {
 return m_source_file_cache;
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D149717: [lldb] Make some functions useful to REPLs public

2023-05-04 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere added inline comments.



Comment at: lldb/include/lldb/Core/Debugger.h:505
+  /// that directly use the \a lldb_private namespace and want to use the
+  /// default LLDB event handler thread instead of defining their own.
+  bool StartEventHandlerThread();





Comment at: lldb/include/lldb/Core/Debugger.h:508-509
+
+  /// Stop the global event handler thread. It should only be used by programs
+  /// that manually invoked \a Debugger::StartEventHandlerThread().
+  void StopEventHandlerThread();

`used by programs` is rather vague.



Comment at: lldb/include/lldb/Core/Debugger.h:512
+
+  /// Force flushing the process's pending stdout and stderr to the debuggers'
+  /// asynchronous stdout and stderr streams.




Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D149717

___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D149717: [lldb] Make some functions useful to REPLs public

2023-05-03 Thread walter erquinigo via Phabricator via lldb-commits
wallace updated this revision to Diff 519141.
wallace added a comment.

address comment


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D149717

Files:
  lldb/include/lldb/Core/Debugger.h


Index: lldb/include/lldb/Core/Debugger.h
===
--- lldb/include/lldb/Core/Debugger.h
+++ lldb/include/lldb/Core/Debugger.h
@@ -500,6 +500,20 @@
   SetDestroyCallback(lldb_private::DebuggerDestroyCallback destroy_callback,
  void *baton);
 
+  /// Manually start the global event handler thread. It is useful to plugins
+  /// that directly use the \a lldb_private namespace and want to use the
+  /// default LLDB event handler thread instead of defining their own.
+  bool StartEventHandlerThread();
+
+  /// Stop the global event handler thread. It should only be used by programs
+  /// that manually invoked \a Debugger::StartEventHandlerThread().
+  void StopEventHandlerThread();
+
+  /// Force flushing the process's pending stdout and stderr to the debuggers'
+  /// asynchronous stdout and stderr streams.
+  void FlushProcessOutput(Process , bool flush_stdout,
+  bool flush_stderr);
+
 protected:
   friend class CommandInterpreter;
   friend class REPL;
@@ -548,10 +562,6 @@
 
   void PrintProgress(const ProgressEventData );
 
-  bool StartEventHandlerThread();
-
-  void StopEventHandlerThread();
-
   void PushIOHandler(const lldb::IOHandlerSP _sp,
  bool cancel_top_handler = true);
 
@@ -587,8 +597,6 @@
 
   // Ensures two threads don't attempt to flush process output in parallel.
   std::mutex m_output_flush_mutex;
-  void FlushProcessOutput(Process , bool flush_stdout,
-  bool flush_stderr);
 
   SourceManager::SourceFileCache () {
 return m_source_file_cache;


Index: lldb/include/lldb/Core/Debugger.h
===
--- lldb/include/lldb/Core/Debugger.h
+++ lldb/include/lldb/Core/Debugger.h
@@ -500,6 +500,20 @@
   SetDestroyCallback(lldb_private::DebuggerDestroyCallback destroy_callback,
  void *baton);
 
+  /// Manually start the global event handler thread. It is useful to plugins
+  /// that directly use the \a lldb_private namespace and want to use the
+  /// default LLDB event handler thread instead of defining their own.
+  bool StartEventHandlerThread();
+
+  /// Stop the global event handler thread. It should only be used by programs
+  /// that manually invoked \a Debugger::StartEventHandlerThread().
+  void StopEventHandlerThread();
+
+  /// Force flushing the process's pending stdout and stderr to the debuggers'
+  /// asynchronous stdout and stderr streams.
+  void FlushProcessOutput(Process , bool flush_stdout,
+  bool flush_stderr);
+
 protected:
   friend class CommandInterpreter;
   friend class REPL;
@@ -548,10 +562,6 @@
 
   void PrintProgress(const ProgressEventData );
 
-  bool StartEventHandlerThread();
-
-  void StopEventHandlerThread();
-
   void PushIOHandler(const lldb::IOHandlerSP _sp,
  bool cancel_top_handler = true);
 
@@ -587,8 +597,6 @@
 
   // Ensures two threads don't attempt to flush process output in parallel.
   std::mutex m_output_flush_mutex;
-  void FlushProcessOutput(Process , bool flush_stdout,
-  bool flush_stderr);
 
   SourceManager::SourceFileCache () {
 return m_source_file_cache;
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D149717: [lldb] Make some functions useful to REPLs public

2023-05-03 Thread walter erquinigo via Phabricator via lldb-commits
wallace added inline comments.



Comment at: lldb/include/lldb/Core/Debugger.h:503-504
 
+  /// Manually start the global event handler thread. It should be used by
+  /// programs that use LLDB as a library.
+  bool StartEventHandlerThread();

bulbazord wrote:
> There are program that use LLDB as a library but go through the SBAPI instead 
> of lldb_private. Could you update this comment to be more specific about the 
> intentions here? I assume you mean things like plugins.
sure


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D149717

___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D149717: [lldb] Make some functions useful to REPLs public

2023-05-03 Thread Alex Langford via Phabricator via lldb-commits
bulbazord added a reviewer: JDevlieghere.
bulbazord added inline comments.



Comment at: lldb/include/lldb/Core/Debugger.h:503-504
 
+  /// Manually start the global event handler thread. It should be used by
+  /// programs that use LLDB as a library.
+  bool StartEventHandlerThread();

There are program that use LLDB as a library but go through the SBAPI instead 
of lldb_private. Could you update this comment to be more specific about the 
intentions here? I assume you mean things like plugins.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D149717

___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D149717: [lldb] Make some functions useful to REPLs public

2023-05-02 Thread walter erquinigo via Phabricator via lldb-commits
wallace created this revision.
Herald added a project: All.
wallace requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

`StartEventHandlerThread` and `StopEventHandlerThread` are available to the 
SwiftREPL even though they are protected because SwiftREPL is a friend class of 
Debugger. I'm developing my own REPL and having access to these functions, 
including `FlushProcessOutput`, is desirable.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D149717

Files:
  lldb/include/lldb/Core/Debugger.h


Index: lldb/include/lldb/Core/Debugger.h
===
--- lldb/include/lldb/Core/Debugger.h
+++ lldb/include/lldb/Core/Debugger.h
@@ -500,6 +500,19 @@
   SetDestroyCallback(lldb_private::DebuggerDestroyCallback destroy_callback,
  void *baton);
 
+  /// Manually start the global event handler thread. It should be used by
+  /// programs that use LLDB as a library.
+  bool StartEventHandlerThread();
+
+  /// Stop the global event handler thread. It should only be used by programs
+  /// that manually invoked \a Debugger::StartEventHandlerThread().
+  void StopEventHandlerThread();
+
+  /// Force flushing the process's pending stdout and stderr to the debuggers'
+  /// asynchronous stdout and stderr streams.
+  void FlushProcessOutput(Process , bool flush_stdout,
+  bool flush_stderr);
+
 protected:
   friend class CommandInterpreter;
   friend class REPL;
@@ -548,10 +561,6 @@
 
   void PrintProgress(const ProgressEventData );
 
-  bool StartEventHandlerThread();
-
-  void StopEventHandlerThread();
-
   void PushIOHandler(const lldb::IOHandlerSP _sp,
  bool cancel_top_handler = true);
 
@@ -587,8 +596,6 @@
 
   // Ensures two threads don't attempt to flush process output in parallel.
   std::mutex m_output_flush_mutex;
-  void FlushProcessOutput(Process , bool flush_stdout,
-  bool flush_stderr);
 
   SourceManager::SourceFileCache () {
 return m_source_file_cache;


Index: lldb/include/lldb/Core/Debugger.h
===
--- lldb/include/lldb/Core/Debugger.h
+++ lldb/include/lldb/Core/Debugger.h
@@ -500,6 +500,19 @@
   SetDestroyCallback(lldb_private::DebuggerDestroyCallback destroy_callback,
  void *baton);
 
+  /// Manually start the global event handler thread. It should be used by
+  /// programs that use LLDB as a library.
+  bool StartEventHandlerThread();
+
+  /// Stop the global event handler thread. It should only be used by programs
+  /// that manually invoked \a Debugger::StartEventHandlerThread().
+  void StopEventHandlerThread();
+
+  /// Force flushing the process's pending stdout and stderr to the debuggers'
+  /// asynchronous stdout and stderr streams.
+  void FlushProcessOutput(Process , bool flush_stdout,
+  bool flush_stderr);
+
 protected:
   friend class CommandInterpreter;
   friend class REPL;
@@ -548,10 +561,6 @@
 
   void PrintProgress(const ProgressEventData );
 
-  bool StartEventHandlerThread();
-
-  void StopEventHandlerThread();
-
   void PushIOHandler(const lldb::IOHandlerSP _sp,
  bool cancel_top_handler = true);
 
@@ -587,8 +596,6 @@
 
   // Ensures two threads don't attempt to flush process output in parallel.
   std::mutex m_output_flush_mutex;
-  void FlushProcessOutput(Process , bool flush_stdout,
-  bool flush_stderr);
 
   SourceManager::SourceFileCache () {
 return m_source_file_cache;
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits