From c7749c3acdedc6e09a302622cd29f4bfe4672f3f Mon Sep 17 00:00:00 2001 From: Pavel Labath Date: Tue, 21 Jul 2015 13:20:25 +0000 Subject: [LLGS] Get rid of the stdio forwarding thread Summary: This commit removes the stdio forwarding thread in lldb-server in favor of a MainLoop callback. As in some situations we need to forcibly flush the stream ( => Read() is called from multiple places) and we still have multiple threads, I have had to additionally protect the communication instance with a mutex. Reviewers: ovyalov, tberghammer Subscribers: lldb-commits Differential Revision: http://reviews.llvm.org/D11296 llvm-svn: 242782 --- .../gdb-remote/GDBRemoteCommunicationServerLLGS.h | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to 'lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.h') diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.h b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.h index 0d258fbd247..4ed30d5f991 100644 --- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.h +++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.h @@ -119,12 +119,16 @@ public: protected: lldb::PlatformSP m_platform_sp; MainLoop &m_mainloop; - MainLoop::ReadHandleUP m_read_handle_up; + MainLoop::ReadHandleUP m_network_handle_up; lldb::tid_t m_current_tid; lldb::tid_t m_continue_tid; Mutex m_debugged_process_mutex; NativeProcessProtocolSP m_debugged_process_sp; + + Mutex m_stdio_communication_mutex; // Protects m_stdio_communication and m_stdio_handle_up Communication m_stdio_communication; + MainLoop::ReadHandleUP m_stdio_handle_up; + lldb::StateType m_inferior_prev_state; lldb::DataBufferSP m_active_auxv_buffer_sp; Mutex m_saved_registers_mutex; @@ -142,7 +146,7 @@ protected: SendStopReplyPacketForThread (lldb::tid_t tid); PacketResult - SendStopReasonForState (lldb::StateType process_state, bool flush_on_exit); + SendStopReasonForState (lldb::StateType process_state); PacketResult Handle_k (StringExtractorGDBRemote &packet); @@ -264,9 +268,6 @@ protected: Error SetSTDIOFileDescriptor (int fd); - static void - STDIOReadThreadBytesReceived (void *baton, const void *src, size_t src_len); - FileSpec FindModuleFile (const std::string& module_path, const ArchSpec& arch) override; @@ -287,9 +288,6 @@ private: void HandleInferiorState_Stopped (NativeProcessProtocol *process); - void - FlushInferiorOutput (); - NativeThreadProtocolSP GetThreadFromSuffix (StringExtractorGDBRemote &packet); @@ -308,6 +306,12 @@ private: void DataAvailableCallback (); + void + SendProcessOutput (); + + void + StopSTDIOForwarding(); + //------------------------------------------------------------------ // For GDBRemoteCommunicationServerLLGS only //------------------------------------------------------------------ -- cgit v1.2.3