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

Matthew Gardiner mg11 at csr.com
Mon Sep 22 00:56:35 PDT 2014


Hi Greg/Jason,

This change, r218001, reverses a change I made: r214480.

I made the change (send triple as plain text), motivated by a discussion
with Jason Molenda, which started here:

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

What's happening here?

thanks
Matt 



On Thu, 2014-09-18 at 00:18 +0000, Greg Clayton wrote:
> 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.
> 
> 
> _______________________________________________
> lldb-commits mailing list
> lldb-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits
> 
> 
>  To report this email as spam click https://www.mailcontrol.com/sr/MZbqvYs5QwJvpeaetUwhCQ== .




Member of the CSR plc group of companies. CSR plc registered in England and Wales, registered number 4187346, registered office Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, United Kingdom
More information can be found at www.csr.com. Keep up to date with CSR on our technical blog, www.csr.com/blog, CSR people blog, www.csr.com/people, YouTube, www.youtube.com/user/CSRplc, Facebook, www.facebook.com/pages/CSR/191038434253534, or follow us on Twitter at www.twitter.com/CSR_plc.
New for 2014, you can now access the wide range of products powered by aptX at www.aptx.com.



More information about the lldb-commits mailing list