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]

[RFC] print/x of a float/double should printf ("%a")


Hi,

currently "print/x (float) a" does an integer "print/x (long) a".

Ulrich Drepper requested to use instead printf ("%a") (man excerpt below):

Implemented as:
(gdb) print/x $xmm5
$1 = {v4_float = {0x5, 0x5, 0x5, 0x5}, v2_double = {0xc00, 0x1800}, v16_int8
->
(gdb) print/x $xmm5
$1 = {v4_float = {0x1.400000000p+2, 0x1.500000000p+2, 0x1.600000000p+2,
    0x1.700000000p+2}, v2_double = { 0x1.8000040a000000000p+11,
    0x1.8000040b000000000p+12}, v16_int8 = {0x0, 0x0, 0xa0, 0x40, 0x0, 0x0,

With the original value:
(gdb) print $xmm5
$1 = {v4_float = {5, 5.25, 5.5, 5.75}, v2_double = {3072.0004930496216,
    6144.0009870529175}, v16_int8 = {0 '\0', 0 '\0', -96 '?', 64 '@', 0 '\0',


Implementation attached.  Systems not supporting "%a" will print the value as
	print (float) a
which differs from the current way there:
	print/x (long) a



Regards,
Jan


a,A	(C99; not in SUSv2) For a conversion, the double argument is converted
	to hexadecimal notation (using the letters abcdef) in the style
	[-]0xh.hhhhp±d; for A conversion the prefix 0X, the letters ABCDEF, and
	the exponent separator P is used. There is one hexadecimal digit before
	the decimal point, and the number of digits after it is equal to the
	precision. The default precision suffices for an exact representation
	of the value if an exact representation in base 2 exists and otherwise
	is sufficiently large to distinguish values of type double. The digit
	before the decimal point is unspecified for non-normalized numbers, and
	non-zero but otherwise unspecified for normalized numbers.

Attachment: patch
Description: Text document


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