[PATCH RFC] PR 17464: Possible improvement for "info vector" command.

Pierre Muller pierre.muller@ics-cnrs.unistra.fr
Tue Oct 7 18:15:00 GMT 2014

> -----Message d'origine-----
> De : gdb-patches-owner@sourceware.org [mailto:gdb-patches-
> owner@sourceware.org] De la part de Pedro Alves
> Envoyé : mardi 7 octobre 2014 19:31
> À : Pierre Muller; gdb-patches@sourceware.org
> Objet : Re: [PATCH RFC] PR 17464: Possible improvement for "info
> vector" command.
> On 10/07/2014 04:46 PM, Pierre Muller wrote:
> >   It does have the side effect that
> > you can get the same output for an individual vector register
> > by using the "/rx" modifier:
> >
> > (gdb) n
> > 35        z = test_xmm14 (z);
> > (gdb) p z
> > $1 = 56.799999999999997
> > Undefined command: "".  Try "help".
> > (gdb) p /x z
> > $2 = 0x38
> > (gdb) p /rx z
> > $3 = 56.799999999999997 (raw: 0x404c666666666666)
> > (gdb)
> >
> >   While in current master git you get the same output
> > for /x and /rx modifiers.
> For better or worse /r actually means "disable pretty printers":
>  @item r
>  @cindex raw printing
>  Print using the @samp{raw} formatting.  By default, @value{GDBN} will
>  use a Python-based pretty-printer, if one is available (@pxref{Pretty
>  Printing}).  This typically results in a higher-level display of the
>  value's contents.  The @samp{r} format bypasses any Python
>  pretty-printer which might exist.
>  @end table
> I don't think we should conflate these concepts.  If we're
> adding a format specifier, I think it should be a different
> letter.
> In addition:
> > (gdb) p /rx z
> > $3 = 56.799999999999997 (raw: 0x404c666666666666)

  The problem is that currently, all fields
of the vector union get the hexadecimal modifier,
and I was just suggesting a minimal change to
improve the output of 
"info vector"

> Didn't that lose the hexadecimal (/x) request?  I would
> expect instead:
>   (gdb) p /rx z
>   $3 = 0x38 (raw: 0x404c666666666666)

  Here, I do not disagree with you, even if I
am not familiar with what C would expect here really.
  The problem is really that inside "info vector"
I do not see the real floating point value of
the fields that are not integers because of this
global use of 'x' modifier.
  But to do it more properly, we might need to 
consider the elements of the union type separately directly
inside default_print_one_register_info function.

> But it may be better to always print the raw contents when
> printing floats, and then have a knob to turn it off,
> similar to "set print symbol on/off".  Something like
> "set print raw-float on/off".  Then for e.g.,
> float variables in "backtrace", "info locals", etc. also
> show their raw contents.
  I don't think everyone is always interested in raw 
format of the floating value....
 Again, my goal here is primarily to have a meaningful
output for the float parts of the vector registers.
So I wanted to have a mild way of getting the correct output
for "info vector" without changing any default output...


More information about the Gdb-patches mailing list