Re: Printing decimal128 types out of registers

Thiago Jung Bauermann
2008-01-23T15:11:12Z

On Mon, 2008-01-21 at 12:54 -0500, Daniel Jacobowitz wrote:
> On Mon, Jan 21, 2008 at 12:54:34PM -0200, Thiago Jung Bauermann wrote:
> > Yes, even for software decimal float implementations the calling
> > convention for PowerPC. is to put _Decimal128 in a pair of float
> > registers
>
> This, by itself, does not mean we need to be able to display two
> registers as a _Decimal128. We will still be able to display a named
> argument in two registers as _Decimal128, because the debug
> information will (presumably) show it as two pieces in two registers
> using DW_OP_piece. There's no way to do math on a _Decimal128 value
> in two FP registers without the hardware support.

Ok, makes sense. The point where the _Decimal128 is copied from memory
into the two registers should be close to the function call site so it
wouldn't be hard to track it down and print the value from memory (when
no debug info is available).

> So I suggest we not have $dl0 except on
> hardware where the GDB user might look at the next instruction, see
> that it operates on register dl0, and want to check the value of that
> register.

That would be the Power6 processor. In Linux, I can make the distinction
using the auxiliary vector:

AT_PLATFORM: power6

Or even better:

AT_HWCAP: dfp arch_2_05 ic_snoop smt mmu fpu altivec ppc64 ppc32

I don't know if this would work for other OSs (and I don't know if other
OSs have or will have DFP support). Is this a good method to determine
when to show the pseudo registers?

> > I was talking to Luis about this, and he suggested an approach other
> > than using pseudo registers: create a way to make GDB consider two
> > consecutive registers as contiguous data. Since there are other types
> > that are also passed in consecutive registers (e.g., long long,
> > soft-float, IBM lon double), this mechanism would be more useful. I
> > think this is a good idea.
>
> This is like stepping backwards in time. We used to treat consecutive
> registers as a big data blob and it was a terrible mess ... if you
> want to examine typed multi-register values, I suggest leaving any
> "consecutive" requirement out of the picture.

I mentioned "consecutive" to keep it simpler, but if a more general
mechanism is useful, that's ok.

> On Mon, Jan 21, 2008 at 06:30:16PM +0100, Mark Kettenis wrote:
> > > Perhaps some syntax could be created, like:
> > >
> > > (gdb) print {_Decimal128} $f2,$f3
> > > $1 = 1.2
> > >
> > > What do you think?
> >
> > I'm not sure how this would fit into the expression parser. t might
> > get really ugly.
>
> Definitely agreed. Maybe an explicit command to create a name for a
> group of registers in order, using the same underlying mechanism we
> use for DWARF.

Looks like an interesting feature. But since pseudo registers seem to be
the way to go in the DFP case, this will have to stay in the wishlist
for now...
--
[]'s
Thiago Jung Bauermann