aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gdb/ChangeLog17
-rw-r--r--gdb/ada-valprint.c3
-rw-r--r--gdb/gdbtypes.c24
-rw-r--r--gdb/gdbtypes.h15
-rw-r--r--gdb/printcmd.c17
5 files changed, 45 insertions, 31 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index b616d5a..cfa317b 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,22 @@
2009-07-02 Ulrich Weigand <uweigand@de.ibm.com>
+ * 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.
+
+2009-07-02 Ulrich Weigand <uweigand@de.ibm.com>
+
* gdbtypes.h (builtin_type_void): Remove.
* gdbtypes.c (builtin_type_void): Remove.
(_initialize_gdbtypes): Do not initialize it.
diff --git a/gdb/ada-valprint.c b/gdb/ada-valprint.c
index b33199b..2aa0d73 100644
--- a/gdb/ada-valprint.c
+++ b/gdb/ada-valprint.c
@@ -746,9 +746,10 @@ ada_val_print_1 (struct type *type, const gdb_byte *valaddr0,
struct value *func = ada_vax_float_print_function (type);
if (func != 0)
{
+ struct gdbarch *gdbarch = current_gdbarch;
CORE_ADDR addr;
addr = value_as_address (call_function_by_hand (func, 1, &val));
- val_print_string (builtin_type_true_char,
+ val_print_string (builtin_type (gdbarch)->builtin_true_char,
addr, -1, stream, options);
return 0;
}
diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c
index 7a44716..25d6321 100644
--- a/gdb/gdbtypes.c
+++ b/gdb/gdbtypes.c
@@ -108,11 +108,6 @@ struct type *builtin_type_arm_ext;
struct type *builtin_type_ia64_spill;
struct type *builtin_type_ia64_quad;
-/* Platform-neutral character types. */
-struct type *builtin_type_true_char;
-struct type *builtin_type_true_unsigned_char;
-
-
int opaque_type_resolution = 1;
static void
show_opaque_type_resolution (struct ui_file *file, int from_tty,
@@ -3191,6 +3186,16 @@ gdbtypes_post_init (struct gdbarch *gdbarch)
0,
"_Decimal128", (struct objfile *) NULL);
+ /* "True" character types. */
+ 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);
+
/* Default data/code pointer types. */
builtin_type->builtin_data_ptr =
make_pointer_type (builtin_type->builtin_void, NULL);
@@ -3430,15 +3435,6 @@ _initialize_gdbtypes (void)
builtin_type_ia64_quad =
build_flt (-1, "builtin_type_ia64_quad", floatformats_ia64_quad);
- 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."), _("\
Show debugging of C++ overloading."), _("\
diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h
index f2f339d..2d9ce12 100644
--- a/gdb/gdbtypes.h
+++ b/gdb/gdbtypes.h
@@ -983,6 +983,13 @@ struct builtin_type
struct type *builtin_decdouble;
struct type *builtin_declong;
+ /* "True" 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. */
+ struct type *builtin_true_char;
+ struct type *builtin_true_unsigned_char;
+
/* Pointer types. */
@@ -1086,14 +1093,6 @@ extern struct type *builtin_type_ia64_spill;
extern struct type *builtin_type_ia64_quad;
-/* 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;
-
-
/* Maximum and minimum values of built-in types */
#define MAX_OF_TYPE(t) \
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;