From abadc2217225d0cfe09a8960ba8cd0722c5104e3 Mon Sep 17 00:00:00 2001 From: Pavel Labath Date: Fri, 27 Nov 2015 13:33:29 +0000 Subject: [LLGS] Don't forward I/O when process is stopped Summary: This makes sure we do not attempt to send output over the gdb-remote protocol when the client is not expecting it (i.e., after sending the stop-reply packet). Normally, this should not happen (the process cannot generate output when it is stopped), but due to the fact that pty communication is asynchronous in the linux kernel (llvm.org/pr25652), we may sometimes get this output too late. Instead, we just hold the output, and send it next time we resume. This is not ideal, but at least it makes sure we do not violate the remote protocol. Given that this happens extremely rarely it's not worth trying to work around it with sleeps or something like that. I also remove the m_stdio_communication_mutex, as all of LLGS is now single-threaded anyway. Reviewers: tberghammer, ovyalov Subscribers: lldb-commits Differential Revision: http://reviews.llvm.org/D15019 llvm-svn: 254200 --- .../Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (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 fe3f718274e..f16057781dd 100644 --- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.h +++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.h @@ -122,7 +122,6 @@ protected: 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; @@ -297,6 +296,9 @@ private: void SendProcessOutput (); + void + StartSTDIOForwarding(); + void StopSTDIOForwarding(); -- cgit v1.2.3