* 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.
This commit is contained in:
Ulrich Weigand 2008-03-26 14:53:28 +00:00
parent 5a413362ba
commit 5e2b427df3
14 changed files with 236 additions and 160 deletions

View file

@ -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);