Bug 20506 - floating point register not print in 'f' format will get the wrong value
Summary: floating point register not print in 'f' format will get the wrong value
Status: RESOLVED DUPLICATE of bug 16242
Alias: None
Product: gdb
Classification: Unclassified
Component: varobj (show other bugs)
Version: HEAD
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-08-23 00:48 UTC by elson.wei
Modified: 2023-08-31 16:47 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:
Project(s) to access:
ssh public key:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description elson.wei 2016-08-23 00:48:11 UTC
Demo:

1. print $mmx0 register
(gdb) p $xmm0
$1 = {v4_float = {0, 0, 0, 0}, v2_double = {0, 0}, v16_int8 = {0 <repeats 16 times>}, v8_int16 = {0, 0, 0,
    0, 0, 0, 0, 0}, v4_int32 = {0, 0, 0, 0}, v2_int64 = {0, 0}, uint128 = 0}

2. set a value
(gdb)set $xmm0.v4_int32[0]=0xd0d0d0d0

3. check $xmm0, the result is correct
(gdb) p $xmm0
$2 = {v4_float = {-2.80267653e+10, 0, 0, 0}, v2_double = {1.730882840854945e-314, 0}, v16_int8 = {-48, -48,
    -48, -48, 0 <repeats 12 times>}, v8_int16 = {-12080, -12080, 0, 0, 0, 0, 0, 0}, v4_int32 = {-791621424,
    0, 0, 0}, v2_int64 = {3503345872, 0}, uint128 = 3503345872}

4. print $xmm0 in hex format, the v4_float and v2_double are wrong.
$3 = {v4_float = {0x79798000, 0x0, 0x0, 0x0}, v2_double = {0x0, 0x0}, v16_int8 = {0xd0, 0xd0, 0xd0, 0xd0,
    0x0 <repeats 12 times>}, v8_int16 = {0xd0d0, 0xd0d0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, v4_int32 = {
    0xd0d0d0d0, 0x0, 0x0, 0x0}, v2_int64 = {0xd0d0d0d0, 0x0}, uint128 = 0x000000000000000000000000d0d0d0d0}
Comment 1 Andreas Schwab 2016-08-23 16:43:46 UTC
/x truncates floating point values to integers before printing.  This is not the same as the printf %a format.
Comment 2 Tom Tromey 2023-08-31 16:47:59 UTC
Sorry, I missed this earlier since it was filed in "varobj"
(which is just for a certain MI module).
Anyway, this is a dup and gdb has been changed to do something
a bit more reasonable with "print/x" of floating point.

*** This bug has been marked as a duplicate of bug 16242 ***