From 5e2b427df30d4c07ffe08dca54c26f2569b1630f Mon Sep 17 00:00:00 2001 From: Ulrich Weigand Date: Wed, 26 Mar 2008 14:53:28 +0000 Subject: * 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. --- gdb/objfiles.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'gdb/objfiles.c') diff --git a/gdb/objfiles.c b/gdb/objfiles.c index 35b6725..b7d578f 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 -- cgit v1.1