[Lldb-commits] [PATCH] Corrections for docs/lldb-gdb-remote.txt

Matthew Gardiner mg11 at csr.com
Wed Jun 11 22:10:56 PDT 2014

Todd Fiala wrote:
> Hey Matthew,
> > 1. I've changed the base of cputype and cpusubtype to reflect the 
> fact that the code assumes base-16, and furthermore to be consistent 
> with qProcessInfo.
> I'm looking at the debugserver code (RNBRemote.cpp) and 
> lldb-platform/llgs code (GDBRemoteCommunicationServer.cpp) that 
> produce those values.  The cputype and cpusubtype all are being 
> written decimal as far as a I read it.  What context are you seeing 
> hexadecimal?
> Thanks!
> -Todd

Hi Todd,

I'm seeing the context as being assumed as hex in the parsing of the 
*inbound* qHostInfo in lldb.

Check out: GDBRemoteCommunicationClient::GetHostInfo in 

see this code:

if (name.compare("cputype") == 0)
    // exception type in big endian hex
    cpu = Args::StringToUInt32 (value.c_str(), LLDB_INVALID_CPUTYPE, 0);
else if (name.compare("cpusubtype") == 0)
  // exception count in big endian hex
   sub = Args::StringToUInt32 (value.c_str(), 0, 0);

the third argument to StringToUInt32  is 0, which is passed to strtoul, 
which is interpreted as base-16. Thus the parsing side in lldb assumes 
these are base-16.

A side issue is that the documentation to qProcessInfo in 
lldb-gdb-remote.txt which says base-16 for these same datas.

So we have inconsistency in the docs between qProcessInfo and qHostInfo, 
and a bug between the sender and receiver of qHostInfo.


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