Re: [PATCH v3 5/8] gdbserver: Transmit target description ID in thread list and stop reply

Thiago Jung Bauermann via Gdb-patches
2023-02-04T06:09:24Z

Andrew Burgess via Gdb-patches <gdb-patches@sourceware.org> writes:

> Thiago Jung Bauermann <thiago.bauermann@linaro.org> writes:
>
>> I suggested a prefix to designate an integer ID as a way to implement
>> only this possibility for now, but which would allow implementing hash
>> IDs later, as additional prefixes. Or another possibility is that if we
>> later decide to support hashes, we could add a separate protocol feature
>> to signal that.
>
> So, I'd also be in favour of supporting the simple "just a number"
> scheme. Not everything that talks to GDB is our GDBServer, and not
> every target might have the right hashing library. I'd hate to force
> folk to have to implement some hashing code, just to use this feature of
> the remote protocol.

Yes, that is a good point.

> I have a proposal for how to negotiate different ID types without
> adding a prefix to every ID sent from gdbserver...
>
> We don't need to use a prefix in the actual ID. I believe you're
> already adding a qSupported feature for per-thread-tdesc. The
> qSupported mechanism already supports value passing.
>
> So, we could pass a value back and forth in the qSupported negotiation
> where GDB and GDBServer can agree on a numbering scheme.

⋮
<snip>
⋮

> The great thing about this is that the hard work here is all in writing
> the documentation.

:-)

> To begin with you _only_ need to support the 'N' scheme. GDB always
> sends out just 'per-thread-tdesc=N', GDBServer just checks that the
> value is 'N', and replies 'per-thread-tdesc=N'. GDB checks that the
> return value is also 'N', and then we carry on as before. BUT, we now
> have a planned route to add more complex schemes in the future.

This is a great idea! Thank you for coming up with it. I will implement
it for the next version of the patch series.

--
Thiago