Skip to content

Commit

Permalink
[lldb] Make some functions useful to REPLs public
Browse files Browse the repository at this point in the history
`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.

Differential Revision: https://reviews.llvm.org/D149717
  • Loading branch information
walter erquinigo committed May 4, 2023
1 parent c395a84 commit db5f745
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions lldb/include/lldb/Core/Debugger.h
Original file line number Diff line number Diff line change
Expand Up @@ -500,6 +500,19 @@ class Debugger : public std::enable_shared_from_this<Debugger>,
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 &process, bool flush_stdout,
bool flush_stderr);

protected:
friend class CommandInterpreter;
friend class REPL;
Expand Down Expand Up @@ -548,10 +561,6 @@ class Debugger : public std::enable_shared_from_this<Debugger>,

void PrintProgress(const ProgressEventData &data);

bool StartEventHandlerThread();

void StopEventHandlerThread();

void PushIOHandler(const lldb::IOHandlerSP &reader_sp,
bool cancel_top_handler = true);

Expand Down Expand Up @@ -587,8 +596,6 @@ class Debugger : public std::enable_shared_from_this<Debugger>,

// Ensures two threads don't attempt to flush process output in parallel.
std::mutex m_output_flush_mutex;
void FlushProcessOutput(Process &process, bool flush_stdout,
bool flush_stderr);

SourceManager::SourceFileCache &GetSourceFileCache() {
return m_source_file_cache;
Expand Down

0 comments on commit db5f745

Please sign in to comment.