[Lldb-commits] [lldb] r193425 - <rdar://problem/15263540>

Greg Clayton gclayton at apple.com
Fri Oct 25 11:13:17 PDT 2013


Author: gclayton
Date: Fri Oct 25 13:13:17 2013
New Revision: 193425

URL: http://llvm.org/viewvc/llvm-project?rev=193425&view=rev
Log:
<rdar://problem/15263540>

Added a new key that we understand for the "qHostInfo" packet: "default_packet_timeout:T;" where T is a default packet timeout in seconds.

This allows GDB servers with known slow packet response times to increase the default timeout to a value that makes sense for the connection.


Modified:
    lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
    lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h
    lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp

Modified: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp?rev=193425&r1=193424&r2=193425&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp (original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp Fri Oct 25 13:13:17 2013
@@ -90,7 +90,11 @@ GDBRemoteCommunicationClient::GDBRemoteC
     m_process_arch(),
     m_os_version_major (UINT32_MAX),
     m_os_version_minor (UINT32_MAX),
-    m_os_version_update (UINT32_MAX)
+    m_os_version_update (UINT32_MAX),
+    m_os_build (),
+    m_os_kernel (),
+    m_hostname (),
+    m_default_packet_timeout (0)
 {
 }
 
@@ -1299,6 +1303,15 @@ GDBRemoteCommunicationClient::GetHostInf
                         else
                             --num_keys_decoded;
                     }
+                    else if (name.compare("default_packet_timeout") == 0)
+                    {
+                        m_default_packet_timeout = Args::StringToUInt32(value.c_str(), 0);
+                        if (m_default_packet_timeout > 0)
+                        {
+                            SetPacketTimeout(m_default_packet_timeout);
+                            ++num_keys_decoded;
+                        }
+                    }
 
                 }
                 
@@ -1433,6 +1446,14 @@ GDBRemoteCommunicationClient::GetHostArc
     return m_host_arch;
 }
 
+uint32_t
+GDBRemoteCommunicationClient::GetHostDefaultPacketTimeout ()
+{
+    if (m_qHostInfo_is_valid == eLazyBoolCalculate)
+        GetHostInfo ();
+    return m_default_packet_timeout;
+}
+
 addr_t
 GDBRemoteCommunicationClient::AllocateMemory (size_t size, uint32_t permissions)
 {

Modified: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h?rev=193425&r1=193424&r2=193425&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h (original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h Fri Oct 25 13:13:17 2013
@@ -220,6 +220,9 @@ public:
 
     const lldb_private::ArchSpec &
     GetHostArchitecture ();
+    
+    uint32_t
+    GetHostDefaultPacketTimeout();
 
     const lldb_private::ArchSpec &
     GetProcessArchitecture ();
@@ -476,6 +479,7 @@ protected:
     std::string m_os_build;
     std::string m_os_kernel;
     std::string m_hostname;
+    uint32_t m_default_packet_timeout;
     
     bool
     DecodeProcessInfoResponse (StringExtractorGDBRemote &response, 

Modified: lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp?rev=193425&r1=193424&r2=193425&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp (original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp Fri Oct 25 13:13:17 2013
@@ -138,6 +138,14 @@ namespace {
             const uint32_t idx = ePropertyPacketTimeout;
             return m_collection_sp->GetPropertyAtIndexAsUInt64(NULL, idx, g_properties[idx].default_uint_value);
         }
+
+        bool
+        SetPacketTimeout(uint64_t timeout)
+        {
+            const uint32_t idx = ePropertyPacketTimeout;
+            return m_collection_sp->SetPropertyAtIndexAsUInt64(NULL, idx, timeout);
+        }
+
         FileSpec
         GetTargetDefinitionFile () const
         {
@@ -536,6 +544,16 @@ ProcessGDBRemote::BuildDynamicRegisterIn
         }
     }
 
+    // Check if qHostInfo specified a specific packet timeout for this connection.
+    // If so then lets update our setting so the user knows what the timeout is
+    // and can see it.
+    const uint32_t host_packet_timeout = m_gdb_comm.GetHostDefaultPacketTimeout();
+    if (host_packet_timeout)
+    {
+        GetGlobalPluginProperties()->SetPacketTimeout(host_packet_timeout);
+    }
+    
+
     if (reg_num == 0)
     {
         FileSpec target_definition_fspec = GetGlobalPluginProperties()->GetTargetDefinitionFile ();





More information about the lldb-commits mailing list