diff options
Diffstat (limited to 'lldb/source/Plugins/Process')
6 files changed, 72 insertions, 102 deletions
diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp index 004beb6ea17..a2c6a696cbf 100644 --- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp @@ -35,6 +35,7 @@ using namespace lldb_private; //---------------------------------------------------------------------- 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 @@ GDBRemoteCommunication::GDBRemoteCommunication() : 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 @@ GDBRemoteCommunication::GetSendAcks () { 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 @@ GDBRemoteCommunication::GetThreadSuffixSupported () { 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 @@ GDBRemoteCommunication::GetVContSupported (char flavor) 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 @@ GDBRemoteCommunication::SendPacketAndWaitForResponse ( 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 @@ GDBRemoteCommunication::SendPacketAndWaitForResponse 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 @@ GDBRemoteCommunication::SendPacketAndWaitForResponse { 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 @@ GDBRemoteCommunication::SendContinuePacketAndWaitForResponse { 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 @@ GDBRemoteCommunication::SendContinuePacketAndWaitForResponse 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 @@ GDBRemoteCommunication::SendPacketNoLock (const char *payload, size_t payload_le { if (GetSendAcks ()) { - if (GetAck (1) != '+') + if (GetAck () != '+') return 0; } } @@ -586,10 +581,10 @@ GDBRemoteCommunication::SendPacketNoLock (const char *payload, size_t payload_le } 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 @@ GDBRemoteCommunication::SendInterrupt } 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 @@ GDBRemoteCommunication::AppendBytesToCache (const uint8_t *src, size_t src_len, } 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 @@ GDBRemoteCommunication::GetCurrentProcessID (uint32_t timeout_seconds) } 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 @@ GDBRemoteCommunication::GetLaunchSuccess (uint32_t timeout_seconds, std::string } int -GDBRemoteCommunication::SendArgumentsPacket (char const *argv[], uint32_t timeout_seconds) +GDBRemoteCommunication::SendArgumentsPacket (char const *argv[]) { if (argv && argv[0]) { @@ -913,7 +902,7 @@ GDBRemoteCommunication::SendArgumentsPacket (char const *argv[], uint32_t timeou } 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 @@ GDBRemoteCommunication::SendArgumentsPacket (char const *argv[], uint32_t timeou } 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 @@ GDBRemoteCommunication::GetHostInfo () 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 @@ int GDBRemoteCommunication::SendAttach ( lldb::pid_t pid, - uint32_t timeout_seconds, StringExtractorGDBRemote& response ) { @@ -1021,7 +1009,7 @@ GDBRemoteCommunication::SendAttach 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 @@ GDBRemoteCommunication::GetAddressByteSize () } 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 @@ GDBRemoteCommunication::AllocateMemory (size_t size, uint32_t permissions, uint3 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 @@ GDBRemoteCommunication::AllocateMemory (size_t size, uint32_t permissions, uint3 } 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 @@ GDBRemoteCommunication::SetSTDIN (char const *path) 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 @@ GDBRemoteCommunication::SetSTDOUT (char const *path) 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 @@ GDBRemoteCommunication::SetSTDERR (char const *path) 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 @@ GDBRemoteCommunication::SetWorkingDir (char const *path) 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 @@ GDBRemoteCommunication::SetDisableASLR (bool enable) 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; diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h index 8d24f2ad442..dbd1bd0e32b 100644 --- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h +++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h @@ -56,14 +56,12 @@ public: 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 @@ public: // 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 @@ public: const lldb_private::TimeValue* timeout); char - GetAck (uint32_t timeout_seconds); + GetAck (); size_t SendAck (); @@ -120,10 +118,10 @@ public: 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 @@ public: /// 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 @@ public: /// 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 @@ public: /// 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 @@ public: /// 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 @@ public: /// @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 @@ public: //------------------------------------------------------------------ int SendAttach (lldb::pid_t pid, - uint32_t timeout_seconds, StringExtractorGDBRemote& response); @@ -240,10 +224,10 @@ public: 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 @@ public: 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 @@ public: { 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 @@ protected: //------------------------------------------------------------------ // 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 @@ protected: 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 diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp index 873974f0a1d..bbda3c697d5 100644 --- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp @@ -233,7 +233,7 @@ GDBRemoteRegisterContext::ReadRegisterBytes (uint32_t reg, DataExtractor &data) 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 @@ GDBRemoteRegisterContext::ReadRegisterBytes (uint32_t reg, DataExtractor &data) 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 @@ GDBRemoteRegisterContext::WriteRegisterBytes (uint32_t reg, DataExtractor &data, if (gdb_comm.SendPacketAndWaitForResponse(packet.GetString().c_str(), packet.GetString().size(), response, - 1, false)) { SetAllRegisterValid (false); @@ -382,7 +381,6 @@ GDBRemoteRegisterContext::WriteRegisterBytes (uint32_t reg, DataExtractor &data, if (gdb_comm.SendPacketAndWaitForResponse(packet.GetString().c_str(), packet.GetString().size(), response, - 1, false)) { if (response.IsOKPacket()) @@ -418,7 +416,7 @@ GDBRemoteRegisterContext::ReadAllRegisterValues (lldb::DataBufferSP &data_sp) 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 @@ GDBRemoteRegisterContext::WriteAllRegisterValues (const lldb::DataBufferSP &data if (gdb_comm.SendPacketAndWaitForResponse((const char *)data_sp->GetBytes(), data_sp->GetByteSize(), response, - 1, false)) { if (response.IsOKPacket()) diff --git a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp index ab6c9150b97..2ae589d551c 100644 --- a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp @@ -118,7 +118,6 @@ ProcessGDBRemote::ProcessGDBRemote(Target& target, Listener &listener) : 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 @@ ProcessGDBRemote::BuildDynamicRegisterInfo (bool force) 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 @@ ProcessGDBRemote::DoConnectRemote (const char *remote_url) 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 @@ ProcessGDBRemote::DoConnectRemote (const char *remote_url) // 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 @@ ProcessGDBRemote::DoLaunch 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 @@ ProcessGDBRemote::DoLaunch } 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 @@ ProcessGDBRemote::UpdateThreadListIfNeeded () 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 @@ ProcessGDBRemote::SetThreadStopInfo (StringExtractor& stop_packet) // 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 @@ ProcessGDBRemote::DoDestroy () 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 @@ ProcessGDBRemote::GetImageInfoAddress() 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 @@ ProcessGDBRemote::DoReadMemory (addr_t addr, void *buf, size_t size, Error &erro 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 @@ ProcessGDBRemote::DoWriteMemory (addr_t addr, const void *buf, size_t size, Erro 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 @@ ProcessGDBRemote::DoWriteMemory (addr_t addr, const void *buf, size_t size, Erro 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 @@ Error 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 @@ ProcessGDBRemote::EnableBreakpoint (BreakpointSite *bp_site) 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 @@ ProcessGDBRemote::DisableBreakpoint (BreakpointSite *bp_site) 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 @@ ProcessGDBRemote::SetCurrentGDBRemoteThread (int tid) 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 @@ ProcessGDBRemote::SetCurrentGDBRemoteThreadForRun (int 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()) { diff --git a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h index c8fb6fccedf..4bb337fb6d9 100644 --- a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h +++ b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h @@ -331,7 +331,6 @@ protected: 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. diff --git a/lldb/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp b/lldb/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp index 99ce588a30d..9955409226a 100644 --- a/lldb/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp @@ -264,7 +264,7 @@ ThreadGDBRemote::GetPrivateStopReason () 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); } |