diff options
-rw-r--r-- | gdb/ChangeLog | 51 | ||||
-rw-r--r-- | gdb/Makefile.in | 2 | ||||
-rw-r--r-- | gdb/coffread.c | 121 | ||||
-rw-r--r-- | gdb/dbxread.c | 29 | ||||
-rw-r--r-- | gdb/dwarf2-frame.c | 7 | ||||
-rw-r--r-- | gdb/dwarf2loc.c | 13 | ||||
-rw-r--r-- | gdb/dwarf2read.c | 17 | ||||
-rw-r--r-- | gdb/elfread.c | 7 | ||||
-rw-r--r-- | gdb/mdebugread.c | 20 | ||||
-rw-r--r-- | gdb/objfiles.c | 11 | ||||
-rw-r--r-- | gdb/objfiles.h | 9 | ||||
-rw-r--r-- | gdb/somread.c | 15 | ||||
-rw-r--r-- | gdb/stabsread.c | 85 | ||||
-rw-r--r-- | gdb/xcoffread.c | 9 |
14 files changed, 236 insertions, 160 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index a26b5d57cce..982fbf2c1bd 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,54 @@ +2008-03-26 Ulrich Weigand <uweigand@de.ibm.com> + + * objfiles.h (struct objfile): New GDBARCH member. + (get_objfile_arch): Add prototype. + * objfiles.c: Include "arch-utils.h". + (allocate_objfile): Look up gdbarch associated with bfd. + (get_objfile_arch): New function. + * Makefile (objfiles.o): Update dependencies. + + * dwarf2-frame.c (decode_frame_entry_1): Replace current_gdbarch + by objfile arch. + * dwarf2loc.c (dwarf_expr_read_reg): Replace current_gdbarch + by frame arch. + (locexpr_describe_location): Replace current_gdbarch by + objfile arch. + * dwarf2read.c (die_type): Replace current_gdbarch by objfile arch. + (dwarf2_add_field): Likewise. + (read_tag_pointer_type): Likewise. + (read_base_type): Likewise. + (new_symbol): Likewise. + + * coffread.c (decode_type): Add OBJFILE argument. Update callers. + (decode_base_type, decode_function_type): Likewise. + (coff_read_struct_type, coff_read_enum_type): Likewise. + (coff_symtab_read): Replace current_gdbarch by objfile arch. + (decode_base_type): Likewise. + (coff_read_enum_type): Likewise. + (coff_read_struct_type): Replace current_objfile by OBJFILE argument. + (coff_read_enum_type): Likewise. + + * dbxread.c (read_dbx_symtab): Replace current_gdbarch by objfile arch. + (end_psymtab): Likewise. + (process_one_symbol): Likewise. + + * mdebugread.c (parse_symbol): Replace current_gdbarch by objfile arch. + (parse_procedure): Likewise. + (parse_partial_symbols): Likewise. + + * somread.c (som_symtab_read): Replace current_gdbarch by objfile arch. + + * stabsread.c (define_symbol): Replace current_gdbarch by objfile arch. + Replace static pcc_promotion_type and pcc_unsigned_promotion_type by + built-in types. + (read_range_type): Replace current_gdbarch by objfile arch. Replace + static range_index_type by built-in type. + (read_one_struct_field): Replace current_gdbarch by objfile arch. + (read_enum_type): Likewise. + + * xcoffread.c (read_xcoff_symtab): Replace current_gdbarch by + objfile arch. + 2008-03-26 Vladimir Prus <vladimir@codesourcery.com> * varobj.h (varobj_floating_p): Declare. diff --git a/gdb/Makefile.in b/gdb/Makefile.in index 72910d34f8f..424d81f1b10 100644 --- a/gdb/Makefile.in +++ b/gdb/Makefile.in @@ -2539,7 +2539,7 @@ objfiles.o: objfiles.c $(defs_h) $(bfd_h) $(symtab_h) $(symfile_h) \ $(objfiles_h) $(gdb_stabs_h) $(target_h) $(bcache_h) $(mdebugread_h) \ $(gdb_assert_h) $(gdb_stat_h) $(gdb_obstack_h) $(gdb_string_h) \ $(hashtab_h) $(breakpoint_h) $(block_h) $(dictionary_h) $(source_h) \ - $(parser_defs_h) $(expression_h) $(addrmap_h) + $(parser_defs_h) $(expression_h) $(addrmap_h) $(arch_utils_h) observer.o: observer.c $(defs_h) $(observer_h) $(command_h) $(gdbcmd_h) \ $(observer_inc) obsd-tdep.o: obsd-tdep.c $(defs_h) $(frame_h) $(symtab_h) $(obsd_tdep_h) diff --git a/gdb/coffread.c b/gdb/coffread.c index a8d55236698..7f01da6abfe 100644 --- a/gdb/coffread.c +++ b/gdb/coffread.c @@ -137,19 +137,24 @@ struct coff_symbol extern void stabsread_clear_cache (void); -static struct type *coff_read_struct_type (int, int, int); +static struct type *coff_read_struct_type (int, int, int, + struct objfile *); static struct type *decode_base_type (struct coff_symbol *, - unsigned int, union internal_auxent *); + unsigned int, union internal_auxent *, + struct objfile *); static struct type *decode_type (struct coff_symbol *, unsigned int, - union internal_auxent *); + union internal_auxent *, + struct objfile *); static struct type *decode_function_type (struct coff_symbol *, unsigned int, - union internal_auxent *); + union internal_auxent *, + struct objfile *); -static struct type *coff_read_enum_type (int, int, int); +static struct type *coff_read_enum_type (int, int, int, + struct objfile *); static struct symbol *process_coff_symbol (struct coff_symbol *, union internal_auxent *, @@ -679,6 +684,7 @@ static void coff_symtab_read (long symtab_offset, unsigned int nsyms, struct objfile *objfile) { + struct gdbarch *gdbarch = get_objfile_arch (objfile); struct context_stack *new; struct coff_symbol coff_symbol; struct coff_symbol *cs = &coff_symbol; @@ -910,8 +916,7 @@ coff_symtab_read (long symtab_offset, unsigned int nsyms, cs->c_sclass == C_EXT || cs->c_sclass == C_THUMBEXTFUNC || cs->c_sclass == C_THUMBEXT ? mst_text : mst_file_text; - tmpaddr = gdbarch_smash_text_address - (current_gdbarch, tmpaddr); + tmpaddr = gdbarch_smash_text_address (gdbarch, tmpaddr); } else if (bfd_section->flags & SEC_ALLOC && bfd_section->flags & SEC_LOAD) @@ -932,8 +937,7 @@ coff_symtab_read (long symtab_offset, unsigned int nsyms, msym = record_minimal_symbol (cs, tmpaddr, ms_type, sec, objfile); if (msym) - gdbarch_coff_make_msymbol_special - (current_gdbarch, cs->c_sclass, msym); + gdbarch_coff_make_msymbol_special (gdbarch, cs->c_sclass, msym); if (SDB_TYPE (cs->c_type)) { @@ -1503,7 +1507,7 @@ process_coff_symbol (struct coff_symbol *cs, { SYMBOL_VALUE (sym) += ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile)); SYMBOL_TYPE (sym) = - lookup_function_type (decode_function_type (cs, cs->c_type, aux)); + lookup_function_type (decode_function_type (cs, cs->c_type, aux, objfile)); SYMBOL_CLASS (sym) = LOC_BLOCK; if (cs->c_sclass == C_STAT || cs->c_sclass == C_THUMBSTAT @@ -1515,7 +1519,7 @@ process_coff_symbol (struct coff_symbol *cs, } else { - SYMBOL_TYPE (sym) = decode_type (cs, cs->c_type, aux); + SYMBOL_TYPE (sym) = decode_type (cs, cs->c_type, aux, objfile); switch (cs->c_sclass) { case C_NULL: @@ -1662,7 +1666,7 @@ process_coff_symbol (struct coff_symbol *cs, static struct type * decode_type (struct coff_symbol *cs, unsigned int c_type, - union internal_auxent *aux) + union internal_auxent *aux, struct objfile *objfile) { struct type *type = 0; unsigned int new_c_type; @@ -1672,12 +1676,12 @@ decode_type (struct coff_symbol *cs, unsigned int c_type, new_c_type = DECREF (c_type); if (ISPTR (c_type)) { - type = decode_type (cs, new_c_type, aux); + type = decode_type (cs, new_c_type, aux, objfile); type = lookup_pointer_type (type); } else if (ISFCN (c_type)) { - type = decode_type (cs, new_c_type, aux); + type = decode_type (cs, new_c_type, aux, objfile); type = lookup_function_type (type); } else if (ISARY (c_type)) @@ -1699,7 +1703,7 @@ decode_type (struct coff_symbol *cs, unsigned int c_type, *dim = *(dim + 1); *dim = 0; - base_type = decode_type (cs, new_c_type, aux); + base_type = decode_type (cs, new_c_type, aux, objfile); index_type = builtin_type_int32; range_type = create_range_type ((struct type *) NULL, index_type, 0, n - 1); @@ -1735,7 +1739,7 @@ decode_type (struct coff_symbol *cs, unsigned int c_type, } } - return decode_base_type (cs, BTYPE (c_type), aux); + return decode_base_type (cs, BTYPE (c_type), aux, objfile); } /* Decode a coff type specifier for function definition; @@ -1743,59 +1747,60 @@ decode_type (struct coff_symbol *cs, unsigned int c_type, static struct type * decode_function_type (struct coff_symbol *cs, unsigned int c_type, - union internal_auxent *aux) + union internal_auxent *aux, struct objfile *objfile) { if (aux->x_sym.x_tagndx.l == 0) cs->c_naux = 0; /* auxent refers to function, not base type */ - return decode_type (cs, DECREF (c_type), aux); + return decode_type (cs, DECREF (c_type), aux, objfile); } /* basic C types */ static struct type * decode_base_type (struct coff_symbol *cs, unsigned int c_type, - union internal_auxent *aux) + union internal_auxent *aux, struct objfile *objfile) { + struct gdbarch *gdbarch = get_objfile_arch (objfile); struct type *type; switch (c_type) { case T_NULL: /* shows up with "void (*foo)();" structure members */ - return builtin_type (current_gdbarch)->builtin_void; + return builtin_type (gdbarch)->builtin_void; #ifdef T_VOID case T_VOID: /* Intel 960 COFF has this symbol and meaning. */ - return builtin_type (current_gdbarch)->builtin_void; + return builtin_type (gdbarch)->builtin_void; #endif case T_CHAR: - return builtin_type (current_gdbarch)->builtin_char; + return builtin_type (gdbarch)->builtin_char; case T_SHORT: - return builtin_type (current_gdbarch)->builtin_short; + return builtin_type (gdbarch)->builtin_short; case T_INT: - return builtin_type (current_gdbarch)->builtin_int; + return builtin_type (gdbarch)->builtin_int; case T_LONG: if (cs->c_sclass == C_FIELD && aux->x_sym.x_misc.x_lnsz.x_size - > gdbarch_long_bit (current_gdbarch)) - return builtin_type (current_gdbarch)->builtin_long_long; + > gdbarch_long_bit (gdbarch)) + return builtin_type (gdbarch)->builtin_long_long; else - return builtin_type (current_gdbarch)->builtin_long; + return builtin_type (gdbarch)->builtin_long; case T_FLOAT: - return builtin_type (current_gdbarch)->builtin_float; + return builtin_type (gdbarch)->builtin_float; case T_DOUBLE: - return builtin_type (current_gdbarch)->builtin_double; + return builtin_type (gdbarch)->builtin_double; case T_LNGDBL: - return builtin_type (current_gdbarch)->builtin_long_double; + return builtin_type (gdbarch)->builtin_long_double; case T_STRUCT: if (cs->c_naux != 1) @@ -1817,7 +1822,8 @@ decode_base_type (struct coff_symbol *cs, unsigned int c_type, { type = coff_read_struct_type (cs->c_symnum, aux->x_sym.x_misc.x_lnsz.x_size, - aux->x_sym.x_fcnary.x_fcn.x_endndx.l); + aux->x_sym.x_fcnary.x_fcn.x_endndx.l, + objfile); } return type; @@ -1840,7 +1846,8 @@ decode_base_type (struct coff_symbol *cs, unsigned int c_type, { type = coff_read_struct_type (cs->c_symnum, aux->x_sym.x_misc.x_lnsz.x_size, - aux->x_sym.x_fcnary.x_fcn.x_endndx.l); + aux->x_sym.x_fcnary.x_fcn.x_endndx.l, + objfile); } TYPE_CODE (type) = TYPE_CODE_UNION; return type; @@ -1864,7 +1871,8 @@ decode_base_type (struct coff_symbol *cs, unsigned int c_type, { type = coff_read_enum_type (cs->c_symnum, aux->x_sym.x_misc.x_lnsz.x_size, - aux->x_sym.x_fcnary.x_fcn.x_endndx.l); + aux->x_sym.x_fcnary.x_fcn.x_endndx.l, + objfile); } return type; @@ -1873,24 +1881,24 @@ decode_base_type (struct coff_symbol *cs, unsigned int c_type, break; case T_UCHAR: - return builtin_type (current_gdbarch)->builtin_unsigned_char; + return builtin_type (gdbarch)->builtin_unsigned_char; case T_USHORT: - return builtin_type (current_gdbarch)->builtin_unsigned_short; + return builtin_type (gdbarch)->builtin_unsigned_short; case T_UINT: - return builtin_type (current_gdbarch)->builtin_unsigned_int; + return builtin_type (gdbarch)->builtin_unsigned_int; case T_ULONG: if (cs->c_sclass == C_FIELD && aux->x_sym.x_misc.x_lnsz.x_size - > gdbarch_long_bit (current_gdbarch)) - return builtin_type (current_gdbarch)->builtin_unsigned_long_long; + > gdbarch_long_bit (gdbarch)) + return builtin_type (gdbarch)->builtin_unsigned_long_long; else - return builtin_type (current_gdbarch)->builtin_unsigned_long; + return builtin_type (gdbarch)->builtin_unsigned_long; } complaint (&symfile_complaints, _("Unexpected type for symbol %s"), cs->c_name); - return builtin_type (current_gdbarch)->builtin_void; + return builtin_type (gdbarch)->builtin_void; } /* This page contains subroutines of read_type. */ @@ -1899,7 +1907,8 @@ decode_base_type (struct coff_symbol *cs, unsigned int c_type, object describing the type. */ static struct type * -coff_read_struct_type (int index, int length, int lastsym) +coff_read_struct_type (int index, int length, int lastsym, + struct objfile *objfile) { struct nextfield { @@ -1928,7 +1937,7 @@ coff_read_struct_type (int index, int length, int lastsym) { read_one_sym (ms, &sub_sym, &sub_aux); name = ms->c_name; - name = EXTERNAL_NAME (name, current_objfile->obfd); + name = EXTERNAL_NAME (name, objfile->obfd); switch (ms->c_sclass) { @@ -1942,10 +1951,9 @@ coff_read_struct_type (int index, int length, int lastsym) /* Save the data. */ list->field.name = - obsavestring (name, - strlen (name), - ¤t_objfile->objfile_obstack); - FIELD_TYPE (list->field) = decode_type (ms, ms->c_type, &sub_aux); + obsavestring (name, strlen (name), &objfile->objfile_obstack); + FIELD_TYPE (list->field) = decode_type (ms, ms->c_type, &sub_aux, + objfile); FIELD_BITPOS (list->field) = 8 * ms->c_value; FIELD_BITSIZE (list->field) = 0; FIELD_STATIC_KIND (list->field) = 0; @@ -1961,10 +1969,9 @@ coff_read_struct_type (int index, int length, int lastsym) /* Save the data. */ list->field.name = - obsavestring (name, - strlen (name), - ¤t_objfile->objfile_obstack); - FIELD_TYPE (list->field) = decode_type (ms, ms->c_type, &sub_aux); + obsavestring (name, strlen (name), &objfile->objfile_obstack); + FIELD_TYPE (list->field) = decode_type (ms, ms->c_type, &sub_aux, + objfile); FIELD_BITPOS (list->field) = ms->c_value; FIELD_BITSIZE (list->field) = sub_aux.x_sym.x_misc.x_lnsz.x_size; FIELD_STATIC_KIND (list->field) = 0; @@ -1995,8 +2002,10 @@ coff_read_struct_type (int index, int length, int lastsym) Also defines the symbols that represent the values of the type. */ static struct type * -coff_read_enum_type (int index, int length, int lastsym) +coff_read_enum_type (int index, int length, int lastsym, + struct objfile *objfile) { + struct gdbarch *gdbarch = get_objfile_arch (objfile); struct symbol *sym; struct type *type; int nsyms = 0; @@ -2024,19 +2033,17 @@ coff_read_enum_type (int index, int length, int lastsym) { read_one_sym (ms, &sub_sym, &sub_aux); name = ms->c_name; - name = EXTERNAL_NAME (name, current_objfile->obfd); + name = EXTERNAL_NAME (name, objfile->obfd); switch (ms->c_sclass) { case C_MOE: sym = (struct symbol *) obstack_alloc - (¤t_objfile->objfile_obstack, - sizeof (struct symbol)); + (&objfile->objfile_obstack, sizeof (struct symbol)); memset (sym, 0, sizeof (struct symbol)); DEPRECATED_SYMBOL_NAME (sym) = - obsavestring (name, strlen (name), - ¤t_objfile->objfile_obstack); + obsavestring (name, strlen (name), &objfile->objfile_obstack); SYMBOL_CLASS (sym) = LOC_CONST; SYMBOL_DOMAIN (sym) = VAR_DOMAIN; SYMBOL_VALUE (sym) = ms->c_value; @@ -2058,7 +2065,7 @@ coff_read_enum_type (int index, int length, int lastsym) if (length > 0) TYPE_LENGTH (type) = length; else /* Assume ints. */ - TYPE_LENGTH (type) = gdbarch_int_bit (current_gdbarch) / TARGET_CHAR_BIT; + TYPE_LENGTH (type) = gdbarch_int_bit (gdbarch) / TARGET_CHAR_BIT; TYPE_CODE (type) = TYPE_CODE_ENUM; TYPE_NFIELDS (type) = nsyms; TYPE_FIELDS (type) = (struct field *) diff --git a/gdb/dbxread.c b/gdb/dbxread.c index f55a623acd0..bb9e21a69ba 100644 --- a/gdb/dbxread.c +++ b/gdb/dbxread.c @@ -1181,6 +1181,7 @@ units"), static void read_dbx_symtab (struct objfile *objfile) { + struct gdbarch *gdbarch = get_objfile_arch (objfile); struct external_nlist *bufp = 0; /* =0 avoids gcc -Wall glitch */ struct internal_nlist nlist; CORE_ADDR text_addr; @@ -1479,7 +1480,7 @@ read_dbx_symtab (struct objfile *objfile) don't relocate it. */ if (nlist.n_value == 0 - && gdbarch_sofun_address_maybe_missing (current_gdbarch)) + && gdbarch_sofun_address_maybe_missing (gdbarch)) { textlow_not_set = 1; valu = 0; @@ -1692,9 +1693,9 @@ pos %d"), nlist.n_value += ANOFFSET (objfile->section_offsets, data_sect_index); - if (gdbarch_static_transform_name_p (current_gdbarch)) - namestring = gdbarch_static_transform_name - (current_gdbarch, namestring); + if (gdbarch_static_transform_name_p (gdbarch)) + namestring = gdbarch_static_transform_name (gdbarch, + namestring); add_psymbol_to_list (namestring, p - namestring, VAR_DOMAIN, LOC_STATIC, @@ -1851,7 +1852,7 @@ pos %d"), value for the bottom of the text seg in those cases. */ if (nlist.n_value == ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile)) - && gdbarch_sofun_address_maybe_missing (current_gdbarch)) + && gdbarch_sofun_address_maybe_missing (gdbarch)) { CORE_ADDR minsym_valu = find_stab_function_addr (namestring, @@ -1866,7 +1867,7 @@ pos %d"), nlist.n_value = minsym_valu; } if (pst && textlow_not_set - && gdbarch_sofun_address_maybe_missing (current_gdbarch)) + && gdbarch_sofun_address_maybe_missing (gdbarch)) { pst->textlow = nlist.n_value; textlow_not_set = 0; @@ -1919,7 +1920,7 @@ pos %d"), value for the bottom of the text seg in those cases. */ if (nlist.n_value == ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile)) - && gdbarch_sofun_address_maybe_missing (current_gdbarch)) + && gdbarch_sofun_address_maybe_missing (gdbarch)) { CORE_ADDR minsym_valu = find_stab_function_addr (namestring, @@ -1934,7 +1935,7 @@ pos %d"), nlist.n_value = minsym_valu; } if (pst && textlow_not_set - && gdbarch_sofun_address_maybe_missing (current_gdbarch)) + && gdbarch_sofun_address_maybe_missing (gdbarch)) { pst->textlow = nlist.n_value; textlow_not_set = 0; @@ -2071,7 +2072,7 @@ pos %d"), end_psymtab will set pst->texthigh to the proper value, which is necessary if a module compiled without debugging info follows this module. */ - if (pst && gdbarch_sofun_address_maybe_missing (current_gdbarch)) + if (pst && gdbarch_sofun_address_maybe_missing (gdbarch)) { end_psymtab (pst, psymtab_include_list, includes_used, symnum * symbol_size, @@ -2197,6 +2198,7 @@ end_psymtab (struct partial_symtab *pst, char **include_list, int num_includes, { int i; struct objfile *objfile = pst->objfile; + struct gdbarch *gdbarch = get_objfile_arch (objfile); if (capping_symbol_offset != -1) LDSYMLEN (pst) = capping_symbol_offset - LDSYMOFF (pst); @@ -2218,7 +2220,7 @@ end_psymtab (struct partial_symtab *pst, char **include_list, int num_includes, last function in the file. */ if (pst->texthigh == 0 && last_function_name - && gdbarch_sofun_address_maybe_missing (current_gdbarch)) + && gdbarch_sofun_address_maybe_missing (gdbarch)) { char *p; int n; @@ -2249,7 +2251,7 @@ end_psymtab (struct partial_symtab *pst, char **include_list, int num_includes, last_function_name = NULL; } - if (!gdbarch_sofun_address_maybe_missing (current_gdbarch)) + if (!gdbarch_sofun_address_maybe_missing (gdbarch)) ; /* this test will be true if the last .o file is only data */ else if (textlow_not_set) @@ -2679,6 +2681,7 @@ process_one_symbol (int type, int desc, CORE_ADDR valu, char *name, struct section_offsets *section_offsets, struct objfile *objfile) { + struct gdbarch *gdbarch = get_objfile_arch (objfile); struct context_stack *new; /* This remembers the address of the start of a function. It is used because in Solaris 2, N_LBRAC, N_RBRAC, and N_SLINE entries @@ -2769,7 +2772,7 @@ process_one_symbol (int type, int desc, CORE_ADDR valu, char *name, /* Relocate for dynamic loading. */ valu += ANOFFSET (section_offsets, SECT_OFF_TEXT (objfile)); - valu = gdbarch_smash_text_address (current_gdbarch, valu); + valu = gdbarch_smash_text_address (gdbarch, valu); last_function_start = valu; goto define_a_symbol; @@ -3109,7 +3112,7 @@ no enclosing block")); if (type == N_FUN && valu == ANOFFSET (section_offsets, SECT_OFF_TEXT (objfile)) - && gdbarch_sofun_address_maybe_missing (current_gdbarch)) + && gdbarch_sofun_address_maybe_missing (gdbarch)) { CORE_ADDR minsym_valu = find_stab_function_addr (name, last_source_file, objfile); diff --git a/gdb/dwarf2-frame.c b/gdb/dwarf2-frame.c index e48fad9cd06..6927de18a57 100644 --- a/gdb/dwarf2-frame.c +++ b/gdb/dwarf2-frame.c @@ -1620,6 +1620,7 @@ static gdb_byte *decode_frame_entry (struct comp_unit *unit, gdb_byte *start, static gdb_byte * decode_frame_entry_1 (struct comp_unit *unit, gdb_byte *start, int eh_frame_p) { + struct gdbarch *gdbarch = get_objfile_arch (unit->objfile); gdb_byte *buf, *end; LONGEST length; unsigned int bytes_read; @@ -1690,7 +1691,7 @@ decode_frame_entry_1 (struct comp_unit *unit, gdb_byte *start, int eh_frame_p) this is supposed to be the target address size from the associated CU header. FIXME: We do not have a good way to determine the latter. Always use the target pointer size for now. */ - cie->addr_size = gdbarch_ptr_bit (current_gdbarch) / TARGET_CHAR_BIT; + cie->addr_size = gdbarch_ptr_bit (gdbarch) / TARGET_CHAR_BIT; /* We'll determine the final value later, but we need to initialize it conservatively. */ @@ -1718,7 +1719,7 @@ decode_frame_entry_1 (struct comp_unit *unit, gdb_byte *start, int eh_frame_p) if (augmentation[0] == 'e' && augmentation[1] == 'h') { /* Skip. */ - buf += TYPE_LENGTH (builtin_type_void_data_ptr); + buf += gdbarch_ptr_bit (gdbarch) / TARGET_CHAR_BIT; augmentation += 2; } @@ -1739,7 +1740,7 @@ decode_frame_entry_1 (struct comp_unit *unit, gdb_byte *start, int eh_frame_p) cie->return_address_register = read_unsigned_leb128 (unit->abfd, buf, &bytes_read); cie->return_address_register - = dwarf2_frame_adjust_regnum (current_gdbarch, + = dwarf2_frame_adjust_regnum (gdbarch, cie->return_address_register, eh_frame_p); diff --git a/gdb/dwarf2loc.c b/gdb/dwarf2loc.c index 4f4c0cab6b1..4f3612e6ecf 100644 --- a/gdb/dwarf2loc.c +++ b/gdb/dwarf2loc.c @@ -116,11 +116,12 @@ static CORE_ADDR dwarf_expr_read_reg (void *baton, int dwarf_regnum) { struct dwarf_expr_baton *debaton = (struct dwarf_expr_baton *) baton; + struct gdbarch *gdbarch = get_frame_arch (debaton->frame); CORE_ADDR result; int regnum; - regnum = gdbarch_dwarf2_reg_to_regnum (current_gdbarch, dwarf_regnum); - result = address_from_register (builtin_type_void_data_ptr, + regnum = gdbarch_dwarf2_reg_to_regnum (gdbarch, dwarf_regnum); + result = address_from_register (builtin_type (gdbarch)->builtin_data_ptr, regnum, debaton->frame); return result; } @@ -459,11 +460,13 @@ locexpr_describe_location (struct symbol *symbol, struct ui_file *stream) && dlbaton->data[0] >= DW_OP_reg0 && dlbaton->data[0] <= DW_OP_reg31) { - int regno = gdbarch_dwarf2_reg_to_regnum - (current_gdbarch, dlbaton->data[0] - DW_OP_reg0); + struct objfile *objfile = dwarf2_per_cu_objfile (dlbaton->per_cu); + struct gdbarch *gdbarch = get_objfile_arch (objfile); + int regno = gdbarch_dwarf2_reg_to_regnum (gdbarch, + dlbaton->data[0] - DW_OP_reg0); fprintf_filtered (stream, "a variable in register %s", - gdbarch_register_name (current_gdbarch, regno)); + gdbarch_register_name (gdbarch, regno)); return 1; } diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c index 7059ad2fc04..e000e2bbab2 100644 --- a/gdb/dwarf2read.c +++ b/gdb/dwarf2read.c @@ -3430,6 +3430,7 @@ dwarf2_add_field (struct field_info *fip, struct die_info *die, struct dwarf2_cu *cu) { struct objfile *objfile = cu->objfile; + struct gdbarch *gdbarch = get_objfile_arch (objfile); struct nextfield *new_field; struct attribute *attr; struct field *fp; @@ -3506,7 +3507,7 @@ dwarf2_add_field (struct field_info *fip, struct die_info *die, attr = dwarf2_attr (die, DW_AT_bit_offset, cu); if (attr) { - if (gdbarch_bits_big_endian (current_gdbarch)) + if (gdbarch_bits_big_endian (gdbarch)) { /* For big endian bits, the DW_AT_bit_offset gives the additional bit offset from the MSB of the containing @@ -4672,6 +4673,7 @@ namespace_name (struct die_info *die, int *is_anonymous, struct dwarf2_cu *cu) static void read_tag_pointer_type (struct die_info *die, struct dwarf2_cu *cu) { + struct gdbarch *gdbarch = get_objfile_arch (cu->objfile); struct comp_unit_head *cu_header = &cu->header; struct type *type; struct attribute *attr_byte_size; @@ -4702,12 +4704,12 @@ read_tag_pointer_type (struct die_info *die, struct dwarf2_cu *cu) length accordingly. */ if (TYPE_LENGTH (type) != byte_size || addr_class != DW_ADDR_none) { - if (gdbarch_address_class_type_flags_p (current_gdbarch)) + if (gdbarch_address_class_type_flags_p (gdbarch)) { int type_flags; type_flags = gdbarch_address_class_type_flags - (current_gdbarch, byte_size, addr_class); + (gdbarch, byte_size, addr_class); gdb_assert ((type_flags & ~TYPE_FLAG_ADDRESS_CLASS_ALL) == 0); type = make_type_with_address_space (type, type_flags); } @@ -5044,6 +5046,7 @@ read_base_type (struct die_info *die, struct dwarf2_cu *cu) static void read_subrange_type (struct die_info *die, struct dwarf2_cu *cu) { + struct gdbarch *gdbarch = get_objfile_arch (cu->objfile); struct type *base_type; struct type *range_type; struct attribute *attr; @@ -5061,7 +5064,7 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu) complaint (&symfile_complaints, _("DW_AT_type missing from DW_TAG_subrange_type")); base_type - = init_type (TYPE_CODE_INT, gdbarch_addr_bit (current_gdbarch) / 8, + = init_type (TYPE_CODE_INT, gdbarch_addr_bit (gdbarch) / 8, 0, NULL, cu->objfile); } @@ -7234,6 +7237,7 @@ 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; @@ -7325,7 +7329,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 (current_gdbarch)->nodebug_data_symbol; + = builtin_type (gdbarch)->nodebug_data_symbol; attr = dwarf2_attr (die, DW_AT_const_value, cu); if (attr) @@ -7627,6 +7631,7 @@ 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; @@ -7635,7 +7640,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 (current_gdbarch)->builtin_void; + return builtin_type (gdbarch)->builtin_void; } else type_die = follow_die_ref (die, type_attr, cu); diff --git a/gdb/elfread.c b/gdb/elfread.c index 5a201c9197a..88ea77b16cd 100644 --- a/gdb/elfread.c +++ b/gdb/elfread.c @@ -166,8 +166,10 @@ record_minimal_symbol (char *name, CORE_ADDR address, enum minimal_symbol_type ms_type, asection *bfd_section, struct objfile *objfile) { + struct gdbarch *gdbarch = get_objfile_arch (objfile); + if (ms_type == mst_text || ms_type == mst_file_text) - address = gdbarch_smash_text_address (current_gdbarch, address); + address = gdbarch_smash_text_address (gdbarch, address); return prim_record_minimal_symbol_and_info (name, address, ms_type, NULL, bfd_section->index, bfd_section, objfile); @@ -206,6 +208,7 @@ static void elf_symtab_read (struct objfile *objfile, int type, long number_of_symbols, asymbol **symbol_table) { + struct gdbarch *gdbarch = get_objfile_arch (objfile); long storage_needed; asymbol *sym; long i; @@ -513,7 +516,7 @@ elf_symtab_read (struct objfile *objfile, int type, } if (msym != NULL) msym->filename = filesymname; - gdbarch_elf_make_msymbol_special (current_gdbarch, sym, msym); + gdbarch_elf_make_msymbol_special (gdbarch, sym, msym); } } } diff --git a/gdb/mdebugread.c b/gdb/mdebugread.c index 4f8b123e51f..771f5fdacf3 100644 --- a/gdb/mdebugread.c +++ b/gdb/mdebugread.c @@ -559,6 +559,7 @@ static int parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend, struct section_offsets *section_offsets, struct objfile *objfile) { + struct gdbarch *gdbarch = get_objfile_arch (objfile); const bfd_size_type external_sym_size = debug_swap->external_sym_size; void (*const swap_sym_in) (bfd *, void *, SYMR *) = debug_swap->swap_sym_in; char *name; @@ -653,7 +654,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 (current_gdbarch)->nodebug_data_symbol; + SYMBOL_TYPE (s) = builtin_type (gdbarch)->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 */ @@ -1039,8 +1040,7 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend, that too. */ if (TYPE_LENGTH (t) == TYPE_NFIELDS (t) || TYPE_LENGTH (t) == 0) - TYPE_LENGTH (t) = - gdbarch_int_bit (current_gdbarch) / HOST_CHAR_BIT; + TYPE_LENGTH (t) = gdbarch_int_bit (gdbarch) / HOST_CHAR_BIT; for (ext_tsym = ext_sh + external_sym_size; ; ext_tsym += external_sym_size) @@ -1825,6 +1825,7 @@ 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; struct mdebug_extra_func_info *e; @@ -1962,7 +1963,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 (current_gdbarch)->nodebug_text_symbol; + SYMBOL_TYPE (s) = builtin_type (gdbarch)->nodebug_text_symbol; } /* Parse the external symbol ES. Just call parse_symbol() after @@ -2226,6 +2227,7 @@ record_minimal_symbol (const char *name, const CORE_ADDR address, static void parse_partial_symbols (struct objfile *objfile) { + struct gdbarch *gdbarch = get_objfile_arch (objfile); const bfd_size_type external_sym_size = debug_swap->external_sym_size; const bfd_size_type external_rfd_size = debug_swap->external_rfd_size; const bfd_size_type external_ext_size = debug_swap->external_ext_size; @@ -2849,8 +2851,7 @@ parse_partial_symbols (struct objfile *objfile) don't relocate it. */ if (sh.value == 0 - && gdbarch_sofun_address_maybe_missing - (current_gdbarch)) + && gdbarch_sofun_address_maybe_missing (gdbarch)) { textlow_not_set = 1; valu = 0; @@ -2999,9 +3000,9 @@ parse_partial_symbols (struct objfile *objfile) case 'S': sh.value += ANOFFSET (objfile->section_offsets, SECT_OFF_DATA (objfile)); - if (gdbarch_static_transform_name_p (current_gdbarch)) + if (gdbarch_static_transform_name_p (gdbarch)) namestring = gdbarch_static_transform_name - (current_gdbarch, namestring); + (gdbarch, namestring); add_psymbol_to_list (namestring, p - namestring, VAR_DOMAIN, LOC_STATIC, @@ -3230,8 +3231,7 @@ parse_partial_symbols (struct objfile *objfile) necessary if a module compiled without debugging info follows this module. */ if (pst - && gdbarch_sofun_address_maybe_missing - (current_gdbarch)) + && gdbarch_sofun_address_maybe_missing (gdbarch)) { pst = (struct partial_symtab *) 0; includes_used = 0; diff --git a/gdb/objfiles.c b/gdb/objfiles.c index 35b67258bd4..b7d578f956d 100644 --- a/gdb/objfiles.c +++ b/gdb/objfiles.c @@ -48,6 +48,7 @@ #include "dictionary.h" #include "source.h" #include "addrmap.h" +#include "arch-utils.h" /* Prototypes for local functions */ @@ -187,6 +188,9 @@ allocate_objfile (bfd *abfd, int flags) } if (abfd != NULL) { + /* Look up the gdbarch associated with the BFD. */ + objfile->gdbarch = gdbarch_from_bfd (abfd); + objfile->name = xstrdup (bfd_get_filename (abfd)); objfile->mtime = bfd_get_mtime (abfd); @@ -234,6 +238,13 @@ allocate_objfile (bfd *abfd, int flags) return (objfile); } +/* Retrieve the gdbarch associated with OBJFILE. */ +struct gdbarch * +get_objfile_arch (struct objfile *objfile) +{ + return objfile->gdbarch; +} + /* Initialize entry point information for this objfile. */ void diff --git a/gdb/objfiles.h b/gdb/objfiles.h index 459afe862b7..4f01f60f4e2 100644 --- a/gdb/objfiles.h +++ b/gdb/objfiles.h @@ -229,6 +229,13 @@ struct objfile bfd *obfd; + /* The gdbarch associated with the BFD. Note that this gdbarch is + determined solely from BFD information, without looking at target + information. The gdbarch determined from a running target may + differ from this e.g. with respect to register types and names. */ + + struct gdbarch *gdbarch; + /* The modification timestamp of the object file, as of the last time we read its symbols. */ @@ -470,6 +477,8 @@ extern struct objfile *object_files; extern struct objfile *allocate_objfile (bfd *, int); +extern struct gdbarch *get_objfile_arch (struct objfile *); + extern void init_entry_point_info (struct objfile *); extern CORE_ADDR entry_point_address (void); diff --git a/gdb/somread.c b/gdb/somread.c index 338d0c60500..a3389d9d2b2 100644 --- a/gdb/somread.c +++ b/gdb/somread.c @@ -58,6 +58,7 @@ static void som_symtab_read (bfd *abfd, struct objfile *objfile, struct section_offsets *section_offsets) { + struct gdbarch *gdbarch = get_objfile_arch (objfile); unsigned int number_of_symbols; int val, dynamic; char *stringtab; @@ -132,7 +133,7 @@ som_symtab_read (bfd *abfd, struct objfile *objfile, ms_type = mst_text; bufp->symbol_value += text_offset; bufp->symbol_value = gdbarch_smash_text_address - (current_gdbarch, bufp->symbol_value); + (gdbarch, bufp->symbol_value); break; case ST_ENTRY: @@ -146,7 +147,7 @@ som_symtab_read (bfd *abfd, struct objfile *objfile, ms_type = mst_text; bufp->symbol_value += text_offset; bufp->symbol_value = gdbarch_smash_text_address - (current_gdbarch, bufp->symbol_value); + (gdbarch, bufp->symbol_value); break; case ST_STUB: @@ -154,7 +155,7 @@ som_symtab_read (bfd *abfd, struct objfile *objfile, ms_type = mst_solib_trampoline; bufp->symbol_value += text_offset; bufp->symbol_value = gdbarch_smash_text_address - (current_gdbarch, bufp->symbol_value); + (gdbarch, bufp->symbol_value); break; case ST_DATA: @@ -183,7 +184,7 @@ som_symtab_read (bfd *abfd, struct objfile *objfile, ms_type = mst_file_text; bufp->symbol_value += text_offset; bufp->symbol_value = gdbarch_smash_text_address - (current_gdbarch, bufp->symbol_value); + (gdbarch, bufp->symbol_value); check_strange_names: /* Utah GCC 2.5, FSF GCC 2.6 and later generate correct local @@ -215,7 +216,7 @@ som_symtab_read (bfd *abfd, struct objfile *objfile, ms_type = mst_file_text; bufp->symbol_value += text_offset; bufp->symbol_value = gdbarch_smash_text_address - (current_gdbarch, bufp->symbol_value); + (gdbarch, bufp->symbol_value); break; case ST_ENTRY: @@ -227,7 +228,7 @@ som_symtab_read (bfd *abfd, struct objfile *objfile, ms_type = mst_file_text; bufp->symbol_value += text_offset; bufp->symbol_value = gdbarch_smash_text_address - (current_gdbarch, bufp->symbol_value); + (gdbarch, bufp->symbol_value); break; case ST_STUB: @@ -235,7 +236,7 @@ som_symtab_read (bfd *abfd, struct objfile *objfile, ms_type = mst_solib_trampoline; bufp->symbol_value += text_offset; bufp->symbol_value = gdbarch_smash_text_address - (current_gdbarch, bufp->symbol_value); + (gdbarch, bufp->symbol_value); break; diff --git a/gdb/stabsread.c b/gdb/stabsread.c index 28349ccc181..8e88ea2dcbb 100644 --- a/gdb/stabsread.c +++ b/gdb/stabsread.c @@ -582,6 +582,7 @@ struct symbol * define_symbol (CORE_ADDR valu, char *string, int desc, int type, struct objfile *objfile) { + struct gdbarch *gdbarch = get_objfile_arch (objfile); struct symbol *sym; char *p = (char *) find_name_end (string); int deftype; @@ -666,7 +667,7 @@ define_symbol (CORE_ADDR valu, char *string, int desc, int type, case 'X': /* SunPRO (3.0 at least) static variable encoding. */ - if (gdbarch_static_transform_name_p (current_gdbarch)) + if (gdbarch_static_transform_name_p (gdbarch)) goto normal; /* ... fall through ... */ @@ -731,7 +732,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 (current_gdbarch)->builtin_double; + dbl_type = builtin_type (gdbarch)->builtin_double; dbl_valu = obstack_alloc (&objfile->objfile_obstack, TYPE_LENGTH (dbl_type)); @@ -751,7 +752,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 (current_gdbarch)->builtin_long; + SYMBOL_TYPE (sym) = builtin_type (gdbarch)->builtin_long; SYMBOL_VALUE (sym) = atoi (p); SYMBOL_CLASS (sym) = LOC_CONST; } @@ -859,10 +860,10 @@ define_symbol (CORE_ADDR valu, char *string, int desc, int type, be promoted to the width of the calling conventions, with a type which references itself. This type is turned into a TYPE_CODE_VOID type by read_type, and we have to turn - it back into builtin_type_int here. - FIXME: Do we need a new builtin_type_promoted_int_arg ? */ + 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_int; + ptype = builtin_type (gdbarch)->builtin_int; TYPE_FIELD_TYPE (ftype, nparams) = ptype; TYPE_FIELD_ARTIFICIAL (ftype, nparams++) = 0; } @@ -931,7 +932,7 @@ define_symbol (CORE_ADDR valu, char *string, int desc, int type, SYMBOL_DOMAIN (sym) = VAR_DOMAIN; add_symbol_to_list (sym, &local_symbols); - if (gdbarch_byte_order (current_gdbarch) != BFD_ENDIAN_BIG) + if (gdbarch_byte_order (gdbarch) != BFD_ENDIAN_BIG) { /* On little-endian machines, this crud is never necessary, and, if the extra bytes contain garbage, is harmful. */ @@ -940,38 +941,21 @@ define_symbol (CORE_ADDR valu, char *string, int desc, int type, /* If it's gcc-compiled, if it says `short', believe it. */ if (processing_gcc_compilation - || gdbarch_believe_pcc_promotion (current_gdbarch)) + || gdbarch_believe_pcc_promotion (gdbarch)) break; - if (!gdbarch_believe_pcc_promotion (current_gdbarch)) + if (!gdbarch_believe_pcc_promotion (gdbarch)) { - /* This is the signed type which arguments get promoted to. */ - static struct type *pcc_promotion_type; - /* This is the unsigned type which arguments get promoted to. */ - static struct type *pcc_unsigned_promotion_type; - - /* Call it "int" because this is mainly C lossage. */ - if (pcc_promotion_type == NULL) - pcc_promotion_type = - init_type (TYPE_CODE_INT, - gdbarch_int_bit (current_gdbarch) / TARGET_CHAR_BIT, - 0, "int", NULL); - - if (pcc_unsigned_promotion_type == NULL) - pcc_unsigned_promotion_type = - init_type (TYPE_CODE_INT, - gdbarch_int_bit (current_gdbarch) / TARGET_CHAR_BIT, - TYPE_FLAG_UNSIGNED, "unsigned int", NULL); - /* If PCC says a parameter is a short or a char, it is really an int. */ - if (TYPE_LENGTH (SYMBOL_TYPE (sym)) < TYPE_LENGTH (pcc_promotion_type) + if (TYPE_LENGTH (SYMBOL_TYPE (sym)) + < gdbarch_int_bit (gdbarch) / TARGET_CHAR_BIT && TYPE_CODE (SYMBOL_TYPE (sym)) == TYPE_CODE_INT) { SYMBOL_TYPE (sym) = TYPE_UNSIGNED (SYMBOL_TYPE (sym)) - ? pcc_unsigned_promotion_type - : pcc_promotion_type; + ? builtin_type (gdbarch)->builtin_unsigned_int + : builtin_type (gdbarch)->builtin_int; } break; } @@ -1046,8 +1030,7 @@ define_symbol (CORE_ADDR valu, char *string, int desc, int type, if (local_symbols && local_symbols->nsyms > 0 - && gdbarch_stabs_argument_has_addr (current_gdbarch, - SYMBOL_TYPE (sym))) + && gdbarch_stabs_argument_has_addr (gdbarch, SYMBOL_TYPE (sym))) { struct symbol *prev_sym; prev_sym = local_symbols->symbol[local_symbols->nsyms - 1]; @@ -1076,8 +1059,8 @@ define_symbol (CORE_ADDR valu, char *string, int desc, int type, SYMBOL_TYPE (sym) = read_type (&p, objfile); SYMBOL_CLASS (sym) = LOC_STATIC; SYMBOL_VALUE_ADDRESS (sym) = valu; - if (gdbarch_static_transform_name_p (current_gdbarch) - && gdbarch_static_transform_name (current_gdbarch, + if (gdbarch_static_transform_name_p (gdbarch) + && gdbarch_static_transform_name (gdbarch, DEPRECATED_SYMBOL_NAME (sym)) != DEPRECATED_SYMBOL_NAME (sym)) { @@ -1086,7 +1069,7 @@ define_symbol (CORE_ADDR valu, char *string, int desc, int type, if (msym != NULL) { DEPRECATED_SYMBOL_NAME (sym) = gdbarch_static_transform_name - (current_gdbarch, + (gdbarch, DEPRECATED_SYMBOL_NAME (sym)); SYMBOL_VALUE_ADDRESS (sym) = SYMBOL_VALUE_ADDRESS (msym); } @@ -1259,8 +1242,8 @@ define_symbol (CORE_ADDR valu, char *string, int desc, int type, SYMBOL_TYPE (sym) = read_type (&p, objfile); SYMBOL_CLASS (sym) = LOC_STATIC; SYMBOL_VALUE_ADDRESS (sym) = valu; - if (gdbarch_static_transform_name_p (current_gdbarch) - && gdbarch_static_transform_name (current_gdbarch, + if (gdbarch_static_transform_name_p (gdbarch) + && gdbarch_static_transform_name (gdbarch, DEPRECATED_SYMBOL_NAME (sym)) != DEPRECATED_SYMBOL_NAME (sym)) { @@ -1269,7 +1252,7 @@ define_symbol (CORE_ADDR valu, char *string, int desc, int type, if (msym != NULL) { DEPRECATED_SYMBOL_NAME (sym) = gdbarch_static_transform_name - (current_gdbarch, + (gdbarch, DEPRECATED_SYMBOL_NAME (sym)); SYMBOL_VALUE_ADDRESS (sym) = SYMBOL_VALUE_ADDRESS (msym); } @@ -1331,7 +1314,7 @@ define_symbol (CORE_ADDR valu, char *string, int desc, int type, of by value, i.e. they will pass the address of a structure (in a register or on the stack) instead of the structure itself. */ - if (gdbarch_stabs_argument_has_addr (current_gdbarch, SYMBOL_TYPE (sym)) + if (gdbarch_stabs_argument_has_addr (gdbarch, SYMBOL_TYPE (sym)) && (SYMBOL_CLASS (sym) == LOC_REGPARM || SYMBOL_CLASS (sym) == LOC_ARG)) { /* We have to convert LOC_REGPARM to LOC_REGPARM_ADDR (for @@ -2717,6 +2700,8 @@ static void read_one_struct_field (struct field_info *fip, char **pp, char *p, struct type *type, struct objfile *objfile) { + struct gdbarch *gdbarch = get_objfile_arch (objfile); + fip->list->field.name = obsavestring (*pp, p - *pp, &objfile->objfile_obstack); *pp = p + 1; @@ -2821,7 +2806,7 @@ read_one_struct_field (struct field_info *fip, char **pp, char *p, == TARGET_CHAR_BIT * TYPE_LENGTH (field_type) || (TYPE_CODE (field_type) == TYPE_CODE_ENUM && FIELD_BITSIZE (fip->list->field) - == gdbarch_int_bit (current_gdbarch)) + == gdbarch_int_bit (gdbarch)) ) && FIELD_BITPOS (fip->list->field) % 8 == 0) @@ -3445,6 +3430,7 @@ static struct type * read_enum_type (char **pp, struct type *type, struct objfile *objfile) { + struct gdbarch *gdbarch = get_objfile_arch (objfile); char *p; char *name; long n; @@ -3514,7 +3500,7 @@ read_enum_type (char **pp, struct type *type, /* Now fill in the fields of the type-structure. */ - TYPE_LENGTH (type) = gdbarch_int_bit (current_gdbarch) / HOST_CHAR_BIT; + TYPE_LENGTH (type) = gdbarch_int_bit (gdbarch) / HOST_CHAR_BIT; TYPE_CODE (type) = TYPE_CODE_ENUM; TYPE_FLAGS (type) &= ~TYPE_FLAG_STUB; if (unsigned_enum) @@ -3849,6 +3835,7 @@ static struct type * read_range_type (char **pp, int typenums[2], int type_size, struct objfile *objfile) { + struct gdbarch *gdbarch = get_objfile_arch (objfile); char *orig_pp = *pp; int rangenums[2]; long n2, n3; @@ -3974,7 +3961,7 @@ read_range_type (char **pp, int typenums[2], int type_size, /* We don't know its size. It is unsigned int or unsigned long. GCC 2.3.3 uses this for long long too, but that is just a GDB 3.5 compatibility hack. */ - bits = gdbarch_int_bit (current_gdbarch); + bits = gdbarch_int_bit (gdbarch); } return init_type (TYPE_CODE_INT, bits / TARGET_CHAR_BIT, @@ -4020,7 +4007,7 @@ read_range_type (char **pp, int typenums[2], int type_size, else if (n3 == 0 && n2 < 0 && (self_subrange || n2 == -gdbarch_long_long_bit - (current_gdbarch) / TARGET_CHAR_BIT)) + (gdbarch) / TARGET_CHAR_BIT)) return init_type (TYPE_CODE_INT, -n2, 0, NULL, objfile); else if (n2 == -n3 - 1) { @@ -4037,7 +4024,7 @@ read_range_type (char **pp, int typenums[2], int type_size, handle_true_range: if (self_subrange) - index_type = builtin_type_int; + index_type = builtin_type (gdbarch)->builtin_int; else index_type = *dbx_lookup_type (rangenums); if (index_type == NULL) @@ -4045,16 +4032,10 @@ handle_true_range: /* Does this actually ever happen? Is that why we are worrying about dealing with it rather than just calling error_type? */ - static struct type *range_type_index; - complaint (&symfile_complaints, _("base type %d of range type is not defined"), rangenums[1]); - if (range_type_index == NULL) - range_type_index = - init_type (TYPE_CODE_INT, - gdbarch_int_bit (current_gdbarch) / TARGET_CHAR_BIT, - 0, "range type index type", NULL); - index_type = range_type_index; + + index_type = builtin_type (gdbarch)->builtin_int; } result_type = create_range_type ((struct type *) NULL, index_type, n2, n3); diff --git a/gdb/xcoffread.c b/gdb/xcoffread.c index 5f128fc4173..dead40c1818 100644 --- a/gdb/xcoffread.c +++ b/gdb/xcoffread.c @@ -1435,6 +1435,7 @@ 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; @@ -1474,7 +1475,7 @@ process_xcoff_symbol (struct coff_symbol *cs, struct objfile *objfile) patch_block_stabs (), unless the file was compiled without -g. */ DEPRECATED_SYMBOL_NAME (sym) = SYMNAME_ALLOC (name, symname_alloced); - SYMBOL_TYPE (sym) = builtin_type (current_gdbarch)->nodebug_text_symbol; + SYMBOL_TYPE (sym) = builtin_type (gdbarch)->nodebug_text_symbol; SYMBOL_CLASS (sym) = LOC_BLOCK; SYMBOL_DUP (sym, sym2); @@ -1487,7 +1488,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 (current_gdbarch)->nodebug_data_symbol; + SYMBOL_TYPE (sym) = builtin_type (gdbarch)->nodebug_data_symbol; switch (cs->c_sclass) { @@ -2582,9 +2583,9 @@ scan_xcoff_symtab (struct objfile *objfile) case 'S': symbol.n_value += ANOFFSET (objfile->section_offsets, SECT_OFF_DATA (objfile)); - if (gdbarch_static_transform_name_p (current_gdbarch)) + if (gdbarch_static_transform_name_p (gdbarch)) namestring = gdbarch_static_transform_name - (current_gdbarch, namestring); + (gdbarch, namestring); add_psymbol_to_list (namestring, p - namestring, VAR_DOMAIN, LOC_STATIC, |