[Lldb-commits] [lldb] r218002 - Fix the ability of "lldb-platform" to upload files.

Greg Clayton gclayton at apple.com
Wed Sep 17 17:20:51 PDT 2014


Author: gclayton
Date: Wed Sep 17 19:20:51 2014
New Revision: 218002

URL: http://llvm.org/viewvc/llvm-project?rev=218002&view=rev
Log:
Fix the ability of "lldb-platform" to upload files.

The issue was GDBRemoteCommunication::CheckForPacket() already fixes up any prefixed bytes (0x7d followed by value that is XOR'ed with 0x20). If we do this again, we cause binary packets to lose bytes.

This allows lldb-platform to be able to upload binaries and debug them remotely.

Modified:
    lldb/trunk/source/Utility/StringExtractorGDBRemote.cpp

Modified: lldb/trunk/source/Utility/StringExtractorGDBRemote.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Utility/StringExtractorGDBRemote.cpp?rev=218002&r1=218001&r2=218002&view=diff
==============================================================================
--- lldb/trunk/source/Utility/StringExtractorGDBRemote.cpp (original)
+++ lldb/trunk/source/Utility/StringExtractorGDBRemote.cpp Wed Sep 17 19:20:51 2014
@@ -346,14 +346,15 @@ StringExtractorGDBRemote::GetError ()
 size_t
 StringExtractorGDBRemote::GetEscapedBinaryData (std::string &str)
 {
+    // Just get the data bytes in the string as GDBRemoteCommunication::CheckForPacket()
+    // already removes any 0x7d escaped characters. If any 0x7d characters are left in
+    // the packet, then they are supposed to be there...
     str.clear();
-    char ch;
-    while (GetBytesLeft())
+    const size_t bytes_left = GetBytesLeft();
+    if (bytes_left > 0)
     {
-        ch = GetChar();
-        if (ch == 0x7d)
-            ch = (GetChar() ^ 0x20);
-        str.append(1,ch);
+        str.assign(m_packet, m_index, bytes_left);
+        m_index += bytes_left;
     }
     return str.size();
 }





More information about the lldb-commits mailing list