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

From: Daniel Thompson
Date: Wed Feb 10 2021 - 12:06:02 EST


On Wed, Feb 10, 2021 at 03:15:10PM +0100, Maciej W. Rozycki wrote:
> On Wed, 10 Feb 2021, Daniel Thompson wrote:
>
> > > 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.
>
> I've had a peek and it doesn't appear to me it would be a big deal.
>
> We have `gdb_regs' defined as an array of longs. We'd just need a second
> array for a register validity bitmap, which could for simplicity just have
> a single bit per each byte of `gdb_regs'. It would then be updated in
> `pt_regs_to_gdb_regs' according to the result of `dbg_get_reg' across the
> number of bits given by `dbg_reg_def[i].size'. And then `kgdb_mem2hex'
> would interpret the bitmap given as an extra argument accordingly.
>
> It looks to me like a couple of lines of extra code really.

Agree, the core changes aren't too bad.

I was more concerned about whether the validity bits would leak into the
arch specific code via sleeping_thread_to_gdb_regs() and also noted the
effort needed to review each architectures dbg_get_reg() implementation
if we are going to react differently to it's return value.

It is still not an infeasible amount of work though if someone
does want to go in this direction.


Daniel.