[Lldb-commits] [lldb] r202062 - Fix handling of gdbserver binary packets with escape characters.

Steve Pucci spucci at google.com
Mon Feb 24 11:07:30 PST 2014


Author: spucci
Date: Mon Feb 24 13:07:29 2014
New Revision: 202062

URL: http://llvm.org/viewvc/llvm-project?rev=202062&view=rev
Log:
Fix handling of gdbserver binary packets with escape characters.

We were not properly handling the escape character 0x7d ('}') in responses
from gdbserver which used the binary protocol.

Modified:
    lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp

Modified: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp?rev=202062&r1=202061&r2=202062&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp (original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp Mon Feb 24 13:07:29 2014
@@ -497,6 +497,13 @@ GDBRemoteCommunication::CheckForPacket (
                     for (int i = 0; i < repeat_count; ++i)
                         packet_str.push_back(char_to_repeat);
                 }
+                else if (*c == 0x7d)
+                {
+                    // 0x7d is the escape character.  The next character is to
+                    // be XOR'd with 0x20.
+                    char escapee = *++c ^ 0x20;
+                    packet_str.push_back(escapee);
+                }
                 else
                 {
                     packet_str.push_back(*c);





More information about the lldb-commits mailing list