[PATCH 3/3] gdb, gdbserver: introduce the 'x' RSP packet for binary memory read
Aktemur, Tankut Baris
tankut.baris.aktemur@intel.com
Thu Mar 14 10:36:21 GMT 2024
Thank you for your review. I'll submit the next revision soon.
On Wednesday, March 13, 2024 8:27 PM, Tom Tromey wrote:
> >>>>> Tankut Baris Aktemur <tankut.baris.aktemur@intel.com> writes:
>
> > Introduce an RSP packet, 'x', for reading from the remote server
> > memory in binary format. The binary write packet, 'X' already exists.
> > The 'x' packet is essentially the same as 'm', except that the
> > returned data is in binary format. For transferring relatively large
> > data (e.g. shared library files), the 'x' packet can reduce the
> > transfer costs.
...
> > + /* Binary memory read support. */
> > + strcat (own_buf, ";x+");
>
> One thing I don't really know about the remote protocol is whether we
> prefer to add advertised features (like this) or just have gdb probe.
For the 'X' packet, GDB does probing in `check_binary_download`. (It is, at
least to me, unintuitive that the function is named "download" while it's
checking for 'X', which is for writing; maybe "download" is meant from the target's
perspective.)
I also don't know exactly which approach should be taken, but I opted for announcing
the support at the beginning because it's easier and cleaner, in my opinion.
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. If it's success for
a request of length 0, the target would trivially send an empty response as the binary
data. But if the packet is not recognized, the target responds with an empty reply
packet, as well. How do we distinguish then success from unsupported? Shall we have
a delimiter at the beginning of the sent binary data? For these reasons, announcing
the support upfront had sounded better to me.
Regards
-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