Fixed a crasher that was happened when a log shared pointer wasn't valid.

Fixed ThreadPlanCallFunction::ReportRegisterState(...) to only dump when
verbose logging is enabled and fixed the function to use the new
RegisterValue method of reading registers.

Fixed the GDB remote client to not send a continue packet after receiving
stdout or stderr from the inferior process.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@131628 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp b/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
index f4e6702..bfb4755 100644
--- a/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
+++ b/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
@@ -361,14 +361,21 @@
     // make change if we are interrupted and we continue after an async packet...
     std::string continue_packet(payload, packet_length);
     
+    bool got_stdout = false;
+    
     while (state == eStateRunning)
     {
-        if (log)
-            log->Printf ("GDBRemoteCommunicationClient::%s () sending continue packet: %s", __FUNCTION__, continue_packet.c_str());
-        if (SendPacket(continue_packet.c_str(), continue_packet.size()) == 0)
-            state = eStateInvalid;
+        if (!got_stdout)
+        {
+            if (log)
+                log->Printf ("GDBRemoteCommunicationClient::%s () sending continue packet: %s", __FUNCTION__, continue_packet.c_str());
+            if (SendPacket(continue_packet.c_str(), continue_packet.size()) == 0)
+                state = eStateInvalid;
         
-        m_private_is_running.SetValue (true, eBroadcastNever);
+            m_private_is_running.SetValue (true, eBroadcastNever);
+        }
+        
+        got_stdout = false;
 
         if (log)
             log->Printf ("GDBRemoteCommunicationClient::%s () WaitForPacket(%.*s)", __FUNCTION__);
@@ -489,6 +496,7 @@
                 case 'O':
                     // STDOUT
                     {
+                        got_stdout = true;
                         std::string inferior_stdout;
                         inferior_stdout.reserve(response.GetBytesLeft () / 2);
                         char ch;