diff options
author | Ulrich Weigand <uweigand@de.ibm.com> | 2009-07-02 12:44:34 +0000 |
---|---|---|
committer | Ulrich Weigand <uweigand@de.ibm.com> | 2009-07-02 12:44:34 +0000 |
commit | 69feb676087cb0883eb5feb38558dc3252059312 (patch) | |
tree | cd486c529a02aa9fc54ff1f243e3e311bf4c4a4b /gdb/printcmd.c | |
parent | 48319d1fc01f55ca319e760b82f4527f8ab62476 (diff) | |
download | gdb-69feb676087cb0883eb5feb38558dc3252059312.zip gdb-69feb676087cb0883eb5feb38558dc3252059312.tar.gz gdb-69feb676087cb0883eb5feb38558dc3252059312.tar.bz2 |
* gdbtypes.h (builtin_type_true_char): Remove.
(builtin_type_true_unsigned_char): Likewise.
(struct builtin_type): Add builtin_true_char and
builtin_true_unsigned_char members.
* gdbtypes.c (builtin_type_true_char): Remove.
(builtin_type_true_unsigned_char): Likewise.
(_initialize_gdbtypes): Do not initialize them.
(gdbtypes_post_init): Initialize builtin_true_char and
builtin_true_unsigned_char members of builtin_type.
* printcmd.c (print_scalar_formatted): Use builtin_type
members instead of builtin_type_true_char and
builtin_type_true_unsigned_char.
* ada-valprint.c (ada_val_print_1): Likewise.
Diffstat (limited to 'gdb/printcmd.c')
-rw-r--r-- | gdb/printcmd.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/gdb/printcmd.c b/gdb/printcmd.c index f01d40e..59bb656 100644 --- a/gdb/printcmd.c +++ b/gdb/printcmd.c @@ -344,9 +344,10 @@ print_scalar_formatted (const void *valaddr, struct type *type, const struct value_print_options *options, int size, struct ui_file *stream) { + struct gdbarch *gdbarch = current_gdbarch; LONGEST val_long = 0; unsigned int len = TYPE_LENGTH (type); - enum bfd_endian byte_order = gdbarch_byte_order (current_gdbarch); + enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); /* If we get here with a string format, try again without it. Go all the way back to the language printers, which may call us @@ -395,7 +396,7 @@ print_scalar_formatted (const void *valaddr, struct type *type, same, then at this point, the value's length (in target bytes) is gdbarch_addr_bit/TARGET_CHAR_BIT, not TYPE_LENGTH (type). */ if (TYPE_CODE (type) == TYPE_CODE_PTR) - len = gdbarch_addr_bit (current_gdbarch) / TARGET_CHAR_BIT; + len = gdbarch_addr_bit (gdbarch) / TARGET_CHAR_BIT; /* If we are printing it as unsigned, truncate it in case it is actually a negative signed value (e.g. "print/u (short)-1" should print 65535 @@ -454,13 +455,13 @@ print_scalar_formatted (const void *valaddr, struct type *type, { struct value_print_options opts = *options; opts.format = 0; + if (TYPE_UNSIGNED (type)) - value_print (value_from_longest (builtin_type_true_unsigned_char, - val_long), - stream, &opts); - else - value_print (value_from_longest (builtin_type_true_char, val_long), - stream, &opts); + type = builtin_type (gdbarch)->builtin_true_unsigned_char; + else + type = builtin_type (gdbarch)->builtin_true_char; + + value_print (value_from_longest (type, val_long), stream, &opts); } break; |