* 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.
This commit is contained in:
Ulrich Weigand
2009-07-02 12:44:34 +00:00
parent 48319d1fc0
commit 69feb67608
5 changed files with 45 additions and 31 deletions

View File

@ -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;