Re: [PATCH 2/2] MIPS: make kgdb depend on FPU support

From: Daniel Thompson
Date: Wed Feb 10 2021 - 07:32:36 EST


On Wed, Feb 10, 2021 at 01:11:28PM +0100, Maciej W. Rozycki wrote:
> On Wed, 10 Feb 2021, Daniel Thompson wrote:
>
> > > Wrapping the relevant parts of this file into #ifdef MIPS_FP_SUPPORT
> > > would be as easy though and would qualify as a proper fix given that we
> > > have no XML description support for the MIPS target (so we need to supply
> > > the inexistent registers in the protocol; or maybe we can return NULL in
> > > `dbg_get_reg' to get them padded out in the RSP packet, I haven't checked
> > > if generic KGDB code supports this feature).
> >
> > Returning NULL should be fine.
> >
> > The generic code will cope OK. The values in the f.p. registers may
> > act a little odd if gdb uses a 'G' packet to set them to non-zero values
> > (since kgdb will cache the values gdb sent it) but the developer
> > operating the debugger will probably figure out what is going on without
> > too much pain.
>
> Ack, thanks!
>
> NB if GDB sees a register padded out (FAOD it means all-x's rather than a
> hex string placed throughout the respective slot) in a `g' packet, then it
> will mark the register internally as "unavailable" and present it to the
> receiver of the information as such rather than giving any specific value.
> I don't remember offhand what the syntax for the `G' packet is in that
> case; possibly GDB just sends all-zeros, and in any case you can't make
> GDB write any specific value to such a register via any user
> interface.

kgdb doesn't track register validity and adding would be a fairly big
change. Everything internally (including some of the interactions with
arch code) is based on updating a binary shadow of register state which
is only bin2hex'ed just before transmitting a packet.

It will simply default them to zero and update them on a 'G' packet.

> The way the unavailability is shown depends on the interface used, i.e.
> it will be different between the `info all-registers'/`info register $reg'
> commands, and the `p $reg' command (or any expression involving `$reg'),
> and the MI interface. But in any case it will be unambiguous.

I guess this probably does create a technical protocol violation since
kgdb will reject per-register read/write for register that its report
says are zero rather then invalid.


Daniel.