summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/Process/gdb-remote
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/source/Plugins/Process/gdb-remote')
-rw-r--r--lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp19
-rw-r--r--lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp6
-rw-r--r--lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp21
3 files changed, 24 insertions, 22 deletions
diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
index ac9985548f4..c5e11ef33de 100644
--- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
@@ -138,7 +138,7 @@ GDBRemoteCommunication::SendPacketNoLock (const char *payload, size_t payload_le
LogSP log (ProcessGDBRemoteLog::GetLogIfAllCategoriesSet (GDBR_LOG_PACKETS));
if (log)
- log->Printf ("send packet: %s", packet.GetData());
+ log->Printf ("send packet: %.*s", (int)packet.GetSize(), packet.GetData());
ConnectionStatus status = eConnectionStatusSuccess;
size_t bytes_written = Write (packet.GetData(), packet.GetSize(), status, NULL);
if (bytes_written == packet.GetSize())
@@ -156,7 +156,7 @@ GDBRemoteCommunication::SendPacketNoLock (const char *payload, size_t payload_le
{
LogSP log (ProcessGDBRemoteLog::GetLogIfAllCategoriesSet (GDBR_LOG_PACKETS));
if (log)
- log->Printf ("error: failed to send packet: %s", packet.GetData());
+ log->Printf ("error: failed to send packet: %.*s", (int)packet.GetSize(), packet.GetData());
}
return bytes_written;
}
@@ -218,11 +218,11 @@ GDBRemoteCommunication::WaitForPacketNoLock (StringExtractorGDBRemote &packet, c
const EventDataBytes *event_bytes = EventDataBytes::GetEventDataFromEvent(event_sp.get());
if (event_bytes)
{
- const char * packet_data = (const char *)event_bytes->GetBytes();
+ const char *packet_data = (const char *)event_bytes->GetBytes();
+ const uint32_t packet_size = event_bytes->GetByteSize();
LogSP log (ProcessGDBRemoteLog::GetLogIfAllCategoriesSet (GDBR_LOG_PACKETS));
if (log)
- log->Printf ("read packet: %s", packet_data);
- const size_t packet_size = event_bytes->GetByteSize();
+ log->Printf ("read packet: %.*s", packet_size, packet_data);
if (packet_data && packet_size > 0)
{
std::string &packet_str = packet.GetStringRef();
@@ -242,9 +242,12 @@ GDBRemoteCommunication::WaitForPacketNoLock (StringExtractorGDBRemote &packet, c
packet_str.assign (packet_data + 1, packet_size - 4);
if (GetSendAcks ())
{
- char packet_checksum = strtol (&packet_data[packet_size-2], NULL, 16);
- char actual_checksum = CalculcateChecksum (&packet_str[0], packet_str.size());
- checksum_error = packet_checksum != actual_checksum;
+ if (success)
+ {
+ char packet_checksum = strtol (&packet_data[packet_size-2], NULL, 16);
+ char actual_checksum = CalculcateChecksum (&packet_str[0], packet_str.size());
+ checksum_error = packet_checksum != actual_checksum;
+ }
// Send the ack or nack if needed
if (checksum_error || !success)
SendNack();
diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
index bfb4755931b..314d51f55aa 100644
--- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
@@ -252,7 +252,7 @@ GDBRemoteCommunicationClient::SendPacketAndWaitForResponse
if (GetSequenceMutex (locker))
{
- if (SendPacketNoLock (payload, strlen(payload)))
+ if (SendPacketNoLock (payload, payload_length))
return WaitForPacketNoLock (response, &timeout_time);
}
else
@@ -1597,8 +1597,8 @@ GDBRemoteCommunicationClient::GetThreadStopInfo (uint32_t tid, StringExtractorGD
m_supports_qThreadStopInfo = false;
}
}
- if (SetCurrentThread (tid))
- return GetStopReply (response);
+// if (SetCurrentThread (tid))
+// return GetStopReply (response);
return false;
}
diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp
index 7c4c39d2f45..62472732d17 100644
--- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp
@@ -356,18 +356,17 @@ GDBRemoteRegisterContext::ReadAllRegisterValues (lldb::DataBufferSP &data_sp)
if (response.IsErrorResponse())
return false;
- response.GetStringRef().insert(0, 1, 'G');
- if (thread_suffix_supported)
+ std::string &response_str = response.GetStringRef();
+ if (isxdigit(response_str[0]))
{
- char thread_id_cstr[64];
- ::snprintf (thread_id_cstr, sizeof(thread_id_cstr), ";thread:%4.4x;", m_thread.GetID());
- response.GetStringRef().append (thread_id_cstr);
- }
- const char *g_data = response.GetStringRef().c_str();
- size_t g_data_len = strspn(g_data + 1, "0123456789abcdefABCDEF");
- if (g_data_len > 0)
- {
- data_sp.reset (new DataBufferHeap (g_data, g_data_len));
+ response_str.insert(0, 1, 'G');
+ if (thread_suffix_supported)
+ {
+ char thread_id_cstr[64];
+ ::snprintf (thread_id_cstr, sizeof(thread_id_cstr), ";thread:%4.4x;", m_thread.GetID());
+ response_str.append (thread_id_cstr);
+ }
+ data_sp.reset (new DataBufferHeap (response_str.c_str(), response_str.size()));
return true;
}
}
OpenPOWER on IntegriCloud