Bug 16225 - __int128_t types print strangely
Summary: __int128_t types print strangely
Status: RESOLVED FIXED
Alias: None
Product: gdb
Classification: Unclassified
Component: exp (show other bugs)
Version: HEAD
: P2 normal
Target Milestone: 8.1
Assignee: Tom Tromey
URL:
Keywords:
Depends on:
Blocks: 20991
  Show dependency treegraph
 
Reported: 2013-11-25 15:38 UTC by Tom Tromey
Modified: 2017-06-12 21:45 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tom Tromey 2013-11-25 15:38:42 UTC
Make a program that uses __int128_t, like:

__int128_t x = 7;

int main()
{
}

Now do "print x" in gdb.
I get:

(gdb) p x
$1 = 0x00000000000000000000000000000007

I think it should work like other integer types.
Comment 1 cvs-commit@gcc.gnu.org 2017-06-12 21:44:16 UTC
The master branch has been updated by Tom Tromey <tromey@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=30a254669b16b86166fed1f9a4c4f9cc55a07fdc

commit 30a254669b16b86166fed1f9a4c4f9cc55a07fdc
Author: Tom Tromey <tom@tromey.com>
Date:   Mon May 22 03:55:58 2017 -0600

    Don't always zero pad in print_*_chars
    
    This changes print_octal_chars and print_decimal_chars to never zero
    pad, and changes print_binary_chars and print_hex_chars to only
    optionally zero-pad, based on a flag.
    
    ChangeLog
    2017-06-12  Tom Tromey  <tom@tromey.com>
    
    	PR exp/16225:
    	* valprint.h (print_binary_chars, print_hex_chars): Update.
    	* valprint.c (val_print_type_code_int): Update.
    	(print_binary_chars): Add "zero_pad" argument.
    	(emit_octal_digit): New function.
    	(print_octal_chars): Don't zero-pad.
    	(print_decimal_chars): Likewise.
    	(print_hex_chars): Add "zero_pad" argument.
    	* sh64-tdep.c (sh64_do_fp_register): Update.
    	* regcache.c (regcache::dump): Update.
    	* printcmd.c (print_scalar_formatted): Update.
    	* infcmd.c (default_print_one_register_info): Update.
    
    2017-06-12  Tom Tromey  <tom@tromey.com>
    
    	PR exp/16225:
    	* gdb.reverse/i386-sse-reverse.exp: Update tests.
    	* gdb.arch/vsx-regs.exp: Update tests.
    	* gdb.arch/s390-vregs.exp (hex128): New proc.
    	Update test.
    	* gdb.arch/altivec-regs.exp: Update tests.
Comment 2 cvs-commit@gcc.gnu.org 2017-06-12 21:44:21 UTC
The master branch has been updated by Tom Tromey <tromey@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=4ac0cb1cf04f105586746a6cce5b0f93d76f2b33

commit 4ac0cb1cf04f105586746a6cce5b0f93d76f2b33
Author: Tom Tromey <tom@tromey.com>
Date:   Mon May 22 16:32:25 2017 -0600

    Let print_decimal_chars handle signed values
    
    This changes print_decimal_chars to handle signed values.
    
    gdb/ChangeLog
    2017-06-12  Tom Tromey  <tom@tromey.com>
    
    	PR exp/16225:
    	* valprint.h (print_decimal_chars): Update.
    	* valprint.c (maybe_negate_by_bytes): New function.
    	(print_decimal_chars): Add "is_signed" argument.
    	* printcmd.c (print_scalar_formatted): Update.
Comment 3 Tom Tromey 2017-06-12 21:45:19 UTC
Fixed.