[Lldb-commits] [PATCH] Improvement for lldb-gdb-remote.txt qHostInfo documentation

Todd Fiala tfiala at google.com
Fri Jul 25 07:08:29 PDT 2014


Hey Jason,

 I don’t know about llgs or how much work it would be to change the kalimba
gdbserver stub.

Currently GDBRemoteCommunicationServer, used by both llgs and
lldb-platform, does send the triple as hex encoded via this code:

response.PutCString("triple:");
response.PutCStringAsRawHex8(host_triple.getTriple().c_str());

We can easily not do that as you suggest. Are there any ramifications for
your usage of lldb-platform, though? We’d need to change the receiver code
of that, which would then differ based on which lldb-platform version
you’re talking to.

You might want to try it locally against some older devices to see if that
has any negative consequences. Those went in with Greg’s change in 2011:

Did a lot more work on abtracting and organizing the platforms.

On Mac OS X we now have 3 platforms:
PlatformDarwin - must be subclassed to fill in the missing pure virtual funcs
                 but this implements all the common functionality between
                 remote-macosx and remote-ios. It also allows for another
                 platform to be used (remote-gdb-server for now) when doing
                 remote connections. Keeping this pluggable will allow for
                 flexibility.
PlatformMacOSX - Now implements both local and remote macosx desktop platforms.
PlatformRemoteiOS - Remote only iOS that knows how to locate SDK files in the
                    cached SDK locations on the host.

A new agnostic platform has been created:
PlatformRemoteGDBServer - this implements the platform using the GDB remote
                          protocol and uses the built in lldb_private::Host
                          static functions to implement many queries.

-Todd
​


On Fri, Jul 25, 2014 at 3:23 AM, Matthew Gardiner <mg11 at csr.com> wrote:

> Hi Jason,
>
> Indeed my stub implementation does not rely on the hex/otherwise encoding
> of the triple. I'm happy to revert the patch and change the implementation
> in the GDBRemote code (probably not till next week, though). My main regret
> is not floating my patch on lldb-dev first, but I assumed that the
> implementation was set in stone at that stage.
>
> While we are at it, I also note that distribution_id, os_build, hostname,
> os_kernel are also currently hex encoded in qHostInfo response, so I'm now
> curious as to the encoding rationale to those datas too...
>
> Matt
>
>
>
> Jason Molenda wrote:
>
>> Hi Matthew,
>>
>> If your stub implementation is not locked into hex encoding this triple
>> string, let's change the lldb / stub implementation and the documentation.
>>  It's a mistake and I'd hate to propagate it further.  Yeah, the - and +
>> characters are used for ACK / NACK when a packet consists only of that
>> character but normal packets are bounded by # and $ so we don't need to
>> worry about + and -.  (plus lldb prefers to go into "no-ack" mode as soon
>> as possible anyway :)  We've already got a ton of randomness in the remote
>> protocol because of bugs which get deployed and we need to support them
>> forever.
>>
>> Thanks!
>>
>> On Jul 24, 2014, at 10:22 PM, Matthew Gardiner <mg11 at csr.com> wrote:
>>
>>  Hi Jason,
>>>
>>> Having the triple hex encoded did confuse me for a while in getting my
>>> architecture's stub up and working properly, when the previous
>>> documentation suggested a plain textual representation.
>>>
>>> The comment in GDBRemoteCommunicationClient .cpp "// The triple comes as
>>> ASCII hex bytes since it contains '-' chars" got me thinking, and I
>>> discovered that '-' is used as the *first* byte in a packet to specify a
>>> NACK (in section E.11 Packet Acknowledgement of the GDB documentation).
>>>
>>> I agree that the need to escape the '-' is probably unfounded since in
>>> the case of qHostInfo the '-' is wedged between $ and # characters anyway.
>>>
>>> I'm happy to proceed with either presentation - so long as the
>>> documentation is correct.
>>>
>>> Matt
>>>
>>>
>>> Jason Molenda wrote:
>>>
>>>> The change to make the documentation match the implementation is fine.
>>>>
>>>> But I don't see why the triple is sent hex encoded.  The comment & hex
>>>> encoding was added in r128193 from March 23 2011 by Greg Clayton.  AFAIK
>>>> '-' is not special in gdb-remote protocol.  Characters that can be a
>>>> problem are $, #, *, }.
>>>>
>>>> Greg?
>>>>
>>>> J
>>>>
>>>>
>>>>  On Jul 23, 2014, at 6:23 AM, Matthew Gardiner <mg11 at csr.com> wrote:
>>>>>
>>>>> Folks,
>>>>>
>>>>> When I first implemented the qHostInfo for the kalimba gdbserver stub,
>>>>> I sent the triple string as kalimba-csr-unknown. However the receiving code
>>>>> (GDBRemoteCommunicationClient) expects the string to be encoded as hex
>>>>> bytes, since '-' are a reserved GDB-RSP control character.
>>>>>
>>>>> The documentation for qHostInfo in lldb-gdb-remote.txt does not allude
>>>>> to this at all. So I'm sending this patch which I think improves this state
>>>>> of affairs.
>>>>>
>>>>> Could someone please apply this patch?
>>>>>
>>>>> thanks Matt
>>>>>
>>>>>
>>>>> 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.
>>>>> <lldb-gdb-remote.patch>_______________________________________________
>>>>> 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/k!++gfQa3yzGX2PQPOmvUtVTDJsKpCsgiT6Sr2CBa5VmIDKRAkOMY8LPYX0hRhQf
>>>> FVYH2!a+sDSMQcgptJ50Pg== .
>>>>
>>> _______________________________________________
>>> lldb-commits mailing list
>>> lldb-commits at cs.uiuc.edu
>>> http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits
>>>
>>
> _______________________________________________
> lldb-commits mailing list
> lldb-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits
>



-- 
Todd Fiala | Software Engineer | tfiala at google.com | 650-943-3180
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20140725/eea38342/attachment.html>


More information about the lldb-commits mailing list