Change the encoding of the Triple string exchanged across GDB-RSP
authorMatthew Gardiner <mg11@csr.com>
Fri, 1 Aug 2014 05:12:23 +0000 (05:12 +0000)
committerMatthew Gardiner <mg11@csr.com>
Fri, 1 Aug 2014 05:12:23 +0000 (05:12 +0000)
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

llvm-svn: 214480

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

index 01ab19d..d333a1c 100644 (file)
@@ -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
 //----------------------------------------------------------------------
 
 //----------------------------------------------------------------------
index 3eb3d97..b87b8c9 100644 (file)
@@ -1642,10 +1642,7 @@ GDBRemoteCommunicationClient::GetHostInfo (bool force)
                     }
                     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::DecodeProcessInfoResponse (StringExtractorGDBRemot
             }
             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::FindProcesses (const ProcessInstanceInfoMatch &mat
                 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 (';');
             }
         }
index 585b28e..8b1a56c 100644 (file)
@@ -1188,7 +1188,7 @@ GDBRemoteCommunicationServer::Handle_qHostInfo (StringExtractorGDBRemote &packet
     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 ProcessInstanceInfo &proc_info, StreamString &r
     {
         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(';');
     }
 }