This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[rfc] [15/17] Get rid of current_gdbarch in gdbtypes.c
- From: Markus Deuling <deuling at de dot ibm dot com>
- To: GDB Patches <gdb-patches at sourceware dot org>
- Cc: Ulrich Weigand <uweigand at de dot ibm dot com>
- Date: Thu, 11 Oct 2007 10:54:20 +0200
- Subject: [rfc] [15/17] Get rid of current_gdbarch in gdbtypes.c
Hi,
this patch gets rid of some of the current_gdbarch's in gdbtypes.c
Is this ok to commit?
ChangeLog:
* gdbtypes.c (smash_to_memberptr_type): Use objfile->gdbarch to get at
the current architecture.
(gdbtypes_post_init): Replace current_gdbarch by gdbarch.
--
Markus Deuling
GNU Toolchain for Linux on Cell BE
deuling@de.ibm.com
diff -urpN src/gdb/gdbtypes.c dev/gdb/gdbtypes.c
--- src/gdb/gdbtypes.c 2007-10-03 22:37:31.000000000 +0200
+++ dev/gdb/gdbtypes.c 2007-10-11 10:22:45.000000000 +0200
@@ -979,7 +979,7 @@ smash_to_memberptr_type (struct type *ty
TYPE_DOMAIN_TYPE (type) = domain;
/* Assume that a data member pointer is the same size as a normal
pointer. */
- TYPE_LENGTH (type) = gdbarch_ptr_bit (current_gdbarch) / TARGET_CHAR_BIT;
+ TYPE_LENGTH (type) = gdbarch_ptr_bit (objfile->gdbarch) / TARGET_CHAR_BIT;
TYPE_CODE (type) = TYPE_CODE_MEMBERPTR;
}
@@ -3427,8 +3427,7 @@ gdbtypes_post_init (struct gdbarch *gdba
builtin_type->builtin_char =
init_type (TYPE_CODE_INT, TARGET_CHAR_BIT / TARGET_CHAR_BIT,
(TYPE_FLAG_NOSIGN
- | (gdbarch_char_signed (current_gdbarch) ?
- 0 : TYPE_FLAG_UNSIGNED)),
+ | (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,
@@ -3448,38 +3447,38 @@ gdbtypes_post_init (struct gdbarch *gdba
"unsigned char", (struct objfile *) NULL);
builtin_type->builtin_short =
init_type (TYPE_CODE_INT,
- gdbarch_short_bit (current_gdbarch) / TARGET_CHAR_BIT,
+ gdbarch_short_bit (gdbarch) / TARGET_CHAR_BIT,
0, "short", (struct objfile *) NULL);
builtin_type->builtin_unsigned_short =
init_type (TYPE_CODE_INT,
- gdbarch_short_bit (current_gdbarch) / TARGET_CHAR_BIT,
+ gdbarch_short_bit (gdbarch) / TARGET_CHAR_BIT,
TYPE_FLAG_UNSIGNED, "unsigned short",
(struct objfile *) NULL);
builtin_type->builtin_int =
init_type (TYPE_CODE_INT,
- gdbarch_int_bit (current_gdbarch) / TARGET_CHAR_BIT,
+ gdbarch_int_bit (gdbarch) / TARGET_CHAR_BIT,
0, "int", (struct objfile *) NULL);
builtin_type->builtin_unsigned_int =
init_type (TYPE_CODE_INT,
- gdbarch_int_bit (current_gdbarch) / TARGET_CHAR_BIT,
+ gdbarch_int_bit (gdbarch) / TARGET_CHAR_BIT,
TYPE_FLAG_UNSIGNED, "unsigned int",
(struct objfile *) NULL);
builtin_type->builtin_long =
init_type (TYPE_CODE_INT,
- gdbarch_long_bit (current_gdbarch) / TARGET_CHAR_BIT,
+ gdbarch_long_bit (gdbarch) / TARGET_CHAR_BIT,
0, "long", (struct objfile *) NULL);
builtin_type->builtin_unsigned_long =
init_type (TYPE_CODE_INT,
- gdbarch_long_bit (current_gdbarch) / TARGET_CHAR_BIT,
+ gdbarch_long_bit (gdbarch) / TARGET_CHAR_BIT,
TYPE_FLAG_UNSIGNED, "unsigned long",
(struct objfile *) NULL);
builtin_type->builtin_long_long =
init_type (TYPE_CODE_INT,
- gdbarch_long_long_bit (current_gdbarch) / TARGET_CHAR_BIT,
+ gdbarch_long_long_bit (gdbarch) / TARGET_CHAR_BIT,
0, "long long", (struct objfile *) NULL);
builtin_type->builtin_unsigned_long_long =
init_type (TYPE_CODE_INT,
- gdbarch_long_long_bit (current_gdbarch) / TARGET_CHAR_BIT,
+ gdbarch_long_long_bit (gdbarch) / TARGET_CHAR_BIT,
TYPE_FLAG_UNSIGNED, "unsigned long long",
(struct objfile *) NULL);
builtin_type->builtin_float
@@ -3541,7 +3540,7 @@ gdbtypes_post_init (struct gdbarch *gdba
lookup_pointer_type (lookup_function_type (builtin_type->builtin_void));
builtin_type->builtin_core_addr =
init_type (TYPE_CODE_INT,
- gdbarch_addr_bit (current_gdbarch) / 8,
+ gdbarch_addr_bit (gdbarch) / 8,
TYPE_FLAG_UNSIGNED,
"__CORE_ADDR", (struct objfile *) NULL);