diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 5a486af247..61644638c1 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,21 @@ +2008-09-11 Ulrich Weigand + + * gdbtypes.h (struct builtin_type): Remove builtin_true_char + and builtin_true_unsigned_char. + (builtin_type_true_char): Remove macro, add extern declaration. + (builtin_type_true_unsigned_char): Add extern declaration. + * gdbtypes.c (builtin_type_true_char): New global variable. + (builtin_type_true_unsigned_char): Likewise. + (_initialize_gdbtypes): Initialize them. + (gdbtypes_post_init): Do not initialize builtin_true_char + and builtin_true_unsigned_char members of struct builtin_type. + + * printcmd.c (print_scalar_formatted): Do not use builtin_type; + use builtin_type_true_unsigned_char instead. + + * ada-valprint.c (ada_val_print_1): Use builtin_type_true_char + instead of builtin_type_char for internal string. + 2008-09-11 Ulrich Weigand * gdbtypes.h (builtin_type_void): Remove macro, add declaration. diff --git a/gdb/ada-valprint.c b/gdb/ada-valprint.c index 0972367879..5d8d73d56d 100644 --- a/gdb/ada-valprint.c +++ b/gdb/ada-valprint.c @@ -752,7 +752,7 @@ ada_val_print_1 (struct type *type, const gdb_byte *valaddr0, parray_of_char = make_pointer_type (create_array_type - (NULL, builtin_type_char, + (NULL, builtin_type_true_char, create_range_type (NULL, builtin_type_int, 0, 32)), NULL); printable_val = diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c index 955848b098..c21d903004 100644 --- a/gdb/gdbtypes.c +++ b/gdb/gdbtypes.c @@ -111,6 +111,10 @@ struct type *builtin_type_ia64_quad; /* Platform-neutral void type. */ struct type *builtin_type_void; +/* Platform-neutral character types. */ +struct type *builtin_type_true_char; +struct type *builtin_type_true_unsigned_char; + int opaque_type_resolution = 1; static void @@ -3109,14 +3113,6 @@ gdbtypes_post_init (struct gdbarch *gdbarch) (TYPE_FLAG_NOSIGN | (gdbarch_char_signed (gdbarch) ? 0 : TYPE_FLAG_UNSIGNED)), "char", (struct objfile *) NULL); - builtin_type->builtin_true_char = - init_type (TYPE_CODE_CHAR, TARGET_CHAR_BIT / TARGET_CHAR_BIT, - 0, - "true character", (struct objfile *) NULL); - builtin_type->builtin_true_unsigned_char = - init_type (TYPE_CODE_CHAR, TARGET_CHAR_BIT / TARGET_CHAR_BIT, - TYPE_FLAG_UNSIGNED, - "true character", (struct objfile *) NULL); builtin_type->builtin_signed_char = init_type (TYPE_CODE_INT, TARGET_CHAR_BIT / TARGET_CHAR_BIT, 0, @@ -3337,6 +3333,14 @@ _initialize_gdbtypes (void) init_type (TYPE_CODE_VOID, 1, 0, "void", (struct objfile *) NULL); + builtin_type_true_char = + init_type (TYPE_CODE_CHAR, TARGET_CHAR_BIT / TARGET_CHAR_BIT, + 0, + "true character", (struct objfile *) NULL); + builtin_type_true_unsigned_char = + init_type (TYPE_CODE_CHAR, TARGET_CHAR_BIT / TARGET_CHAR_BIT, + TYPE_FLAG_UNSIGNED, + "true character", (struct objfile *) NULL); add_setshow_zinteger_cmd ("overload", no_class, &overload_debug, _("\ Set debugging of C++ overloading."), _("\ diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h index 4ee48dd392..2d509c8632 100644 --- a/gdb/gdbtypes.h +++ b/gdb/gdbtypes.h @@ -977,12 +977,6 @@ struct builtin_type /* Integral types. */ - /* We use these for the '/c' print format, because c_char is just a - one-byte integral type, which languages less laid back than C - will print as ... well, a one-byte integral type. */ - struct type *builtin_true_char; - struct type *builtin_true_unsigned_char; - /* Implicit size/sign (based on the the architecture's ABI). */ struct type *builtin_void; struct type *builtin_char; @@ -1018,8 +1012,6 @@ extern const struct builtin_type *builtin_type (struct gdbarch *gdbarch); (builtin_type (current_gdbarch)->builtin_func_ptr) #define builtin_type_CORE_ADDR \ (builtin_type (current_gdbarch)->builtin_core_addr) -#define builtin_type_true_char \ - (builtin_type (current_gdbarch)->builtin_true_char) #define builtin_type_char \ (builtin_type (current_gdbarch)->builtin_char) #define builtin_type_short \ @@ -1099,6 +1091,14 @@ extern struct type *builtin_type_ia64_quad; You must use builtin_type (...)->builtin_void in those cases. */ extern struct type *builtin_type_void; +/* Platform-neutral character types. + We use these for the '/c' print format, because c_char is just a + one-byte integral type, which languages less laid back than C + will print as ... well, a one-byte integral type. */ +extern struct type *builtin_type_true_char; +extern struct type *builtin_type_true_unsigned_char; + + /* This type represents a type that was unrecognized in symbol read-in. */ extern struct type *builtin_type_error; diff --git a/gdb/printcmd.c b/gdb/printcmd.c index f09dc91609..131099475c 100644 --- a/gdb/printcmd.c +++ b/gdb/printcmd.c @@ -425,13 +425,9 @@ print_scalar_formatted (const void *valaddr, struct type *type, case 'c': if (TYPE_UNSIGNED (type)) - { - struct type *utype; - - utype = builtin_type (current_gdbarch)->builtin_true_unsigned_char; - value_print (value_from_longest (utype, val_long), - stream, 0, Val_pretty_default); - } + value_print (value_from_longest (builtin_type_true_unsigned_char, + val_long), + stream, 0, Val_pretty_default); else value_print (value_from_longest (builtin_type_true_char, val_long), stream, 0, Val_pretty_default);