Fixed remote failures in TestCPP11EnumTypes, probably others

Typically, LLGS only sends stdout/stderr notifications when the inferior
process is running.

Because LLGS reads stdout from the process in a separate thread, sometimes
these stdout notifications can be received after the server has sent a thread
stop message. The host isn't expecting stdout to be generated by the target
after a stop message and these messages interfere with the host's request/
response paradigm.

Differential Revision: http://reviews.llvm.org/D9024

llvm-svn: 234995
diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
index 3dfb668..d4bbb6f 100644
--- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
@@ -747,6 +747,11 @@
                 StateAsCString (state));
     }
 
+    // Make sure we get all of the pending stdout/stderr from the inferior
+    // and send it to the lldb host before we send the state change
+    // notification
+    m_stdio_communication.SynchronizeWithReadThread();
+
     switch (state)
     {
     case StateType::eStateExited: