Fixed an issue in GDBRemoteCommunicationClient where we weren't listening to
the "payload_length" argument for the "payload" packet data. This meant we
could end up sending random extra data with a packet depending on how the
packet was constructed.
Fixed GDBRemoteRegisterContext to properly save and restore all registers.
Previous fixes had been added to work around the "payload_length" issues fixed
above and aren't needed anymore.
Fix logging in GDBRemoteCommunication to make sure we log the correct packet
data being sent by using the packet length when dumping the packet contents.
Added register definitions for 'arm-lldb' in the "disasm-gdb-remote.pl" script
so if you have a register dump from the GDB remote that doesn't include the
qRegisterInfo packets, you can manually tell the script which registers are
which.
git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@131715 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp b/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
index ac99855..c5e11ef 100644
--- a/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
+++ b/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
@@ -138,7 +138,7 @@
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 @@
{
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 @@
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 @@
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();