This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
Re: 'g' packet reply is too long error when target changes number of registers
- From: Pedro Alves <palves at redhat dot com>
- To: "alexandru dot sardan at freescale dot com" <alexandru dot sardan at freescale dot com>
- Cc: "gdb at sourceware dot org" <gdb at sourceware dot org>, "catalin dot udma at freescale dot com" <catalin dot udma at freescale dot com>
- Date: Tue, 04 Feb 2014 18:44:47 +0000
- Subject: Re: 'g' packet reply is too long error when target changes number of registers
- Authentication-results: sourceware.org; auth=none
- References: <5651102df70243a088e7688170617c31 at DM2PR03MB368 dot namprd03 dot prod dot outlook dot com>
On 02/03/2014 02:11 PM, alexandru.sardan@freescale.com wrote:
> Hello,
>
> I'm trying to debug an ARM Aarch64 target with gdb-cross and I get a
> 'g' packet reply is too long error in the following scenario:
>
> * I debug my ARM target through a probe that has a gdbserver running on it
> (gdbproxy).
> * First I load a custom target description in gdb that reflects the current
> hardware I am debugging
> * I connect to the probe with "target remote probe_ip"
> * Then I configure the probe to connect to the target (using the same target
> description as the one loaded in GDB)
> * When I ask for the register Info (info reg), I get the 'g' packet reply
> error.
>
> Because the probe had no knowledge of the target that will be debugged
> beforehand, the "target remote" command will force the probe to reply with
> info about a smaller number of registers (according to the default description)
> than gdb expects.
This sounds odd. Why not? Simply configure it before connecting
with GDB? It sounds quite wrong to be changing the target behind
GDB's back when GDB is _already_ debugging it. Not just the size
of the g/G packets may change inadvertently, but the layout as well.
If the target description changes with your re-configuration, it
sounds to me like GDB should fetch/recompute the whole target
description. Today, I think that can only be done with a
disconnect/reconnect.
> This causes rsa->sizeof_g_packet to be reduced.
>
> After configuration, the probe will send all the register information of the
> target. This causes the 'g'packet reply error because now, more registers
> are being sent.
>
> Why is rsa->sizeof_g_packet shrunk when a smaller packet is received.
/* If this is smaller than we guessed the 'g' packet would be,
update our records. A 'g' reply that doesn't include a register's
value implies either that the register is not available, or that
the 'p' packet must be used. */
if (buf_len < 2 * rsa->sizeof_g_packet)
{
If we don't shrink it, then we'd send too much when writing
registers, for example, I think?
--
Pedro Alves