[PATCH 3/3] gdb, gdbserver: introduce the 'x' RSP packet for binary memory read
Aktemur, Tankut Baris
tankut.baris.aktemur@intel.com
Fri Mar 15 09:59:37 GMT 2024
On Thursday, March 14, 2024 1:47 PM, Tom Tromey wrote:
> >>>>> Aktemur, Tankut Baris <tankut.baris.aktemur@intel.com> writes:
>
> > Probing needs to sends an address: Which address shall we use? The same address we
> > are given in the first encounter? And the length is 0. Then, what if the address
> > is bad, e.g. in an inaccessible region? But because the length is 0, should the target
> > send a success result or an error? From GDB's PoV, for probing, it doesn't matter, but
> > from target's perspective, I think it creates an odd situation.
>
> I think the probing idea is that you simply try the 'x' command the
> first time it is needed. If remote sends an empty response (not an 'E'
> response), then the packet isn't supported, so you disable it and retry
> with 'm'.
>
> This is documented in the Overview node:
>
> For any COMMAND not supported by the stub, an empty response (‘$#00’)
> should be returned. That way it is possible to extend the protocol. A
> newer GDB can tell if a packet is supported based on that response.
>
> Tom
Yes, I get this idea, and the 'X' packet actually uses it. My concern there is
that (1) sending this packet with an arbitrary address and length 0 seems too
artificial; (2) using the proposed reply format, the target would send an empty reply
both when it does not recognize the packet and when it recognizes because the length
argument in the probe is 0 (the same problem would exist with the 'm', 'p', 'g' packets
if we were to probe them). This would not be an issue if we decide to force the reply
to always start with a marker character, as suggested in Ciaran's email.
In general, there are two options:
* Send the binary data verbatim in the reply to the 'x' packet:
(+) The definition of the packet is consistent with other similar packets.
(-) We have to escape the 'E' character; we cannot use probing.
* Always start the reply to the 'x' packet with a marker character:
(+) We wouldn't need to escape 'E'; we can use probing if we want to.
(-) The packet definition kind of diverges from the other similar packets.
I opted for the first option when submitting the patches, but the second option
is also doable.
-Baris
Intel Deutschland GmbH
Registered Address: Am Campeon 10, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de <http://www.intel.de>
Managing Directors: Christin Eisenschmid, Sharon Heck, Tiffany Doon Silva
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928
More information about the Gdb-patches
mailing list