This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


 As reported in Bug 17464,
https://sourceware.org/bugzilla/show_bug.cgi?id=17464
the GDB  command 
?info vector?
does not display the precise content of the floating types.

  The hexadecimal output is chosen (inside default_print_one_register_info
function in infcmd.c source around line 2095)
when displaying individual vector registers, which leads to the print out
of the integer part only of the float value.

Below is one possible way to improve the output of
?info vector?.

  Only the v4_float and v2_double fields are modified:
NEW OUTPUT:
xmm15          {v4_float = {2.72008302e+023     (raw: 0x66666666),
    3.1937499   (raw: 0x404c6666), 0    (raw: 0x00000000),
    0   (raw: 0x00000000)}, v2_double = {
    56.799999999999997  (raw: 0x404c666666666666),
    0   (raw: 0x0000000000000000)}, v16_int8 = {0x66, 0x66, 0x66, 0x66,
0x66,
    0x66, 0x4c, 0x40, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, v8_int16 = {
    0x6666, 0x6666, 0x6666, 0x404c, 0x0, 0x0, 0x0, 0x0}, v4_int32 = {
    0x66666666, 0x404c6666, 0x0, 0x0}, v2_int64 = {0x404c666666666666, 0x0},
  uint128 = 0x0000000000000000404c666666666666}
mxcsr          0x1f80   [ IM DM ZM OM UM PM ]
CURRENT GIT MASTER OUTPUT:
xmm15          {v4_float = {0x0, 0x3, 0x0, 0x0}, v2_double = {0x38, 0x0},
  v16_int8 = {0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x4c, 0x40, 0x0, 0x0, 0x0,
    0x0, 0x0, 0x0, 0x0, 0x0}, v8_int16 = {0x6666, 0x6666, 0x6666, 0x404c,
    0x0, 0x0, 0x0, 0x0}, v4_int32 = {0x66666666, 0x404c6666, 0x0, 0x0},
  v2_int64 = {0x404c666666666666, 0x0},
  uint128 = 0x0000000000000000404c666666666666}


  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.

  Comments welcome,

Pierre Muller


ChangeLog entry:

2014-10-07  Pierre Muller  <muller@sourceware.org>

        * infcmd.c (default_print_one_register_info): Pass print_raw_format
        into opts.raw field for vector types.

        * printcmd.c (print_scalar_formatted): Handle float value with
        raw and hexadecimal by printing flaot valueand raw content.


Attachment: fix-PR17464.patch
Description: Binary data


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]