[Lldb-commits] [lldb] r218001 - Hex encode the triple values in case they contain special characters.

Greg Clayton gclayton at apple.com
Wed Sep 17 17:18:32 PDT 2014


Author: gclayton
Date: Wed Sep 17 19:18:32 2014
New Revision: 218001

URL: http://llvm.org/viewvc/llvm-project?rev=218001&view=rev
Log:
Hex encode the triple values in case they contain special characters.

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

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=218001&r1=218000&r2=218001&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp (original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp Wed Sep 17 19:18:32 2014
@@ -1643,7 +1643,9 @@ GDBRemoteCommunicationClient::GetHostInf
                     }
                     else if (name.compare("triple") == 0)
                     {
-                        triple.swap(value);
+                        extractor.GetStringRef ().swap (value);
+                        extractor.SetFilePos(0);
+                        extractor.GetHexByteString (triple);
                         ++num_keys_decoded;
                     }
                     else if (name.compare ("distribution_id") == 0)
@@ -2331,6 +2333,10 @@ GDBRemoteCommunicationClient::DecodeProc
             }
             else if (name.compare("triple") == 0)
             {
+                StringExtractor extractor;
+                extractor.GetStringRef().swap(value);
+                extractor.SetFilePos(0);
+                extractor.GetHexByteString (value);
                 process_info.GetArchitecture ().SetTriple (value.c_str());
             }
             else if (name.compare("name") == 0)
@@ -2447,7 +2453,10 @@ GDBRemoteCommunicationClient::GetCurrent
                 }
                 else if (name.compare("triple") == 0)
                 {
-                    triple = value;
+                    StringExtractor extractor;
+                    extractor.GetStringRef().swap(value);
+                    extractor.SetFilePos(0);
+                    extractor.GetHexByteString (triple);
                     ++num_keys_decoded;
                 }
                 else if (name.compare("ostype") == 0)

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=218001&r1=218000&r2=218001&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp (original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp Wed Sep 17 19:18:32 2014
@@ -1207,7 +1207,7 @@ GDBRemoteCommunicationServer::Handle_qHo
     ArchSpec host_arch(HostInfo::GetArchitecture());
     const llvm::Triple &host_triple = host_arch.GetTriple();
     response.PutCString("triple:");
-    response.PutCString(host_triple.getTriple().c_str());
+    response.PutCStringAsRawHex8(host_triple.getTriple().c_str());
     response.Printf (";ptrsize:%u;",host_arch.GetAddressByteSize());
 
     const char* distribution_id = host_arch.GetDistributionId ().AsCString ();
@@ -1325,7 +1325,7 @@ CreateProcessInfoResponse (const Process
     {
         const llvm::Triple &proc_triple = proc_arch.GetTriple();
         response.PutCString("triple:");
-        response.PutCString(proc_triple.getTriple().c_str());
+        response.PutCStringAsRawHex8(proc_triple.getTriple().c_str());
         response.PutChar(';');
     }
 }
@@ -1361,7 +1361,10 @@ CreateProcessInfoResponse_DebugServerSty
             response.Printf ("vendor:%s;", vendor.c_str ());
 #else
         // We'll send the triple.
-        response.Printf ("triple:%s;", proc_triple.getTriple().c_str ());
+        response.PutCString("triple:");
+        response.PutCStringAsRawHex8(proc_triple.getTriple().c_str());
+        response.PutChar(';');
+
 #endif
         std::string ostype = proc_triple.getOSName ();
         // Adjust so ostype reports ios for Apple/ARM and Apple/ARM64.





More information about the lldb-commits mailing list