[Lldb-commits] [lldb] r214480 - Change the encoding of the Triple string exchanged across GDB-RSP

Matthew Gardiner mg11 at csr.com
Thu Jul 31 22:12:23 PDT 2014


Author: mg11
Date: Fri Aug  1 00:12:23 2014
New Revision: 214480

URL: http://llvm.org/viewvc/llvm-project?rev=214480&view=rev
Log:
Change the encoding of the Triple string exchanged across GDB-RSP
and update documentation to suit, as suggested by Jason Molenda and
discussed in:

http://lists.cs.uiuc.edu/pipermail/lldb-commits/Week-of-Mon-20140721/011978.html

Differential Revision: http://reviews.llvm.org/D4704


Modified:
    lldb/trunk/docs/lldb-gdb-remote.txt
    lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
    lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp

Modified: lldb/trunk/docs/lldb-gdb-remote.txt
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/docs/lldb-gdb-remote.txt?rev=214480&r1=214479&r2=214480&view=diff
==============================================================================
--- lldb/trunk/docs/lldb-gdb-remote.txt (original)
+++ lldb/trunk/docs/lldb-gdb-remote.txt Fri Aug  1 00:12:23 2014
@@ -526,7 +526,6 @@ Key value pairs are one of:
 cputype: is a number that is the mach-o CPU type that is being debugged (base 10)
 cpusubtype: is a number that is the mach-o CPU subtype type that is being debugged (base 10)
 triple: a string for the target triple (x86_64-apple-macosx) that can be used to specify arch + vendor + os in one entry
-The triple string must be sent as hexadecimal bytes, for the above example this being 7838365f36342d6170706c652d6d61636f7378 
 vendor: a string for the vendor (apple), not needed if "triple" is specified
 ostype: a string for the OS being debugged (darwin, linux, freebsd), not needed if "triple" is specified
 endian: is one of "little", "big", or "pdp"
@@ -1110,7 +1109,7 @@ for this region.
 //  "all_users"   bool      A boolean value that specifies if processes should
 //                          be listed for all users, not just the user that the 
 //                          platform is running as
-//  "triple"      ascii-hex An ASCII hex target triple string ("x86_64", 
+//  "triple"      string    An ASCII triple string ("x86_64", 
 //                          "x86_64-apple-macosx", "armv7-apple-ios")
 //
 // The response consists of key/value pairs where the key is separated from the
@@ -1120,9 +1119,9 @@ for this region.
 //
 // Sample packet/response:
 // send packet: $qfProcessInfo#00
-// read packet: $pid:60001;ppid:59948;uid:7746;gid:11;euid:7746;egid:11;name:6c6c6462;triple:7838365f36342d6170706c652d6d61636f7378;#00
+// read packet: $pid:60001;ppid:59948;uid:7746;gid:11;euid:7746;egid:11;name:6c6c6462;triple:x86_64-apple-macosx;#00
 // send packet: $qsProcessInfo#00
-// read packet: $pid:59992;ppid:192;uid:7746;gid:11;euid:7746;egid:11;name:6d64776f726b6572;triple:7838365f36342d6170706c652d6d61636f7378;#00
+// read packet: $pid:59992;ppid:192;uid:7746;gid:11;euid:7746;egid:11;name:6d64776f726b6572;triple:x86_64-apple-macosx;#00
 // send packet: $qsProcessInfo#00
 // read packet: $E04#00
 //----------------------------------------------------------------------
@@ -1190,11 +1189,11 @@ for this region.
 //  "euid"        integer   A string value containing the decimal effective user ID
 //  "egid"        integer   A string value containing the decimal effective group ID
 //  "name"        ascii-hex An ASCII hex string that contains the name of the process
-//  "triple"      ascii-hex A target triple ("x86_64-apple-macosx", "armv7-apple-ios")
+//  "triple"      string    A target triple ("x86_64-apple-macosx", "armv7-apple-ios")
 //
 // Sample packet/response:
 // send packet: $qProcessInfoPID:60050#00
-// read packet: $pid:60050;ppid:59948;uid:7746;gid:11;euid:7746;egid:11;name:6c6c6462;triple:7838365f36342d6170706c652d6d61636f7378;#00
+// read packet: $pid:60050;ppid:59948;uid:7746;gid:11;euid:7746;egid:11;name:6c6c6462;triple:x86_64-apple-macosx;#00
 //----------------------------------------------------------------------
 
 //----------------------------------------------------------------------

Modified: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp?rev=214480&r1=214479&r2=214480&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp (original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp Fri Aug  1 00:12:23 2014
@@ -1642,10 +1642,7 @@ GDBRemoteCommunicationClient::GetHostInf
                     }
                     else if (name.compare("triple") == 0)
                     {
-                        // The triple comes as ASCII hex bytes since it contains '-' chars
-                        extractor.GetStringRef().swap(value);
-                        extractor.SetFilePos(0);
-                        extractor.GetHexByteString (triple);
+                        triple.swap(value);
                         ++num_keys_decoded;
                     }
                     else if (name.compare ("distribution_id") == 0)
@@ -2333,10 +2330,6 @@ GDBRemoteCommunicationClient::DecodeProc
             }
             else if (name.compare("triple") == 0)
             {
-                // The triple comes as ASCII hex bytes since it contains '-' chars
-                extractor.GetStringRef().swap(value);
-                extractor.SetFilePos(0);
-                extractor.GetHexByteString (value);
                 process_info.GetArchitecture ().SetTriple (value.c_str());
             }
             else if (name.compare("name") == 0)
@@ -2580,7 +2573,7 @@ GDBRemoteCommunicationClient::FindProces
                 const ArchSpec &match_arch = match_info.GetProcessInfo().GetArchitecture();
                 const llvm::Triple &triple = match_arch.GetTriple();
                 packet.PutCString("triple:");
-                packet.PutCStringAsRawHex8(triple.getTriple().c_str());
+                packet.PutCString(triple.getTriple().c_str());
                 packet.PutChar (';');
             }
         }

Modified: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp?rev=214480&r1=214479&r2=214480&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp (original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp Fri Aug  1 00:12:23 2014
@@ -1188,7 +1188,7 @@ GDBRemoteCommunicationServer::Handle_qHo
     ArchSpec host_arch (Host::GetArchitecture ());
     const llvm::Triple &host_triple = host_arch.GetTriple();
     response.PutCString("triple:");
-    response.PutCStringAsRawHex8(host_triple.getTriple().c_str());
+    response.PutCString(host_triple.getTriple().c_str());
     response.Printf (";ptrsize:%u;",host_arch.GetAddressByteSize());
 
     const char* distribution_id = host_arch.GetDistributionId ().AsCString ();
@@ -1303,7 +1303,7 @@ CreateProcessInfoResponse (const Process
     {
         const llvm::Triple &proc_triple = proc_arch.GetTriple();
         response.PutCString("triple:");
-        response.PutCStringAsRawHex8(proc_triple.getTriple().c_str());
+        response.PutCString(proc_triple.getTriple().c_str());
         response.PutChar(';');
     }
 }





More information about the lldb-commits mailing list