[Lldb-commits] [lldb] r127392 - in /lldb/trunk/source/Plugins/Process/gdb-remote: GDBRemoteCommunication.cpp GDBRemoteCommunication.h GDBRemoteRegisterContext.cpp ProcessGDBRemote.cpp ProcessGDBRemote.h ThreadGDBRemote.cpp

Greg Clayton gclayton at apple.com
Wed Mar 9 18:26:48 PST 2011


Author: gclayton
Date: Wed Mar  9 20:26:48 2011
New Revision: 127392

URL: http://llvm.org/viewvc/llvm-project?rev=127392&view=rev
Log:
Centralize the GDB remote timeout value into the GDBRemoteCommunication as a
member variable (m_packet_timeout which is a value in seconds). This value is
then used for all packets sent to/from the remote GDB server.


Modified:
    lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
    lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h
    lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp
    lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
    lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h
    lldb/trunk/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp

Modified: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp?rev=127392&r1=127391&r2=127392&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp (original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp Wed Mar  9 20:26:48 2011
@@ -35,6 +35,7 @@
 //----------------------------------------------------------------------
 GDBRemoteCommunication::GDBRemoteCommunication() :
     Communication("gdb-remote.packets"),
+    m_packet_timeout (1),
     m_supports_not_sending_acks (eLazyBoolCalculate),
     m_supports_thread_suffix (eLazyBoolCalculate),
     m_supports_qHostInfo (eLazyBoolCalculate),
@@ -52,7 +53,6 @@
     m_async_packet_predicate (false),
     m_async_packet (),
     m_async_response (),
-    m_async_timeout (UINT32_MAX),
     m_async_signal (-1),
     m_arch(),
     m_os(),
@@ -124,7 +124,7 @@
     {
         StringExtractorGDBRemote response;
         m_supports_not_sending_acks = eLazyBoolNo;
-        if (SendPacketAndWaitForResponse("QStartNoAckMode", response, 1, false))
+        if (SendPacketAndWaitForResponse("QStartNoAckMode", response, false))
         {
             if (response.IsOKPacket())
                 m_supports_not_sending_acks = eLazyBoolYes;
@@ -158,7 +158,7 @@
     {
         StringExtractorGDBRemote response;
         m_supports_thread_suffix = eLazyBoolNo;
-        if (SendPacketAndWaitForResponse("QThreadSuffixSupported", response, 1, false))
+        if (SendPacketAndWaitForResponse("QThreadSuffixSupported", response, false))
         {
             if (response.IsOKPacket())
                 m_supports_thread_suffix = eLazyBoolYes;
@@ -178,7 +178,7 @@
         m_supports_vCont_C = eLazyBoolNo;
         m_supports_vCont_s = eLazyBoolNo;
         m_supports_vCont_S = eLazyBoolNo;
-        if (SendPacketAndWaitForResponse("vCont?", response, 1, false))
+        if (SendPacketAndWaitForResponse("vCont?", response, false))
         {
             const char *response_cstr = response.GetStringRef().c_str();
             if (::strstr (response_cstr, ";c"))
@@ -230,14 +230,12 @@
 (
     const char *payload,
     StringExtractorGDBRemote &response,
-    uint32_t timeout_seconds,
     bool send_async
 )
 {
     return SendPacketAndWaitForResponse (payload, 
                                          ::strlen (payload),
                                          response,
-                                         timeout_seconds,
                                          send_async);
 }
 
@@ -247,14 +245,13 @@
     const char *payload,
     size_t payload_length,
     StringExtractorGDBRemote &response,
-    uint32_t timeout_seconds,
     bool send_async
 )
 {
     Mutex::Locker locker;
     TimeValue timeout_time;
     timeout_time = TimeValue::Now();
-    timeout_time.OffsetWithSeconds (timeout_seconds);
+    timeout_time.OffsetWithSeconds (m_packet_timeout);
     LogSP log (ProcessGDBRemoteLog::GetLogIfAllCategoriesSet (GDBR_LOG_PROCESS));
 
     if (GetSequenceMutex (locker))
@@ -268,7 +265,6 @@
         {
             Mutex::Locker async_locker (m_async_mutex);
             m_async_packet.assign(payload, payload_length);
-            m_async_timeout = timeout_seconds;
             m_async_packet_predicate.SetValue (true, eBroadcastNever);
             
             if (log) 
@@ -398,7 +394,7 @@
                     {
                         if (process->GetID() == LLDB_INVALID_PROCESS_ID)
                         {
-                            lldb::pid_t pid = GetCurrentProcessID (1);
+                            lldb::pid_t pid = GetCurrentProcessID ();
                             if (pid != LLDB_INVALID_PROCESS_ID)
                                 process->SetID (pid);
                         }
@@ -473,7 +469,6 @@
                             SendPacketAndWaitForResponse (&m_async_packet[0], 
                                                           m_async_packet.size(),
                                                           m_async_response,
-                                                          m_async_timeout,
                                                           false);
                         }
                         // Let the other thread that was trying to send the async
@@ -570,7 +565,7 @@
         {
             if (GetSendAcks ())
             {
-                if (GetAck (1) != '+')
+                if (GetAck () != '+')
                     return 0;
             }
         }
@@ -586,10 +581,10 @@
 }
 
 char
-GDBRemoteCommunication::GetAck (uint32_t timeout_seconds)
+GDBRemoteCommunication::GetAck ()
 {
     StringExtractorGDBRemote response;
-    if (WaitForPacket (response, timeout_seconds) == 1)
+    if (WaitForPacket (response, m_packet_timeout) == 1)
         return response.GetChar();
     return 0;
 }
@@ -694,12 +689,6 @@
 }
 
 bool
-GDBRemoteCommunication::WaitForNotRunning (const TimeValue *timeout_ptr)
-{
-    return m_public_is_running.WaitForValueEqualTo (false, timeout_ptr, NULL);
-}
-
-bool
 GDBRemoteCommunication::WaitForNotRunningPrivate (const TimeValue *timeout_ptr)
 {
     return m_private_is_running.WaitForValueEqualTo (false, timeout_ptr, NULL);
@@ -857,10 +846,10 @@
 }
 
 lldb::pid_t
-GDBRemoteCommunication::GetCurrentProcessID (uint32_t timeout_seconds)
+GDBRemoteCommunication::GetCurrentProcessID ()
 {
     StringExtractorGDBRemote response;
-    if (SendPacketAndWaitForResponse("qC", strlen("qC"), response, timeout_seconds, false))
+    if (SendPacketAndWaitForResponse("qC", strlen("qC"), response, false))
     {
         if (response.GetChar() == 'Q')
             if (response.GetChar() == 'C')
@@ -870,11 +859,11 @@
 }
 
 bool
-GDBRemoteCommunication::GetLaunchSuccess (uint32_t timeout_seconds, std::string &error_str)
+GDBRemoteCommunication::GetLaunchSuccess (std::string &error_str)
 {
     error_str.clear();
     StringExtractorGDBRemote response;
-    if (SendPacketAndWaitForResponse("qLaunchSuccess", strlen("qLaunchSuccess"), response, timeout_seconds, false))
+    if (SendPacketAndWaitForResponse("qLaunchSuccess", strlen("qLaunchSuccess"), response, false))
     {
         if (response.IsOKPacket())
             return true;
@@ -896,7 +885,7 @@
 }
 
 int
-GDBRemoteCommunication::SendArgumentsPacket (char const *argv[], uint32_t timeout_seconds)
+GDBRemoteCommunication::SendArgumentsPacket (char const *argv[])
 {
     if (argv && argv[0])
     {
@@ -913,7 +902,7 @@
         }
 
         StringExtractorGDBRemote response;
-        if (SendPacketAndWaitForResponse (packet.GetData(), packet.GetSize(), response, timeout_seconds, false))
+        if (SendPacketAndWaitForResponse (packet.GetData(), packet.GetSize(), response, false))
         {
             if (response.IsOKPacket())
                 return 0;
@@ -926,14 +915,14 @@
 }
 
 int
-GDBRemoteCommunication::SendEnvironmentPacket (char const *name_equal_value, uint32_t timeout_seconds)
+GDBRemoteCommunication::SendEnvironmentPacket (char const *name_equal_value)
 {
     if (name_equal_value && name_equal_value[0])
     {
         StreamString packet;
         packet.Printf("QEnvironment:%s", name_equal_value);
         StringExtractorGDBRemote response;
-        if (SendPacketAndWaitForResponse (packet.GetData(), packet.GetSize(), response, timeout_seconds, false))
+        if (SendPacketAndWaitForResponse (packet.GetData(), packet.GetSize(), response, false))
         {
             if (response.IsOKPacket())
                 return 0;
@@ -953,7 +942,7 @@
         m_supports_qHostInfo = eLazyBoolNo;
 
         StringExtractorGDBRemote response;
-        if (SendPacketAndWaitForResponse ("qHostInfo", response, 1, false))
+        if (SendPacketAndWaitForResponse ("qHostInfo", response, false))
         {
             if (response.IsUnsupportedPacket())
                 return false;
@@ -1012,7 +1001,6 @@
 GDBRemoteCommunication::SendAttach 
 (
     lldb::pid_t pid, 
-    uint32_t timeout_seconds, 
     StringExtractorGDBRemote& response
 )
 {
@@ -1021,7 +1009,7 @@
         StreamString packet;
         packet.Printf("vAttach;%x", pid);
         
-        if (SendPacketAndWaitForResponse (packet.GetData(), packet.GetSize(), response, timeout_seconds, false))
+        if (SendPacketAndWaitForResponse (packet.GetData(), packet.GetSize(), response, false))
         {
             if (response.IsErrorPacket())
                 return response.GetError();
@@ -1072,7 +1060,7 @@
 }
 
 addr_t
-GDBRemoteCommunication::AllocateMemory (size_t size, uint32_t permissions, uint32_t timeout_seconds)
+GDBRemoteCommunication::AllocateMemory (size_t size, uint32_t permissions)
 {
     char packet[64];
     ::snprintf (packet, sizeof(packet), "_M%zx,%s%s%s", size,
@@ -1080,7 +1068,7 @@
                 permissions & lldb::ePermissionsWritable ? "w" : "",
                 permissions & lldb::ePermissionsExecutable ? "x" : "");
     StringExtractorGDBRemote response;
-    if (SendPacketAndWaitForResponse (packet, response, timeout_seconds, false))
+    if (SendPacketAndWaitForResponse (packet, response, false))
     {
         if (!response.IsErrorPacket())
             return response.GetHexMaxU64(false, LLDB_INVALID_ADDRESS);
@@ -1089,12 +1077,12 @@
 }
 
 bool
-GDBRemoteCommunication::DeallocateMemory (addr_t addr, uint32_t timeout_seconds)
+GDBRemoteCommunication::DeallocateMemory (addr_t addr)
 {
     char packet[64];
     snprintf(packet, sizeof(packet), "_m%llx", (uint64_t)addr);
     StringExtractorGDBRemote response;
-    if (SendPacketAndWaitForResponse (packet, response, timeout_seconds, false))
+    if (SendPacketAndWaitForResponse (packet, response, false))
     {
         if (response.IsOKPacket())
             return true;
@@ -1112,7 +1100,7 @@
         packet.PutBytesAsRawHex8(path, strlen(path));
 
         StringExtractorGDBRemote response;
-        if (SendPacketAndWaitForResponse (packet.GetData(), packet.GetSize(), response, 1, false))
+        if (SendPacketAndWaitForResponse (packet.GetData(), packet.GetSize(), response, false))
         {
             if (response.IsOKPacket())
                 return 0;
@@ -1134,7 +1122,7 @@
         packet.PutBytesAsRawHex8(path, strlen(path));
         
         StringExtractorGDBRemote response;
-        if (SendPacketAndWaitForResponse (packet.GetData(), packet.GetSize(), response, 1, false))
+        if (SendPacketAndWaitForResponse (packet.GetData(), packet.GetSize(), response, false))
         {
             if (response.IsOKPacket())
                 return 0;
@@ -1156,7 +1144,7 @@
         packet.PutBytesAsRawHex8(path, strlen(path));
         
         StringExtractorGDBRemote response;
-        if (SendPacketAndWaitForResponse (packet.GetData(), packet.GetSize(), response, 1, false))
+        if (SendPacketAndWaitForResponse (packet.GetData(), packet.GetSize(), response, false))
         {
             if (response.IsOKPacket())
                 return 0;
@@ -1178,7 +1166,7 @@
         packet.PutBytesAsRawHex8(path, strlen(path));
         
         StringExtractorGDBRemote response;
-        if (SendPacketAndWaitForResponse (packet.GetData(), packet.GetSize(), response, 1, false))
+        if (SendPacketAndWaitForResponse (packet.GetData(), packet.GetSize(), response, false))
         {
             if (response.IsOKPacket())
                 return 0;
@@ -1197,7 +1185,7 @@
     packet.Printf("QSetDisableASLR:%i", enable ? 1 : 0);
        
     StringExtractorGDBRemote response;
-    if (SendPacketAndWaitForResponse (packet.GetData(), packet.GetSize(), response, 1, false))
+    if (SendPacketAndWaitForResponse (packet.GetData(), packet.GetSize(), response, false))
     {
         if (response.IsOKPacket())
             return 0;

Modified: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h?rev=127392&r1=127391&r2=127392&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h (original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h Wed Mar  9 20:26:48 2011
@@ -56,14 +56,12 @@
     size_t
     SendPacketAndWaitForResponse (const char *send_payload,
                                   StringExtractorGDBRemote &response,
-                                  uint32_t timeout_seconds,
                                   bool send_async);
 
     size_t
     SendPacketAndWaitForResponse (const char *send_payload,
                                   size_t send_length,
                                   StringExtractorGDBRemote &response,
-                                  uint32_t timeout_seconds,
                                   bool send_async);
 
     lldb::StateType
@@ -75,7 +73,7 @@
     // Wait for a packet within 'nsec' seconds
     size_t
     WaitForPacket (StringExtractorGDBRemote &response,
-                   uint32_t nsec);
+                   uint32_t sec);
 
     // Wait for a packet with an absolute timeout time. If 'timeout' is NULL
     // wait indefinitely.
@@ -84,7 +82,7 @@
                    const lldb_private::TimeValue* timeout);
 
     char
-    GetAck (uint32_t timeout_seconds);
+    GetAck ();
 
     size_t
     SendAck ();
@@ -120,10 +118,10 @@
 
 
     lldb::pid_t
-    GetCurrentProcessID (uint32_t timeout_seconds);
+    GetCurrentProcessID ();
 
     bool
-    GetLaunchSuccess (uint32_t timeout_seconds, std::string &error_str);
+    GetLaunchSuccess (std::string &error_str);
 
     //------------------------------------------------------------------
     /// Sends a GDB remote protocol 'A' packet that delivers program
@@ -133,10 +131,6 @@
     ///     A NULL terminated array of const C strings to use as the
     ///     arguments.
     ///
-    /// @param[in] timeout_seconds
-    ///     The number of seconds to wait for a response from the remote
-    ///     server.
-    ///
     /// @return
     ///     Zero if the response was "OK", a positive value if the
     ///     the response was "Exx" where xx are two hex digits, or
@@ -144,7 +138,7 @@
     ///     response was received.
     //------------------------------------------------------------------
     int
-    SendArgumentsPacket (char const *argv[], uint32_t timeout_seconds);
+    SendArgumentsPacket (char const *argv[]);
 
     //------------------------------------------------------------------
     /// Sends a "QEnvironment:NAME=VALUE" packet that will build up the
@@ -157,10 +151,6 @@
     ///     A NULL terminated C string that contains a single environment
     ///     in the format "NAME=VALUE".
     ///
-    /// @param[in] timeout_seconds
-    ///     The number of seconds to wait for a response from the remote
-    ///     server.
-    ///
     /// @return
     ///     Zero if the response was "OK", a positive value if the
     ///     the response was "Exx" where xx are two hex digits, or
@@ -168,8 +158,7 @@
     ///     response was received.
     //------------------------------------------------------------------
     int
-    SendEnvironmentPacket (char const *name_equal_value,
-                           uint32_t timeout_seconds);
+    SendEnvironmentPacket (char const *name_equal_value);
 
     //------------------------------------------------------------------
     /// Sends a "vAttach:PID" where PID is in hex. 
@@ -177,10 +166,6 @@
     /// @param[in] pid
     ///     A process ID for the remote gdb server to attach to.
     ///
-    /// @param[in] timeout_seconds
-    ///     The number of seconds to wait for a response from the remote
-    ///     server.
-    ///
     /// @param[out] response
     ///     The response received from the gdb server. If the return
     ///     value is zero, \a response will contain a stop reply 
@@ -192,7 +177,6 @@
     //------------------------------------------------------------------
     int
     SendAttach (lldb::pid_t pid, 
-                uint32_t timeout_seconds, 
                 StringExtractorGDBRemote& response);
 
 
@@ -240,10 +224,10 @@
     SetWorkingDir (char const *path);
 
     lldb::addr_t
-    AllocateMemory (size_t size, uint32_t permissions, uint32_t timeout_seconds);
+    AllocateMemory (size_t size, uint32_t permissions);
 
     bool
-    DeallocateMemory (lldb::addr_t addr, uint32_t timeout_seconds);
+    DeallocateMemory (lldb::addr_t addr);
 
     bool
     IsRunning() const
@@ -251,12 +235,6 @@
         return m_public_is_running.GetValue();
     }
 
-    bool
-    WaitForNotRunning (const lldb_private::TimeValue *timeout_ptr);
-
-    bool
-    GetHostInfo (uint32_t timeout_seconds);
-
     const lldb_private::ArchSpec &
     GetHostArchitecture ();
     
@@ -298,6 +276,14 @@
     {
         return GetVContSupported ('a');
     }
+    
+    uint32_t 
+    SetPacketTimeout (uint32_t packet_timeout)
+    {
+        const uint32_t old_packet_timeout = m_packet_timeout;
+        m_packet_timeout = packet_timeout;
+        return old_packet_timeout;
+    }
 
 protected:
     typedef std::list<std::string> packet_collection;
@@ -322,6 +308,7 @@
     //------------------------------------------------------------------
     // Classes that inherit from GDBRemoteCommunication can see and modify these
     //------------------------------------------------------------------
+    uint32_t m_packet_timeout;
     lldb::LazyBool m_supports_not_sending_acks;
     lldb::LazyBool m_supports_thread_suffix;
     lldb::LazyBool m_supports_qHostInfo;
@@ -342,7 +329,6 @@
     lldb_private::Predicate<bool> m_async_packet_predicate;
     std::string m_async_packet;
     StringExtractorGDBRemote m_async_response;
-    uint32_t m_async_timeout;
     int m_async_signal; // We were asked to deliver a signal to the inferior process.
     
     lldb_private::ArchSpec m_arch;      // Results from the qHostInfo call

Modified: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp?rev=127392&r1=127391&r2=127392&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp (original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp Wed Mar  9 20:26:48 2011
@@ -233,7 +233,7 @@
                     else
                         packet_len = ::snprintf (packet, sizeof(packet), "g");
                     assert (packet_len < (sizeof(packet) - 1));
-                    if (gdb_comm.SendPacketAndWaitForResponse(packet, response, 1, false))
+                    if (gdb_comm.SendPacketAndWaitForResponse(packet, response, false))
                     {
                         if (response.IsNormalPacket())
                             if (response.GetHexBytes ((void *)m_reg_data.GetDataStart(), m_reg_data.GetByteSize(), '\xcc') == m_reg_data.GetByteSize())
@@ -248,7 +248,7 @@
                     else
                         packet_len = ::snprintf (packet, sizeof(packet), "p%x", reg);
                     assert (packet_len < (sizeof(packet) - 1));
-                    if (gdb_comm.SendPacketAndWaitForResponse(packet, response, 1, false))
+                    if (gdb_comm.SendPacketAndWaitForResponse(packet, response, false))
                         PrivateSetRegisterValue (reg, response);
                 }
             }
@@ -355,7 +355,6 @@
                     if (gdb_comm.SendPacketAndWaitForResponse(packet.GetString().c_str(),
                                                               packet.GetString().size(),
                                                               response,
-                                                              1,
                                                               false))
                     {
                         SetAllRegisterValid (false);
@@ -382,7 +381,6 @@
                     if (gdb_comm.SendPacketAndWaitForResponse(packet.GetString().c_str(),
                                                               packet.GetString().size(),
                                                               response,
-                                                              1,
                                                               false))
                     {
                         if (response.IsOKPacket())
@@ -418,7 +416,7 @@
                 packet_len = ::snprintf (packet, sizeof(packet), "g");
             assert (packet_len < (sizeof(packet) - 1));
 
-            if (gdb_comm.SendPacketAndWaitForResponse(packet, packet_len, response, 1, false))
+            if (gdb_comm.SendPacketAndWaitForResponse(packet, packet_len, response, false))
             {
                 if (response.IsErrorPacket())
                     return false;
@@ -456,7 +454,6 @@
             if (gdb_comm.SendPacketAndWaitForResponse((const char *)data_sp->GetBytes(), 
                                                       data_sp->GetByteSize(), 
                                                       response, 
-                                                      1, 
                                                       false))
             {
                 if (response.IsOKPacket())

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=127392&r1=127391&r2=127392&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp (original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp Wed Mar  9 20:26:48 2011
@@ -118,7 +118,6 @@
     m_continue_s_tids (),
     m_continue_S_tids (),
     m_dispatch_queue_offsets_addr (LLDB_INVALID_ADDRESS),
-    m_packet_timeout (1),
     m_max_memory_size (512),
     m_waiting_for_attach (false),
     m_local_debugserver (true),
@@ -179,7 +178,7 @@
         const int packet_len = ::snprintf (packet, sizeof(packet), "qRegisterInfo%x", reg_num);
         assert (packet_len < sizeof(packet));
         StringExtractorGDBRemote response;
-        if (m_gdb_comm.SendPacketAndWaitForResponse(packet, packet_len, response, 2, false))
+        if (m_gdb_comm.SendPacketAndWaitForResponse(packet, packet_len, response, false))
         {
             packet_type = response.GetType();
             if (packet_type == StringExtractorGDBRemote::eResponse)
@@ -353,7 +352,7 @@
         return error;
     StartAsyncThread ();
 
-    lldb::pid_t pid = m_gdb_comm.GetCurrentProcessID (m_packet_timeout);
+    lldb::pid_t pid = m_gdb_comm.GetCurrentProcessID ();
     if (pid == LLDB_INVALID_PROCESS_ID)
     {
         // We don't have a valid process ID, so note that we are connected
@@ -366,7 +365,7 @@
         // We have a valid process
         SetID (pid);
         StringExtractorGDBRemote response;
-        if (m_gdb_comm.SendPacketAndWaitForResponse("?", 1, response, m_packet_timeout, false))
+        if (m_gdb_comm.SendPacketAndWaitForResponse("?", 1, response, false))
         {
             const StateType state = SetThreadStopInfo (response);
             if (state == eStateStopped)
@@ -499,19 +498,20 @@
                 const char *env_entry;
                 for (int i=0; (env_entry = envp[i]); ++i)
                 {
-                    if (m_gdb_comm.SendEnvironmentPacket(env_entry, m_packet_timeout) != 0)
+                    if (m_gdb_comm.SendEnvironmentPacket(env_entry) != 0)
                         break;
                 }
             }
 
-            const uint32_t arg_timeout_seconds = 10;
-            int arg_packet_err = m_gdb_comm.SendArgumentsPacket (argv, arg_timeout_seconds);
+            const uint32_t old_packet_timeout = m_gdb_comm.SetPacketTimeout (10);
+            int arg_packet_err = m_gdb_comm.SendArgumentsPacket (argv);
+            m_gdb_comm.SetPacketTimeout (old_packet_timeout);
             if (arg_packet_err == 0)
             {
                 std::string error_str;
-                if (m_gdb_comm.GetLaunchSuccess (m_packet_timeout, error_str))
+                if (m_gdb_comm.GetLaunchSuccess (error_str))
                 {
-                    SetID (m_gdb_comm.GetCurrentProcessID (m_packet_timeout));
+                    SetID (m_gdb_comm.GetCurrentProcessID ());
                 }
                 else
                 {
@@ -530,7 +530,7 @@
             }
 
             StringExtractorGDBRemote response;
-            if (m_gdb_comm.SendPacketAndWaitForResponse("?", 1, response, m_packet_timeout, false))
+            if (m_gdb_comm.SendPacketAndWaitForResponse("?", 1, response, false))
             {
                 SetPrivateState (SetThreadStopInfo (response));
                 
@@ -1090,9 +1090,9 @@
 
         Error err;
         StringExtractorGDBRemote response;
-        for (m_gdb_comm.SendPacketAndWaitForResponse("qfThreadInfo", response, 1, false);
+        for (m_gdb_comm.SendPacketAndWaitForResponse("qfThreadInfo", response, false);
              response.IsNormalPacket();
-             m_gdb_comm.SendPacketAndWaitForResponse("qsThreadInfo", response, 1, false))
+             m_gdb_comm.SendPacketAndWaitForResponse("qsThreadInfo", response, false))
         {
             char ch = response.GetChar();
             if (ch == 'l')
@@ -1139,7 +1139,7 @@
                 // sure we know about our registers
                 if (GetID() == LLDB_INVALID_PROCESS_ID)
                 {
-                    lldb::pid_t pid = m_gdb_comm.GetCurrentProcessID (1);
+                    lldb::pid_t pid = m_gdb_comm.GetCurrentProcessID ();
                     if (pid != LLDB_INVALID_PROCESS_ID)
                         SetID (pid);
                 }
@@ -1465,7 +1465,7 @@
 
             StringExtractorGDBRemote response;
             bool send_async = true;
-            if (m_gdb_comm.SendPacketAndWaitForResponse("k", 1, response, 2, send_async))
+            if (m_gdb_comm.SendPacketAndWaitForResponse("k", 1, response, send_async))
             {
                 char packet_cmd = response.GetChar(0);
 
@@ -1505,7 +1505,7 @@
     if (!m_gdb_comm.IsRunning())
     {
         StringExtractorGDBRemote response;
-        if (m_gdb_comm.SendPacketAndWaitForResponse("qShlibInfoAddr", ::strlen ("qShlibInfoAddr"), response, 2, false))
+        if (m_gdb_comm.SendPacketAndWaitForResponse("qShlibInfoAddr", ::strlen ("qShlibInfoAddr"), response, false))
         {
             if (response.IsNormalPacket())
                 return response.GetHexMaxU64(false, LLDB_INVALID_ADDRESS);
@@ -1532,7 +1532,7 @@
     const int packet_len = ::snprintf (packet, sizeof(packet), "m%llx,%zx", (uint64_t)addr, size);
     assert (packet_len + 1 < sizeof(packet));
     StringExtractorGDBRemote response;
-    if (m_gdb_comm.SendPacketAndWaitForResponse(packet, packet_len, response, 2, true))
+    if (m_gdb_comm.SendPacketAndWaitForResponse(packet, packet_len, response, true))
     {
         if (response.IsNormalPacket())
         {
@@ -1560,7 +1560,7 @@
     packet.Printf("M%llx,%zx:", addr, size);
     packet.PutBytesAsRawHex8(buf, size, lldb::endian::InlHostByteOrder(), lldb::endian::InlHostByteOrder());
     StringExtractorGDBRemote response;
-    if (m_gdb_comm.SendPacketAndWaitForResponse(packet.GetData(), packet.GetSize(), response, 2, true))
+    if (m_gdb_comm.SendPacketAndWaitForResponse(packet.GetData(), packet.GetSize(), response, true))
     {
         if (response.IsOKPacket())
         {
@@ -1584,7 +1584,7 @@
 lldb::addr_t
 ProcessGDBRemote::DoAllocateMemory (size_t size, uint32_t permissions, Error &error)
 {
-    addr_t allocated_addr = m_gdb_comm.AllocateMemory (size, permissions, m_packet_timeout);
+    addr_t allocated_addr = m_gdb_comm.AllocateMemory (size, permissions);
     if (allocated_addr == LLDB_INVALID_ADDRESS)
         error.SetErrorStringWithFormat("unable to allocate %zu bytes of memory with permissions %u", size, permissions);
     else
@@ -1596,7 +1596,7 @@
 ProcessGDBRemote::DoDeallocateMemory (lldb::addr_t addr)
 {
     Error error; 
-    if (!m_gdb_comm.DeallocateMemory (addr, m_packet_timeout))
+    if (!m_gdb_comm.DeallocateMemory (addr))
         error.SetErrorStringWithFormat("unable to deallocate memory at 0x%llx", addr);
     return error;
 }
@@ -1685,7 +1685,7 @@
             const int packet_len = ::snprintf (packet, sizeof(packet), "Z0,%llx,%zx", addr, bp_op_size);
             assert (packet_len + 1 < sizeof(packet));
             StringExtractorGDBRemote response;
-            if (m_gdb_comm.SendPacketAndWaitForResponse(packet, packet_len, response, 2, true))
+            if (m_gdb_comm.SendPacketAndWaitForResponse(packet, packet_len, response, true))
             {
                 if (response.IsUnsupportedPacket())
                 {
@@ -1753,7 +1753,7 @@
                 const int packet_len = ::snprintf (packet, sizeof(packet), "z0,%llx,%zx", addr, bp_op_size);
                 assert (packet_len + 1 < sizeof(packet));
                 StringExtractorGDBRemote response;
-                if (m_gdb_comm.SendPacketAndWaitForResponse(packet, packet_len, response, 2, true))
+                if (m_gdb_comm.SendPacketAndWaitForResponse(packet, packet_len, response, true))
                 {
                     if (response.IsUnsupportedPacket())
                     {
@@ -2166,7 +2166,7 @@
         packet_len = ::snprintf (packet, sizeof(packet), "Hg%x", tid);
     assert (packet_len + 1 < sizeof(packet));
     StringExtractorGDBRemote response;
-    if (m_gdb_comm.SendPacketAndWaitForResponse(packet, packet_len, response, 2, false))
+    if (m_gdb_comm.SendPacketAndWaitForResponse(packet, packet_len, response, false))
     {
         if (response.IsOKPacket())
         {
@@ -2192,7 +2192,7 @@
 
     assert (packet_len + 1 < sizeof(packet));
     StringExtractorGDBRemote response;
-    if (m_gdb_comm.SendPacketAndWaitForResponse(packet, packet_len, response, 2, false))
+    if (m_gdb_comm.SendPacketAndWaitForResponse(packet, packet_len, response, false))
     {
         if (response.IsOKPacket())
         {

Modified: lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h?rev=127392&r1=127391&r2=127392&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h (original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h Wed Mar  9 20:26:48 2011
@@ -331,7 +331,6 @@
     tid_collection m_continue_s_tids;                  // 's' for step
     tid_sig_collection m_continue_S_tids; // 'S' for step with signal
     lldb::addr_t m_dispatch_queue_offsets_addr;
-    uint32_t m_packet_timeout;
     size_t m_max_memory_size;       // The maximum number of bytes to read/write when reading and writing memory
     bool m_waiting_for_attach;
     bool m_local_debugserver;  // Is the debugserver process we are talking to local or on another machine.

Modified: lldb/trunk/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp?rev=127392&r1=127391&r2=127392&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp (original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp Wed Mar  9 20:26:48 2011
@@ -264,7 +264,7 @@
         char packet[256];
         ::snprintf(packet, sizeof(packet), "qThreadStopInfo%x", GetID());
         StringExtractorGDBRemote stop_packet;
-        if (GetGDBProcess().GetGDBRemote().SendPacketAndWaitForResponse(packet, stop_packet, 1, false))
+        if (GetGDBProcess().GetGDBRemote().SendPacketAndWaitForResponse(packet, stop_packet, false))
         {
             GetGDBProcess().SetThreadStopInfo (stop_packet);
         }





More information about the lldb-commits mailing list