diff options
author | Greg Clayton <gclayton@apple.com> | 2011-01-08 03:17:57 +0000 |
---|---|---|
committer | Greg Clayton <gclayton@apple.com> | 2011-01-08 03:17:57 +0000 |
commit | de9d0494ef474b4db5d24ad89357629d08804499 (patch) | |
tree | ddeb5c4d5f7411c897017b03e7c6effee66924ec /lldb/source/Plugins/Process/gdb-remote | |
parent | 671cabeeb5e80036ad66c3129aa2a4d9cc599b43 (diff) | |
download | bcm5719-llvm-de9d0494ef474b4db5d24ad89357629d08804499.tar.gz bcm5719-llvm-de9d0494ef474b4db5d24ad89357629d08804499.zip |
Modified the stop reply packet to be able to send the thread name using the
new "hexname" key for the "key:value;" duple that is part of the packet. This
allows for thread names to contain special characters such as $ # : ; + -
Debugserver now detects if the thread name contains special characters and
sends the chars in hex format if needed.
llvm-svn: 123053
Diffstat (limited to 'lldb/source/Plugins/Process/gdb-remote')
-rw-r--r-- | lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp | 19 | ||||
-rw-r--r-- | lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp | 9 |
2 files changed, 22 insertions, 6 deletions
diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp index d19e19802da..1f4d63d482a 100644 --- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp @@ -517,18 +517,25 @@ GDBRemoteCommunication::WaitForPacketNoLock (StringExtractorGDBRemote &response, std::string &response_str = response.GetStringRef(); if (packet_data[0] == '$') { - assert (packet_size >= 4); // Must have at least '$#CC' where CC is checksum - assert (packet_data[packet_size-3] == '#'); - assert (::isxdigit (packet_data[packet_size-2])); // Must be checksum hex byte - assert (::isxdigit (packet_data[packet_size-1])); // Must be checksum hex byte - response_str.assign (packet_data + 1, packet_size - 4); + bool success = false; + if (packet_size < 4) + ::fprintf (stderr, "Packet that starts with $ is too short: '%s'\n", packet_data); + else if (packet_data[packet_size-3] != '#' || + !::isxdigit (packet_data[packet_size-2]) || + !::isxdigit (packet_data[packet_size-1])) + ::fprintf (stderr, "Invalid checksum footer for packet: '%s'\n", packet_data); + else + success = true; + + if (success) + response_str.assign (packet_data + 1, packet_size - 4); if (m_send_acks) { char packet_checksum = strtol (&packet_data[packet_size-2], NULL, 16); char actual_checksum = CalculcateChecksum (&response_str[0], response_str.size()); checksum_error = packet_checksum != actual_checksum; // Send the ack or nack if needed - if (checksum_error) + if (checksum_error || !success) SendAck('-'); else SendAck('+'); diff --git a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp index 934c00a3d1a..3775d5b9ff6 100644 --- a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp @@ -1036,6 +1036,15 @@ ProcessGDBRemote::SetThreadStopInfo (StringExtractor& stop_packet) // thread in big endian hex tid = Args::StringToUInt32 (value.c_str(), 0, 16); } + else if (name.compare("hexname") == 0) + { + StringExtractor name_extractor; + // Swap "value" over into "name_extractor" + name_extractor.GetStringRef().swap(value); + // Now convert the HEX bytes into a string value + name_extractor.GetHexByteString (value); + thread_name.swap (value); + } else if (name.compare("name") == 0) { thread_name.swap (value); |