aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlrich Weigand <uweigand@de.ibm.com>2009-06-29 13:18:37 +0000
committerUlrich Weigand <uweigand@de.ibm.com>2009-06-29 13:18:37 +0000
commit46bf50512ce837bbc53e8704dd5117db3273099b (patch)
tree46832d44f1d266f8be7f9786c64080e6f85e410f
parentb08f1e8d6d0c824023e04fa0f379026fd4d56c72 (diff)
downloadgdb-46bf50512ce837bbc53e8704dd5117db3273099b.zip
gdb-46bf50512ce837bbc53e8704dd5117db3273099b.tar.gz
gdb-46bf50512ce837bbc53e8704dd5117db3273099b.tar.bz2
* gdbtypes.h (struct builtin_type): Remove builtin_core_addr,
nodebug_text_symbol, nodebug_data_symbol, nodebug_unknown_symbol, and nodebug_tls_symbol members. (struct objfile_type): New data structure. (objfile_type): Add prototype. * gdbtypes.c (gdbtypes_post_init): Remove initialization code for types no longer in struct builtin_type. (objfile_type_data): New static variable. (_initialize_gdbtypes): Initialize it. (objfile_type): New function. * gdbtypes.h (builtin_type_error): Remove. * gdbtypes.c (build_complex): Do not use builtin_type_error. * symtab.c (builtin_type_error): Remove. (_initialize_symtab): Remove initialization. * stabsread.c (dbx_lookup_type, define_symbol, error_type, rs6000_builtin_type, read_range_type): Use per-objfile types instead of global or per-architecture builtin types. * coffread.c (decode_type): Likewise. * dwarf2read.c (read_array_type, read_tag_string_type, new_symbol, die_type): Likewise. * mdebugread.c (parse_symbol, basic_type, upgrade_type, parse_procedure, psymtab_to_symtab_1): Likewise. * xcoffread.c (process_xcoff_symbol): Likewise. * parse.c (write_exp_msymbol): Likewise. * stabsread.c (rs6000_builtin_type_data): New static variable. (_initialize_stabsread): Initialize it. (rs6000_builtin_type): Add OBJFILE argument. Allocate builtin types per-objfile instead of globally. * stabsread.c (dbx_lookup_type): Add OBJFILE argument. Use it instead of current_objfile; pass it to rs6000_builtin_type. (dbx_alloc_type, read_type, read_range_type): Update calls. (cleanup_undefined_types_noname): Add OBJFILE argument and pass it to dbx_lookup_type. (cleanup_undefined_types): Add OBJFILE argument and pass it to cleanup_undefined_types_noname. * stabsread.h (cleanup_undefined_types): Add OBJFILE argument. * buildsym.c (end_symtab): Update call.
-rw-r--r--gdb/ChangeLog44
-rw-r--r--gdb/buildsym.c2
-rw-r--r--gdb/coffread.c34
-rw-r--r--gdb/dwarf2read.c10
-rw-r--r--gdb/gdbtypes.c177
-rw-r--r--gdb/gdbtypes.h82
-rw-r--r--gdb/mdebugread.c25
-rw-r--r--gdb/parse.c10
-rw-r--r--gdb/stabsread.c164
-rw-r--r--gdb/stabsread.h2
-rw-r--r--gdb/symtab.c7
-rw-r--r--gdb/xcoffread.c5
12 files changed, 363 insertions, 199 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 9652e92..4d0b201 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,49 @@
2009-06-29 Ulrich Weigand <uweigand@de.ibm.com>
+ * gdbtypes.h (struct builtin_type): Remove builtin_core_addr,
+ nodebug_text_symbol, nodebug_data_symbol, nodebug_unknown_symbol,
+ and nodebug_tls_symbol members.
+ (struct objfile_type): New data structure.
+ (objfile_type): Add prototype.
+ * gdbtypes.c (gdbtypes_post_init): Remove initialization code
+ for types no longer in struct builtin_type.
+ (objfile_type_data): New static variable.
+ (_initialize_gdbtypes): Initialize it.
+ (objfile_type): New function.
+
+ * gdbtypes.h (builtin_type_error): Remove.
+ * gdbtypes.c (build_complex): Do not use builtin_type_error.
+ * symtab.c (builtin_type_error): Remove.
+ (_initialize_symtab): Remove initialization.
+
+ * stabsread.c (dbx_lookup_type, define_symbol, error_type,
+ rs6000_builtin_type, read_range_type): Use per-objfile types
+ instead of global or per-architecture builtin types.
+ * coffread.c (decode_type): Likewise.
+ * dwarf2read.c (read_array_type, read_tag_string_type,
+ new_symbol, die_type): Likewise.
+ * mdebugread.c (parse_symbol, basic_type, upgrade_type,
+ parse_procedure, psymtab_to_symtab_1): Likewise.
+ * xcoffread.c (process_xcoff_symbol): Likewise.
+ * parse.c (write_exp_msymbol): Likewise.
+
+ * stabsread.c (rs6000_builtin_type_data): New static variable.
+ (_initialize_stabsread): Initialize it.
+ (rs6000_builtin_type): Add OBJFILE argument. Allocate builtin
+ types per-objfile instead of globally.
+
+ * stabsread.c (dbx_lookup_type): Add OBJFILE argument. Use it
+ instead of current_objfile; pass it to rs6000_builtin_type.
+ (dbx_alloc_type, read_type, read_range_type): Update calls.
+ (cleanup_undefined_types_noname): Add OBJFILE argument and
+ pass it to dbx_lookup_type.
+ (cleanup_undefined_types): Add OBJFILE argument and pass it
+ to cleanup_undefined_types_noname.
+ * stabsread.h (cleanup_undefined_types): Add OBJFILE argument.
+ * buildsym.c (end_symtab): Update call.
+
+2009-06-29 Ulrich Weigand <uweigand@de.ibm.com>
+
* darwin-nat-info.c (darwin_debug_regions_recurse): Use
target_gdbarch instead of current_gdbarch.
diff --git a/gdb/buildsym.c b/gdb/buildsym.c
index 71bd8f4..e1d2461 100644
--- a/gdb/buildsym.c
+++ b/gdb/buildsym.c
@@ -997,7 +997,7 @@ end_symtab (CORE_ADDR end_addr, struct objfile *objfile, int section)
are no-ops. FIXME: Is this handled right in case of QUIT? Can
we make this cleaner? */
- cleanup_undefined_types ();
+ cleanup_undefined_types (objfile);
finish_global_stabs (objfile);
if (pending_blocks == NULL
diff --git a/gdb/coffread.c b/gdb/coffread.c
index ee8b380..888f8b4 100644
--- a/gdb/coffread.c
+++ b/gdb/coffread.c
@@ -1713,7 +1713,7 @@ decode_type (struct coff_symbol *cs, unsigned int c_type,
*dim = 0;
base_type = decode_type (cs, new_c_type, aux, objfile);
- index_type = builtin_type_int32;
+ index_type = objfile_type (objfile)->builtin_int;
range_type =
create_range_type ((struct type *) NULL, index_type, 0, n - 1);
type =
@@ -1777,39 +1777,39 @@ decode_base_type (struct coff_symbol *cs, unsigned int c_type,
{
case T_NULL:
/* shows up with "void (*foo)();" structure members */
- return builtin_type (gdbarch)->builtin_void;
+ return objfile_type (objfile)->builtin_void;
#ifdef T_VOID
case T_VOID:
/* Intel 960 COFF has this symbol and meaning. */
- return builtin_type (gdbarch)->builtin_void;
+ return objfile_type (objfile)->builtin_void;
#endif
case T_CHAR:
- return builtin_type (gdbarch)->builtin_char;
+ return objfile_type (objfile)->builtin_char;
case T_SHORT:
- return builtin_type (gdbarch)->builtin_short;
+ return objfile_type (objfile)->builtin_short;
case T_INT:
- return builtin_type (gdbarch)->builtin_int;
+ return objfile_type (objfile)->builtin_int;
case T_LONG:
if (cs->c_sclass == C_FIELD
&& aux->x_sym.x_misc.x_lnsz.x_size
> gdbarch_long_bit (gdbarch))
- return builtin_type (gdbarch)->builtin_long_long;
+ return objfile_type (objfile)->builtin_long_long;
else
- return builtin_type (gdbarch)->builtin_long;
+ return objfile_type (objfile)->builtin_long;
case T_FLOAT:
- return builtin_type (gdbarch)->builtin_float;
+ return objfile_type (objfile)->builtin_float;
case T_DOUBLE:
- return builtin_type (gdbarch)->builtin_double;
+ return objfile_type (objfile)->builtin_double;
case T_LNGDBL:
- return builtin_type (gdbarch)->builtin_long_double;
+ return objfile_type (objfile)->builtin_long_double;
case T_STRUCT:
if (cs->c_naux != 1)
@@ -1890,24 +1890,24 @@ decode_base_type (struct coff_symbol *cs, unsigned int c_type,
break;
case T_UCHAR:
- return builtin_type (gdbarch)->builtin_unsigned_char;
+ return objfile_type (objfile)->builtin_unsigned_char;
case T_USHORT:
- return builtin_type (gdbarch)->builtin_unsigned_short;
+ return objfile_type (objfile)->builtin_unsigned_short;
case T_UINT:
- return builtin_type (gdbarch)->builtin_unsigned_int;
+ return objfile_type (objfile)->builtin_unsigned_int;
case T_ULONG:
if (cs->c_sclass == C_FIELD
&& aux->x_sym.x_misc.x_lnsz.x_size
> gdbarch_long_bit (gdbarch))
- return builtin_type (gdbarch)->builtin_unsigned_long_long;
+ return objfile_type (objfile)->builtin_unsigned_long_long;
else
- return builtin_type (gdbarch)->builtin_unsigned_long;
+ return objfile_type (objfile)->builtin_unsigned_long;
}
complaint (&symfile_complaints, _("Unexpected type for symbol %s"), cs->c_name);
- return builtin_type (gdbarch)->builtin_void;
+ return objfile_type (objfile)->builtin_void;
}
/* This page contains subroutines of read_type. */
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index fe1f384..4b52b6a 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -4830,7 +4830,7 @@ read_array_type (struct die_info *die, struct dwarf2_cu *cu)
arrays with unspecified length. */
if (die->child == NULL)
{
- index_type = builtin_type_int32;
+ index_type = objfile_type (objfile)->builtin_int;
range_type = create_range_type (NULL, index_type, 0, -1);
type = create_array_type (NULL, element_type, range_type);
return set_die_type (die, type, cu);
@@ -5270,7 +5270,7 @@ read_tag_string_type (struct die_info *die, struct dwarf2_cu *cu)
}
}
- index_type = builtin_type_int32;
+ index_type = objfile_type (objfile)->builtin_int;
range_type = create_range_type (NULL, index_type, 1, length);
char_type = language_string_char_type (cu->language_defn, gdbarch);
type = create_string_type (NULL, char_type, range_type);
@@ -7735,7 +7735,6 @@ static struct symbol *
new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu)
{
struct objfile *objfile = cu->objfile;
- struct gdbarch *gdbarch = get_objfile_arch (objfile);
struct symbol *sym = NULL;
char *name;
struct attribute *attr = NULL;
@@ -7840,7 +7839,7 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu)
to something sensible. */
if (TYPE_CODE (SYMBOL_TYPE (sym)) == TYPE_CODE_VOID)
SYMBOL_TYPE (sym)
- = builtin_type (gdbarch)->nodebug_data_symbol;
+ = objfile_type (objfile)->nodebug_data_symbol;
attr = dwarf2_attr (die, DW_AT_const_value, cu);
if (attr)
@@ -8148,7 +8147,6 @@ dwarf2_const_value_data (struct attribute *attr,
static struct type *
die_type (struct die_info *die, struct dwarf2_cu *cu)
{
- struct gdbarch *gdbarch = get_objfile_arch (cu->objfile);
struct type *type;
struct attribute *type_attr;
struct die_info *type_die;
@@ -8157,7 +8155,7 @@ die_type (struct die_info *die, struct dwarf2_cu *cu)
if (!type_attr)
{
/* A missing DW_AT_type represents a void type. */
- return builtin_type (gdbarch)->builtin_void;
+ return objfile_type (cu->objfile)->builtin_void;
}
else
type_die = follow_die_ref (die, type_attr, &cu);
diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c
index 005a29d..07e92cb 100644
--- a/gdb/gdbtypes.c
+++ b/gdb/gdbtypes.c
@@ -3070,11 +3070,6 @@ static struct type *
build_complex (int bit, char *name, struct type *target_type)
{
struct type *t;
- if (bit <= 0 || target_type == builtin_type_error)
- {
- gdb_assert (builtin_type_error != NULL);
- return builtin_type_error;
- }
t = init_type (TYPE_CODE_COMPLEX, 2 * bit / TARGET_CHAR_BIT,
0, name, (struct objfile *) NULL);
TYPE_TARGET_TYPE (t) = target_type;
@@ -3087,6 +3082,7 @@ gdbtypes_post_init (struct gdbarch *gdbarch)
struct builtin_type *builtin_type
= GDBARCH_OBSTACK_ZALLOC (gdbarch, struct builtin_type);
+ /* Basic types. */
builtin_type->builtin_void =
init_type (TYPE_CODE_VOID, 1,
0,
@@ -3179,7 +3175,130 @@ gdbtypes_post_init (struct gdbarch *gdbarch)
0,
"_Decimal128", (struct objfile *) NULL);
- /* Pointer/Address types. */
+ /* Default data/code pointer types. */
+ builtin_type->builtin_data_ptr =
+ make_pointer_type (builtin_type->builtin_void, NULL);
+ builtin_type->builtin_func_ptr =
+ lookup_pointer_type (lookup_function_type (builtin_type->builtin_void));
+
+ return builtin_type;
+}
+
+
+/* This set of objfile-based types is intended to be used by symbol
+ readers as basic types. */
+
+static const struct objfile_data *objfile_type_data;
+
+const struct objfile_type *
+objfile_type (struct objfile *objfile)
+{
+ struct gdbarch *gdbarch;
+ struct objfile_type *objfile_type
+ = objfile_data (objfile, objfile_type_data);
+
+ if (objfile_type)
+ return objfile_type;
+
+ objfile_type = OBSTACK_CALLOC (&objfile->objfile_obstack,
+ 1, struct objfile_type);
+
+ /* Use the objfile architecture to determine basic type properties. */
+ gdbarch = get_objfile_arch (objfile);
+
+ /* Basic types. */
+ objfile_type->builtin_void
+ = init_type (TYPE_CODE_VOID, 1,
+ 0,
+ "void", objfile);
+
+ objfile_type->builtin_char
+ = init_type (TYPE_CODE_INT, TARGET_CHAR_BIT / TARGET_CHAR_BIT,
+ (TYPE_FLAG_NOSIGN
+ | (gdbarch_char_signed (gdbarch) ? 0 : TYPE_FLAG_UNSIGNED)),
+ "char", objfile);
+ objfile_type->builtin_signed_char
+ = init_type (TYPE_CODE_INT, TARGET_CHAR_BIT / TARGET_CHAR_BIT,
+ 0,
+ "signed char", objfile);
+ objfile_type->builtin_unsigned_char
+ = init_type (TYPE_CODE_INT, TARGET_CHAR_BIT / TARGET_CHAR_BIT,
+ TYPE_FLAG_UNSIGNED,
+ "unsigned char", objfile);
+ objfile_type->builtin_short
+ = init_type (TYPE_CODE_INT,
+ gdbarch_short_bit (gdbarch) / TARGET_CHAR_BIT,
+ 0, "short", objfile);
+ objfile_type->builtin_unsigned_short
+ = init_type (TYPE_CODE_INT,
+ gdbarch_short_bit (gdbarch) / TARGET_CHAR_BIT,
+ TYPE_FLAG_UNSIGNED, "unsigned short", objfile);
+ objfile_type->builtin_int
+ = init_type (TYPE_CODE_INT,
+ gdbarch_int_bit (gdbarch) / TARGET_CHAR_BIT,
+ 0, "int", objfile);
+ objfile_type->builtin_unsigned_int
+ = init_type (TYPE_CODE_INT,
+ gdbarch_int_bit (gdbarch) / TARGET_CHAR_BIT,
+ TYPE_FLAG_UNSIGNED, "unsigned int", objfile);
+ objfile_type->builtin_long
+ = init_type (TYPE_CODE_INT,
+ gdbarch_long_bit (gdbarch) / TARGET_CHAR_BIT,
+ 0, "long", objfile);
+ objfile_type->builtin_unsigned_long
+ = init_type (TYPE_CODE_INT,
+ gdbarch_long_bit (gdbarch) / TARGET_CHAR_BIT,
+ TYPE_FLAG_UNSIGNED, "unsigned long", objfile);
+ objfile_type->builtin_long_long
+ = init_type (TYPE_CODE_INT,
+ gdbarch_long_long_bit (gdbarch) / TARGET_CHAR_BIT,
+ 0, "long long", objfile);
+ objfile_type->builtin_unsigned_long_long
+ = init_type (TYPE_CODE_INT,
+ gdbarch_long_long_bit (gdbarch) / TARGET_CHAR_BIT,
+ TYPE_FLAG_UNSIGNED, "unsigned long long", objfile);
+
+ objfile_type->builtin_float
+ = init_type (TYPE_CODE_FLT,
+ gdbarch_float_bit (gdbarch) / TARGET_CHAR_BIT,
+ 0, "float", objfile);
+ TYPE_FLOATFORMAT (objfile_type->builtin_float)
+ = gdbarch_float_format (gdbarch);
+ objfile_type->builtin_double
+ = init_type (TYPE_CODE_FLT,
+ gdbarch_double_bit (gdbarch) / TARGET_CHAR_BIT,
+ 0, "double", objfile);
+ TYPE_FLOATFORMAT (objfile_type->builtin_double)
+ = gdbarch_double_format (gdbarch);
+ objfile_type->builtin_long_double
+ = init_type (TYPE_CODE_FLT,
+ gdbarch_long_double_bit (gdbarch) / TARGET_CHAR_BIT,
+ 0, "long double", objfile);
+ TYPE_FLOATFORMAT (objfile_type->builtin_long_double)
+ = gdbarch_long_double_format (gdbarch);
+
+ /* This type represents a type that was unrecognized in symbol read-in. */
+ objfile_type->builtin_error
+ = init_type (TYPE_CODE_ERROR, 0, 0, "<unknown type>", objfile);
+
+ /* The following set of types is used for symbols with no
+ debug information. */
+ objfile_type->nodebug_text_symbol
+ = init_type (TYPE_CODE_FUNC, 1, 0,
+ "<text variable, no debug info>", objfile);
+ TYPE_TARGET_TYPE (objfile_type->nodebug_text_symbol)
+ = objfile_type->builtin_int;
+ objfile_type->nodebug_data_symbol
+ = init_type (TYPE_CODE_INT,
+ gdbarch_int_bit (gdbarch) / HOST_CHAR_BIT, 0,
+ "<data variable, no debug info>", objfile);
+ objfile_type->nodebug_unknown_symbol
+ = init_type (TYPE_CODE_INT, 1, 0,
+ "<variable (not text or data), no debug info>", objfile);
+ objfile_type->nodebug_tls_symbol
+ = init_type (TYPE_CODE_INT,
+ gdbarch_int_bit (gdbarch) / HOST_CHAR_BIT, 0,
+ "<thread local variable, no debug info>", objfile);
/* NOTE: on some targets, addresses and pointers are not necessarily
the same --- for example, on the D10V, pointers are 16 bits long,
@@ -3203,49 +3322,27 @@ gdbtypes_post_init (struct gdbarch *gdbarch)
- If p is a D10V pointer type, TYPE_LENGTH (p) == 2, just as
sizeof (void *) == 2 on the target.
- In this context, builtin_type->CORE_ADDR is a bit odd: it's a
- target type for a value the target will never see. It's only
- used to hold the values of (typeless) linker symbols, which are
- indeed in the unified virtual address space. */
-
- builtin_type->builtin_data_ptr =
- make_pointer_type (builtin_type->builtin_void, NULL);
- builtin_type->builtin_func_ptr =
- lookup_pointer_type (lookup_function_type (builtin_type->builtin_void));
- builtin_type->builtin_core_addr =
- init_type (TYPE_CODE_INT,
- gdbarch_addr_bit (gdbarch) / 8,
- TYPE_FLAG_UNSIGNED,
- "__CORE_ADDR", (struct objfile *) NULL);
+ In this context, objfile_type->builtin_core_addr is a bit odd:
+ it's a target type for a value the target will never see. It's
+ only used to hold the values of (typeless) linker symbols, which
+ are indeed in the unified virtual address space. */
+ objfile_type->builtin_core_addr
+ = init_type (TYPE_CODE_INT,
+ gdbarch_addr_bit (gdbarch) / 8,
+ TYPE_FLAG_UNSIGNED, "__CORE_ADDR", objfile);
- /* The following set of types is used for symbols with no
- debug information. */
- builtin_type->nodebug_text_symbol =
- init_type (TYPE_CODE_FUNC, 1, 0,
- "<text variable, no debug info>", NULL);
- TYPE_TARGET_TYPE (builtin_type->nodebug_text_symbol) =
- builtin_type->builtin_int;
- builtin_type->nodebug_data_symbol =
- init_type (TYPE_CODE_INT,
- gdbarch_int_bit (gdbarch) / HOST_CHAR_BIT, 0,
- "<data variable, no debug info>", NULL);
- builtin_type->nodebug_unknown_symbol =
- init_type (TYPE_CODE_INT, 1, 0,
- "<variable (not text or data), no debug info>", NULL);
- builtin_type->nodebug_tls_symbol =
- init_type (TYPE_CODE_INT,
- gdbarch_int_bit (gdbarch) / HOST_CHAR_BIT, 0,
- "<thread local variable, no debug info>", NULL);
-
- return builtin_type;
+ set_objfile_data (objfile, objfile_type_data, objfile_type);
+ return objfile_type;
}
+
extern void _initialize_gdbtypes (void);
void
_initialize_gdbtypes (void)
{
gdbtypes_data = gdbarch_data_register_post_init (gdbtypes_post_init);
+ objfile_type_data = register_objfile_data ();
/* FIXME: The following types are architecture-neutral. However,
they contain pointer_type and reference_type fields potentially
diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h
index c5175ef..7ef8ca2 100644
--- a/gdb/gdbtypes.h
+++ b/gdb/gdbtypes.h
@@ -957,7 +957,34 @@ extern void allocate_cplus_struct_type (struct type *);
struct builtin_type
{
- /* Address/pointer types. */
+ /* Integral types. */
+
+ /* Implicit size/sign (based on the the architecture's ABI). */
+ struct type *builtin_void;
+ struct type *builtin_char;
+ struct type *builtin_short;
+ struct type *builtin_int;
+ struct type *builtin_long;
+ struct type *builtin_signed_char;
+ struct type *builtin_unsigned_char;
+ struct type *builtin_unsigned_short;
+ struct type *builtin_unsigned_int;
+ struct type *builtin_unsigned_long;
+ struct type *builtin_float;
+ struct type *builtin_double;
+ struct type *builtin_long_double;
+ struct type *builtin_complex;
+ struct type *builtin_double_complex;
+ struct type *builtin_string;
+ struct type *builtin_bool;
+ struct type *builtin_long_long;
+ struct type *builtin_unsigned_long_long;
+ struct type *builtin_decfloat;
+ struct type *builtin_decdouble;
+ struct type *builtin_declong;
+
+
+ /* Pointer types. */
/* `pointer to data' type. Some target platforms use an implicitly
{sign,zero} -extended 32-bit ABI pointer on a 64-bit ISA. */
@@ -972,47 +999,48 @@ struct builtin_type
However, all function pointer types are interconvertible, so void
(*) () can server as a generic function pointer. */
struct type *builtin_func_ptr;
+};
- /* The target CPU's address type. This is the ISA address size. */
- struct type *builtin_core_addr;
-
-
- /* Types used for symbols with no debug information. */
- struct type *nodebug_text_symbol;
- struct type *nodebug_data_symbol;
- struct type *nodebug_unknown_symbol;
- struct type *nodebug_tls_symbol;
+/* Return the type table for the specified architecture. */
+extern const struct builtin_type *builtin_type (struct gdbarch *gdbarch);
- /* Integral types. */
+/* Per-objfile types used by symbol readers. */
- /* Implicit size/sign (based on the the architecture's ABI). */
+struct objfile_type
+{
+ /* Basic types based on the objfile architecture. */
struct type *builtin_void;
struct type *builtin_char;
struct type *builtin_short;
struct type *builtin_int;
struct type *builtin_long;
+ struct type *builtin_long_long;
struct type *builtin_signed_char;
struct type *builtin_unsigned_char;
struct type *builtin_unsigned_short;
struct type *builtin_unsigned_int;
struct type *builtin_unsigned_long;
+ struct type *builtin_unsigned_long_long;
struct type *builtin_float;
struct type *builtin_double;
struct type *builtin_long_double;
- struct type *builtin_complex;
- struct type *builtin_double_complex;
- struct type *builtin_string;
- struct type *builtin_bool;
- struct type *builtin_long_long;
- struct type *builtin_unsigned_long_long;
- struct type *builtin_decfloat;
- struct type *builtin_decdouble;
- struct type *builtin_declong;
+
+ /* This type is used to represent symbol addresses. */
+ struct type *builtin_core_addr;
+
+ /* This type represents a type that was unrecognized in symbol read-in. */
+ struct type *builtin_error;
+
+ /* Types used for symbols with no debug information. */
+ struct type *nodebug_text_symbol;
+ struct type *nodebug_data_symbol;
+ struct type *nodebug_unknown_symbol;
+ struct type *nodebug_tls_symbol;
};
-/* Return the type table for the specified architecture. */
-extern const struct builtin_type *builtin_type (struct gdbarch *gdbarch);
+/* Return the type table for the specified objfile. */
+extern const struct objfile_type *objfile_type (struct objfile *objfile);
/* Explicit sizes - see C9X <intypes.h> for naming scheme. The "int0"
@@ -1064,14 +1092,6 @@ 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;
-
-
-/* RTTI for C++ */
-/* extern struct type *builtin_type_cxx_typeinfo; */
-
/* Maximum and minimum values of built-in types */
#define MAX_OF_TYPE(t) \
diff --git a/gdb/mdebugread.c b/gdb/mdebugread.c
index 65d6d0b..aac82e9 100644
--- a/gdb/mdebugread.c
+++ b/gdb/mdebugread.c
@@ -636,7 +636,7 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend,
/* Type could be missing if file is compiled without debugging info. */
if (SC_IS_UNDEF (sh->sc)
|| sh->sc == scNil || sh->index == indexNil)
- SYMBOL_TYPE (s) = builtin_type (gdbarch)->nodebug_data_symbol;
+ SYMBOL_TYPE (s) = objfile_type (objfile)->nodebug_data_symbol;
else
SYMBOL_TYPE (s) = parse_type (cur_fd, ax, sh->index, 0, bigend, name);
/* Value of a data symbol is its memory address */
@@ -685,7 +685,7 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend,
SYMBOL_DOMAIN (s) = VAR_DOMAIN; /* so that it can be used */
SYMBOL_CLASS (s) = LOC_LABEL; /* but not misused */
SYMBOL_VALUE_ADDRESS (s) = (CORE_ADDR) sh->value;
- SYMBOL_TYPE (s) = builtin_type (gdbarch)->builtin_int;
+ SYMBOL_TYPE (s) = objfile_type (objfile)->builtin_int;
add_symbol (s, top_stack->cur_st, top_stack->cur_block);
break;
@@ -728,7 +728,7 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend,
SYMBOL_CLASS (s) = LOC_BLOCK;
/* Type of the return value */
if (SC_IS_UNDEF (sh->sc) || sh->sc == scNil)
- t = builtin_type (gdbarch)->builtin_int;
+ t = objfile_type (objfile)->builtin_int;
else
{
t = parse_type (cur_fd, ax, sh->index + 1, 0, bigend, name);
@@ -1138,7 +1138,7 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend,
s = new_symbol (MDEBUG_EFI_SYMBOL_NAME);
SYMBOL_DOMAIN (s) = LABEL_DOMAIN;
SYMBOL_CLASS (s) = LOC_CONST;
- SYMBOL_TYPE (s) = builtin_type_void;
+ SYMBOL_TYPE (s) = objfile_type (current_objfile)->builtin_void;
e = ((struct mdebug_extra_func_info *)
obstack_alloc (&current_objfile->objfile_obstack,
sizeof (struct mdebug_extra_func_info)));
@@ -1359,13 +1359,13 @@ basic_type (int bt, struct objfile *objfile)
switch (bt)
{
case btNil:
- tp = builtin_type_void;
+ tp = objfile_type (objfile)->builtin_void;
break;
case btAdr:
tp = init_type (TYPE_CODE_PTR, 4, TYPE_FLAG_UNSIGNED,
"adr_32", objfile);
- TYPE_TARGET_TYPE (tp) = builtin_type_void;
+ TYPE_TARGET_TYPE (tp) = objfile_type (objfile)->builtin_void;
break;
case btChar:
@@ -1457,7 +1457,7 @@ basic_type (int bt, struct objfile *objfile)
break;
case btVoid:
- tp = builtin_type_void;
+ tp = objfile_type (objfile)->builtin_void;
break;
case btLong64:
@@ -1483,7 +1483,7 @@ basic_type (int bt, struct objfile *objfile)
case btAdr64:
tp = init_type (TYPE_CODE_PTR, 8, TYPE_FLAG_UNSIGNED,
"adr_64", objfile);
- TYPE_TARGET_TYPE (tp) = builtin_type_void;
+ TYPE_TARGET_TYPE (tp) = objfile_type (objfile)->builtin_void;
break;
case btInt64:
@@ -1849,7 +1849,7 @@ upgrade_type (int fd, struct type **tpp, int tq, union aux_ext *ax, int bigend,
{
complaint (&symfile_complaints,
_("illegal array index type for %s, assuming int"), sym_name);
- indx = builtin_type_int32;
+ indx = objfile_type (current_objfile)->builtin_int;
}
/* Get the bounds, and create the array type. */
@@ -1918,7 +1918,6 @@ static void
parse_procedure (PDR *pr, struct symtab *search_symtab,
struct partial_symtab *pst)
{
- struct gdbarch *gdbarch = get_objfile_arch (pst->objfile);
struct symbol *s, *i;
struct block *b;
char *sh_name;
@@ -2002,7 +2001,7 @@ parse_procedure (PDR *pr, struct symtab *search_symtab,
SYMBOL_CLASS (s) = LOC_BLOCK;
/* Donno its type, hope int is ok */
SYMBOL_TYPE (s)
- = lookup_function_type (builtin_type (gdbarch)->builtin_int);
+ = lookup_function_type (objfile_type (pst->objfile)->builtin_int);
add_symbol (s, top_stack->cur_st, top_stack->cur_block);
/* Wont have symbols for this one */
b = new_block (2);
@@ -2057,7 +2056,7 @@ parse_procedure (PDR *pr, struct symtab *search_symtab,
if (processing_gcc_compilation == 0
&& found_ecoff_debugging_info == 0
&& TYPE_CODE (TYPE_TARGET_TYPE (SYMBOL_TYPE (s))) == TYPE_CODE_VOID)
- SYMBOL_TYPE (s) = builtin_type (gdbarch)->nodebug_text_symbol;
+ SYMBOL_TYPE (s) = objfile_type (pst->objfile)->nodebug_text_symbol;
}
/* Parse the external symbol ES. Just call parse_symbol() after
@@ -4043,7 +4042,7 @@ psymtab_to_symtab_1 (struct partial_symtab *pst, char *filename)
memset (e, 0, sizeof (struct mdebug_extra_func_info));
SYMBOL_DOMAIN (s) = LABEL_DOMAIN;
SYMBOL_CLASS (s) = LOC_CONST;
- SYMBOL_TYPE (s) = builtin_type_void;
+ SYMBOL_TYPE (s) = objfile_type (pst->objfile)->builtin_void;
SYMBOL_VALUE_BYTES (s) = (gdb_byte *) e;
e->pdr.framereg = -1;
add_symbol_to_list (s, &local_symbols);
diff --git a/gdb/parse.c b/gdb/parse.c
index 5de3bc7..de4cd6c 100644
--- a/gdb/parse.c
+++ b/gdb/parse.c
@@ -489,7 +489,7 @@ write_exp_msymbol (struct minimal_symbol *msymbol)
write_exp_elt_opcode (OP_LONG);
/* Let's make the type big enough to hold a 64-bit address. */
- write_exp_elt_type (builtin_type (gdbarch)->builtin_core_addr);
+ write_exp_elt_type (objfile_type (objfile)->builtin_core_addr);
write_exp_elt_longcst ((LONGEST) addr);
write_exp_elt_opcode (OP_LONG);
@@ -497,7 +497,7 @@ write_exp_msymbol (struct minimal_symbol *msymbol)
{
write_exp_elt_opcode (UNOP_MEMVAL_TLS);
write_exp_elt_objfile (objfile);
- write_exp_elt_type (builtin_type (gdbarch)->nodebug_tls_symbol);
+ write_exp_elt_type (objfile_type (objfile)->nodebug_tls_symbol);
write_exp_elt_opcode (UNOP_MEMVAL_TLS);
return;
}
@@ -508,18 +508,18 @@ write_exp_msymbol (struct minimal_symbol *msymbol)
case mst_text:
case mst_file_text:
case mst_solib_trampoline:
- write_exp_elt_type (builtin_type (gdbarch)->nodebug_text_symbol);
+ write_exp_elt_type (objfile_type (objfile)->nodebug_text_symbol);
break;
case mst_data:
case mst_file_data:
case mst_bss:
case mst_file_bss:
- write_exp_elt_type (builtin_type (gdbarch)->nodebug_data_symbol);
+ write_exp_elt_type (objfile_type (objfile)->nodebug_data_symbol);
break;
default:
- write_exp_elt_type (builtin_type (gdbarch)->nodebug_unknown_symbol);
+ write_exp_elt_type (objfile_type (objfile)->nodebug_unknown_symbol);
break;
}
write_exp_elt_opcode (UNOP_MEMVAL);
diff --git a/gdb/stabsread.c b/gdb/stabsread.c
index ed67096..624a4c0 100644
--- a/gdb/stabsread.c
+++ b/gdb/stabsread.c
@@ -114,7 +114,7 @@ static struct type *read_sun_floating_type (char **, int[2],
static struct type *read_enum_type (char **, struct type *, struct objfile *);
-static struct type *rs6000_builtin_type (int);
+static struct type *rs6000_builtin_type (int, struct objfile *);
static int
read_member_functions (struct field_info *, char **, struct type *,
@@ -218,7 +218,7 @@ static int noname_undefs_length;
or for associating a new type with the pair. */
static struct type **
-dbx_lookup_type (int typenums[2])
+dbx_lookup_type (int typenums[2], struct objfile *objfile)
{
int filenum = typenums[0];
int index = typenums[1];
@@ -249,7 +249,7 @@ dbx_lookup_type (int typenums[2])
this will do the right thing. */
static struct type *temp_type;
- temp_type = rs6000_builtin_type (index);
+ temp_type = rs6000_builtin_type (index, objfile);
return &temp_type;
}
@@ -280,18 +280,18 @@ dbx_lookup_type (int typenums[2])
{
real_filenum = this_object_header_files[filenum];
- if (real_filenum >= N_HEADER_FILES (current_objfile))
+ if (real_filenum >= N_HEADER_FILES (objfile))
{
- static struct type **temp_type_p;
+ static struct type *temp_type;
warning (_("GDB internal error: bad real_filenum"));
error_return:
- temp_type_p = &builtin_type_error;
- return temp_type_p;
+ temp_type = objfile_type (objfile)->builtin_error;
+ return &temp_type;
}
- f = HEADER_FILES (current_objfile) + real_filenum;
+ f = HEADER_FILES (objfile) + real_filenum;
f_orig_length = f->length;
if (index >= f_orig_length)
@@ -325,7 +325,7 @@ dbx_alloc_type (int typenums[2], struct objfile *objfile)
return (alloc_type (objfile));
}
- type_addr = dbx_lookup_type (typenums);
+ type_addr = dbx_lookup_type (typenums, objfile);
/* If we are referring to a type not known at all yet,
allocate an empty type for it.
@@ -772,7 +772,7 @@ define_symbol (CORE_ADDR valu, char *string, int desc, int type,
target arithmetic to get the value. real.c in GCC
probably has the necessary code. */
- dbl_type = builtin_type (gdbarch)->builtin_double;
+ dbl_type = objfile_type (objfile)->builtin_double;
dbl_valu =
obstack_alloc (&objfile->objfile_obstack,
TYPE_LENGTH (dbl_type));
@@ -792,7 +792,7 @@ define_symbol (CORE_ADDR valu, char *string, int desc, int type,
types; other languages probably should have at least
unsigned as well as signed constants. */
- SYMBOL_TYPE (sym) = builtin_type (gdbarch)->builtin_long;
+ SYMBOL_TYPE (sym) = objfile_type (objfile)->builtin_long;
SYMBOL_VALUE (sym) = atoi (p);
SYMBOL_CLASS (sym) = LOC_CONST;
}
@@ -903,7 +903,7 @@ define_symbol (CORE_ADDR valu, char *string, int desc, int type,
it back into builtin_int here.
FIXME: Do we need a new builtin_promoted_int_arg ? */
if (TYPE_CODE (ptype) == TYPE_CODE_VOID)
- ptype = builtin_type (gdbarch)->builtin_int;
+ ptype = objfile_type (objfile)->builtin_int;
TYPE_FIELD_TYPE (ftype, nparams) = ptype;
TYPE_FIELD_ARTIFICIAL (ftype, nparams++) = 0;
}
@@ -995,8 +995,8 @@ define_symbol (CORE_ADDR valu, char *string, int desc, int type,
{
SYMBOL_TYPE (sym) =
TYPE_UNSIGNED (SYMBOL_TYPE (sym))
- ? builtin_type (gdbarch)->builtin_unsigned_int
- : builtin_type (gdbarch)->builtin_int;
+ ? objfile_type (objfile)->builtin_unsigned_int
+ : objfile_type (objfile)->builtin_int;
}
break;
}
@@ -1401,7 +1401,7 @@ error_type (char **pp, struct objfile *objfile)
break;
}
}
- return (builtin_type_error);
+ return objfile_type (objfile)->builtin_error;
}
@@ -1577,7 +1577,7 @@ again:
obstack_free (&objfile->objfile_obstack, type_name);
type = SYMBOL_TYPE (sym);
if (typenums[0] != -1)
- *dbx_lookup_type (typenums) = type;
+ *dbx_lookup_type (typenums, objfile) = type;
return type;
}
}
@@ -1672,17 +1672,18 @@ again:
case '*': /* Pointer to another type */
type1 = read_type (pp, objfile);
- type = make_pointer_type (type1, dbx_lookup_type (typenums));
+ type = make_pointer_type (type1, dbx_lookup_type (typenums, objfile));
break;
case '&': /* Reference to another type */
type1 = read_type (pp, objfile);
- type = make_reference_type (type1, dbx_lookup_type (typenums));
+ type = make_reference_type (type1, dbx_lookup_type (typenums, objfile));
break;
case 'f': /* Function returning another type */
type1 = read_type (pp, objfile);
- type = make_function_type (type1, dbx_lookup_type (typenums), objfile);
+ type = make_function_type (type1, dbx_lookup_type (typenums, objfile),
+ objfile);
break;
case 'g': /* Prototyped function. (Sun) */
@@ -1705,8 +1706,8 @@ again:
const char *type_start = (*pp) - 1;
struct type *return_type = read_type (pp, objfile);
struct type *func_type
- = make_function_type (return_type, dbx_lookup_type (typenums),
- objfile);
+ = make_function_type (return_type,
+ dbx_lookup_type (typenums, objfile), objfile);
struct type_list {
struct type *type;
struct type_list *next;
@@ -1762,13 +1763,13 @@ again:
case 'k': /* Const qualifier on some type (Sun) */
type = read_type (pp, objfile);
type = make_cv_type (1, TYPE_VOLATILE (type), type,
- dbx_lookup_type (typenums));
+ dbx_lookup_type (typenums, objfile));
break;
case 'B': /* Volatile qual on some type (Sun) */
type = read_type (pp, objfile);
type = make_cv_type (TYPE_CONST (type), 1, type,
- dbx_lookup_type (typenums));
+ dbx_lookup_type (typenums, objfile));
break;
case '@':
@@ -1842,7 +1843,7 @@ again:
symnum);
type = allocate_stub_method (return_type);
if (typenums[0] != -1)
- *dbx_lookup_type (typenums) = type;
+ *dbx_lookup_type (typenums, objfile) = type;
}
else
{
@@ -1870,7 +1871,7 @@ again:
case 'r': /* Range type */
type = read_range_type (pp, typenums, type_size, objfile);
if (typenums[0] != -1)
- *dbx_lookup_type (typenums) = type;
+ *dbx_lookup_type (typenums, objfile) = type;
break;
case 'b':
@@ -1878,21 +1879,21 @@ again:
/* Sun ACC builtin int type */
type = read_sun_builtin_type (pp, typenums, objfile);
if (typenums[0] != -1)
- *dbx_lookup_type (typenums) = type;
+ *dbx_lookup_type (typenums, objfile) = type;
}
break;
case 'R': /* Sun ACC builtin float type */
type = read_sun_floating_type (pp, typenums, objfile);
if (typenums[0] != -1)
- *dbx_lookup_type (typenums) = type;
+ *dbx_lookup_type (typenums, objfile) = type;
break;
case 'e': /* Enumeration type */
type = dbx_alloc_type (typenums, objfile);
type = read_enum_type (pp, type, objfile);
if (typenums[0] != -1)
- *dbx_lookup_type (typenums) = type;
+ *dbx_lookup_type (typenums, objfile) = type;
break;
case 's': /* Struct type */
@@ -1932,7 +1933,7 @@ again:
if (is_string)
TYPE_CODE (type) = TYPE_CODE_BITSTRING;
if (typenums[0] != -1)
- *dbx_lookup_type (typenums) = type;
+ *dbx_lookup_type (typenums, objfile) = type;
break;
default:
@@ -1957,20 +1958,31 @@ again:
/* RS/6000 xlc/dbx combination uses a set of builtin types, starting from -1.
Return the proper type node for a given builtin type number. */
+static const struct objfile_data *rs6000_builtin_type_data;
+
static struct type *
-rs6000_builtin_type (int typenum)
+rs6000_builtin_type (int typenum, struct objfile *objfile)
{
+ struct type **negative_types = objfile_data (objfile, rs6000_builtin_type_data);
+
/* We recognize types numbered from -NUMBER_RECOGNIZED to -1. */
#define NUMBER_RECOGNIZED 34
- /* This includes an empty slot for type number -0. */
- static struct type *negative_types[NUMBER_RECOGNIZED + 1];
struct type *rettype = NULL;
if (typenum >= 0 || typenum < -NUMBER_RECOGNIZED)
{
complaint (&symfile_complaints, _("Unknown builtin type %d"), typenum);
- return builtin_type_error;
+ return objfile_type (objfile)->builtin_error;
}
+
+ if (!negative_types)
+ {
+ /* This includes an empty slot for type number -0. */
+ negative_types = OBSTACK_CALLOC (&objfile->objfile_obstack,
+ NUMBER_RECOGNIZED + 1, struct type *);
+ set_objfile_data (objfile, rs6000_builtin_type_data, negative_types);
+ }
+
if (negative_types[-typenum] != NULL)
return negative_types[-typenum];
@@ -1990,129 +2002,129 @@ rs6000_builtin_type (int typenum)
is other than 32 bits, then it should use a new negative type
number (or avoid negative type numbers for that case).
See stabs.texinfo. */
- rettype = init_type (TYPE_CODE_INT, 4, 0, "int", NULL);
+ rettype = init_type (TYPE_CODE_INT, 4, 0, "int", objfile);
break;
case 2:
- rettype = init_type (TYPE_CODE_INT, 1, 0, "char", NULL);
+ rettype = init_type (TYPE_CODE_INT, 1, 0, "char", objfile);
break;
case 3:
- rettype = init_type (TYPE_CODE_INT, 2, 0, "short", NULL);
+ rettype = init_type (TYPE_CODE_INT, 2, 0, "short", objfile);
break;
case 4:
- rettype = init_type (TYPE_CODE_INT, 4, 0, "long", NULL);
+ rettype = init_type (TYPE_CODE_INT, 4, 0, "long", objfile);
break;
case 5:
rettype = init_type (TYPE_CODE_INT, 1, TYPE_FLAG_UNSIGNED,
- "unsigned char", NULL);
+ "unsigned char", objfile);
break;
case 6:
- rettype = init_type (TYPE_CODE_INT, 1, 0, "signed char", NULL);
+ rettype = init_type (TYPE_CODE_INT, 1, 0, "signed char", objfile);
break;
case 7:
rettype = init_type (TYPE_CODE_INT, 2, TYPE_FLAG_UNSIGNED,
- "unsigned short", NULL);
+ "unsigned short", objfile);
break;
case 8:
rettype = init_type (TYPE_CODE_INT, 4, TYPE_FLAG_UNSIGNED,
- "unsigned int", NULL);
+ "unsigned int", objfile);
break;
case 9:
rettype = init_type (TYPE_CODE_INT, 4, TYPE_FLAG_UNSIGNED,
- "unsigned", NULL);
+ "unsigned", objfile);
case 10:
rettype = init_type (TYPE_CODE_INT, 4, TYPE_FLAG_UNSIGNED,
- "unsigned long", NULL);
+ "unsigned long", objfile);
break;
case 11:
- rettype = init_type (TYPE_CODE_VOID, 1, 0, "void", NULL);
+ rettype = init_type (TYPE_CODE_VOID, 1, 0, "void", objfile);
break;
case 12:
/* IEEE single precision (32 bit). */
- rettype = init_type (TYPE_CODE_FLT, 4, 0, "float", NULL);
+ rettype = init_type (TYPE_CODE_FLT, 4, 0, "float", objfile);
break;
case 13:
/* IEEE double precision (64 bit). */
- rettype = init_type (TYPE_CODE_FLT, 8, 0, "double", NULL);
+ rettype = init_type (TYPE_CODE_FLT, 8, 0, "double", objfile);
break;
case 14:
/* This is an IEEE double on the RS/6000, and different machines with
different sizes for "long double" should use different negative
type numbers. See stabs.texinfo. */
- rettype = init_type (TYPE_CODE_FLT, 8, 0, "long double", NULL);
+ rettype = init_type (TYPE_CODE_FLT, 8, 0, "long double", objfile);
break;
case 15:
- rettype = init_type (TYPE_CODE_INT, 4, 0, "integer", NULL);
+ rettype = init_type (TYPE_CODE_INT, 4, 0, "integer", objfile);
break;
case 16:
rettype = init_type (TYPE_CODE_BOOL, 4, TYPE_FLAG_UNSIGNED,
- "boolean", NULL);
+ "boolean", objfile);
break;
case 17:
- rettype = init_type (TYPE_CODE_FLT, 4, 0, "short real", NULL);
+ rettype = init_type (TYPE_CODE_FLT, 4, 0, "short real", objfile);
break;
case 18:
- rettype = init_type (TYPE_CODE_FLT, 8, 0, "real", NULL);
+ rettype = init_type (TYPE_CODE_FLT, 8, 0, "real", objfile);
break;
case 19:
- rettype = init_type (TYPE_CODE_ERROR, 0, 0, "stringptr", NULL);
+ rettype = init_type (TYPE_CODE_ERROR, 0, 0, "stringptr", objfile);
break;
case 20:
rettype = init_type (TYPE_CODE_CHAR, 1, TYPE_FLAG_UNSIGNED,
- "character", NULL);
+ "character", objfile);
break;
case 21:
rettype = init_type (TYPE_CODE_BOOL, 1, TYPE_FLAG_UNSIGNED,
- "logical*1", NULL);
+ "logical*1", objfile);
break;
case 22:
rettype = init_type (TYPE_CODE_BOOL, 2, TYPE_FLAG_UNSIGNED,
- "logical*2", NULL);
+ "logical*2", objfile);
break;
case 23:
rettype = init_type (TYPE_CODE_BOOL, 4, TYPE_FLAG_UNSIGNED,
- "logical*4", NULL);
+ "logical*4", objfile);
break;
case 24:
rettype = init_type (TYPE_CODE_BOOL, 4, TYPE_FLAG_UNSIGNED,
- "logical", NULL);
+ "logical", objfile);
break;
case 25:
/* Complex type consisting of two IEEE single precision values. */
- rettype = init_type (TYPE_CODE_COMPLEX, 8, 0, "complex", NULL);
+ rettype = init_type (TYPE_CODE_COMPLEX, 8, 0, "complex", objfile);
TYPE_TARGET_TYPE (rettype) = init_type (TYPE_CODE_FLT, 4, 0, "float",
- NULL);
+ objfile);
break;
case 26:
/* Complex type consisting of two IEEE double precision values. */
rettype = init_type (TYPE_CODE_COMPLEX, 16, 0, "double complex", NULL);
TYPE_TARGET_TYPE (rettype) = init_type (TYPE_CODE_FLT, 8, 0, "double",
- NULL);
+ objfile);
break;
case 27:
- rettype = init_type (TYPE_CODE_INT, 1, 0, "integer*1", NULL);
+ rettype = init_type (TYPE_CODE_INT, 1, 0, "integer*1", objfile);
break;
case 28:
- rettype = init_type (TYPE_CODE_INT, 2, 0, "integer*2", NULL);
+ rettype = init_type (TYPE_CODE_INT, 2, 0, "integer*2", objfile);
break;
case 29:
- rettype = init_type (TYPE_CODE_INT, 4, 0, "integer*4", NULL);
+ rettype = init_type (TYPE_CODE_INT, 4, 0, "integer*4", objfile);
break;
case 30:
- rettype = init_type (TYPE_CODE_CHAR, 2, 0, "wchar", NULL);
+ rettype = init_type (TYPE_CODE_CHAR, 2, 0, "wchar", objfile);
break;
case 31:
- rettype = init_type (TYPE_CODE_INT, 8, 0, "long long", NULL);
+ rettype = init_type (TYPE_CODE_INT, 8, 0, "long long", objfile);
break;
case 32:
rettype = init_type (TYPE_CODE_INT, 8, TYPE_FLAG_UNSIGNED,
- "unsigned long long", NULL);
+ "unsigned long long", objfile);
break;
case 33:
rettype = init_type (TYPE_CODE_INT, 8, TYPE_FLAG_UNSIGNED,
- "logical*8", NULL);
+ "logical*8", objfile);
break;
case 34:
- rettype = init_type (TYPE_CODE_INT, 8, 0, "integer*8", NULL);
+ rettype = init_type (TYPE_CODE_INT, 8, 0, "integer*8", objfile);
break;
}
negative_types[-typenum] = rettype;
@@ -4062,9 +4074,9 @@ read_range_type (char **pp, int typenums[2], int type_size,
handle_true_range:
if (self_subrange)
- index_type = builtin_type (gdbarch)->builtin_int;
+ index_type = objfile_type (objfile)->builtin_int;
else
- index_type = *dbx_lookup_type (rangenums);
+ index_type = *dbx_lookup_type (rangenums, objfile);
if (index_type == NULL)
{
/* Does this actually ever happen? Is that why we are worrying
@@ -4073,7 +4085,7 @@ handle_true_range:
complaint (&symfile_complaints,
_("base type %d of range type is not defined"), rangenums[1]);
- index_type = builtin_type (gdbarch)->builtin_int;
+ index_type = objfile_type (objfile)->builtin_int;
}
result_type = create_range_type ((struct type *) NULL, index_type, n2, n3);
@@ -4293,7 +4305,7 @@ add_undefined_type (struct type *type, int typenums[2])
/* Try to fix all undefined types pushed on the UNDEF_TYPES vector. */
static void
-cleanup_undefined_types_noname (void)
+cleanup_undefined_types_noname (struct objfile *objfile)
{
int i;
@@ -4302,7 +4314,7 @@ cleanup_undefined_types_noname (void)
struct nat nat = noname_undefs[i];
struct type **type;
- type = dbx_lookup_type (nat.typenums);
+ type = dbx_lookup_type (nat.typenums, objfile);
if (nat.type != *type && TYPE_CODE (*type) != TYPE_CODE_UNDEF)
{
/* The instance flags of the undefined type are still unset,
@@ -4415,10 +4427,10 @@ cleanup_undefined_types_1 (void)
this unit. */
void
-cleanup_undefined_types (void)
+cleanup_undefined_types (struct objfile *objfile)
{
cleanup_undefined_types_1 ();
- cleanup_undefined_types_noname ();
+ cleanup_undefined_types_noname (objfile);
}
/* Scan through all of the global symbols defined in the object file,
@@ -4650,6 +4662,8 @@ find_name_end (char *name)
void
_initialize_stabsread (void)
{
+ rs6000_builtin_type_data = register_objfile_data ();
+
undef_types_allocated = 20;
undef_types_length = 0;
undef_types = (struct type **)
diff --git a/gdb/stabsread.h b/gdb/stabsread.h
index 0097a4e..83458d1 100644
--- a/gdb/stabsread.h
+++ b/gdb/stabsread.h
@@ -129,7 +129,7 @@ EXTERN int n_this_object_header_files;
EXTERN int n_allocated_this_object_header_files;
-extern void cleanup_undefined_types (void);
+extern void cleanup_undefined_types (struct objfile *);
extern long read_number (char **, int);
diff --git a/gdb/symtab.c b/gdb/symtab.c
index f677ed0..e6211a0 100644
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -146,9 +146,6 @@ multiple_symbols_select_mode (void)
return multiple_symbols_mode;
}
-/* The single non-language-specific builtin type */
-struct type *builtin_type_error;
-
/* Block in which the most recently searched-for symbol was found.
Might be better to make this a parameter to lookup_symbol and
value_of_this. */
@@ -4779,9 +4776,5 @@ Show how the debugger handles ambiguities in expressions."), _("\
Valid values are \"ask\", \"all\", \"cancel\", and the default is \"all\"."),
NULL, NULL, &setlist, &showlist);
- /* Initialize the one built-in type that isn't language dependent... */
- builtin_type_error = init_type (TYPE_CODE_ERROR, 0, 0,
- "<unknown type>", (struct objfile *) NULL);
-
observer_attach_executable_changed (symtab_observer_executable_changed);
}
diff --git a/gdb/xcoffread.c b/gdb/xcoffread.c
index cdb8a20..c56ab86 100644
--- a/gdb/xcoffread.c
+++ b/gdb/xcoffread.c
@@ -1454,7 +1454,6 @@ read_xcoff_symtab (struct partial_symtab *pst)
static struct symbol *
process_xcoff_symbol (struct coff_symbol *cs, struct objfile *objfile)
{
- struct gdbarch *gdbarch = get_objfile_arch (objfile);
struct symbol onesymbol;
struct symbol *sym = &onesymbol;
struct symbol *sym2 = NULL;
@@ -1494,7 +1493,7 @@ process_xcoff_symbol (struct coff_symbol *cs, struct objfile *objfile)
patch_block_stabs (), unless the file was compiled without -g. */
SYMBOL_SET_LINKAGE_NAME (sym, SYMNAME_ALLOC (name, symname_alloced));
- SYMBOL_TYPE (sym) = builtin_type (gdbarch)->nodebug_text_symbol;
+ SYMBOL_TYPE (sym) = objfile_type (objfile)->nodebug_text_symbol;
SYMBOL_CLASS (sym) = LOC_BLOCK;
SYMBOL_DUP (sym, sym2);
@@ -1507,7 +1506,7 @@ process_xcoff_symbol (struct coff_symbol *cs, struct objfile *objfile)
else
{
/* In case we can't figure out the type, provide default. */
- SYMBOL_TYPE (sym) = builtin_type (gdbarch)->nodebug_data_symbol;
+ SYMBOL_TYPE (sym) = objfile_type (objfile)->nodebug_data_symbol;
switch (cs->c_sclass)
{