Change get_objfile_arch to a method on objfile

This changes get_objfile_arch to be a new inline method,
objfile::arch.

To my surprise, this function came up while profiling DWARF psymbol
reading.  Making this change improved performance from 1.986 seconds
to 1.869 seconds.  Both measurements were done by taking the mean of
10 runs on a fixed copy of the gdb executable.

gdb/ChangeLog
2020-04-18  Tom Tromey  <tom@tromey.com>

	* xcoffread.c (enter_line_range, scan_xcoff_symtab): Update.
	* value.c (value_fn_field): Update.
	* valops.c (find_function_in_inferior)
	(value_allocate_space_in_inferior): Update.
	* tui/tui-winsource.c (tui_update_source_windows_with_line):
	Update.
	* tui/tui-source.c (tui_source_window::set_contents): Update.
	* symtab.c (lookup_global_or_static_symbol)
	(find_function_start_sal_1, skip_prologue_sal)
	(print_msymbol_info, find_gnu_ifunc, symbol_arch): Update.
	* symmisc.c (dump_msymbols, dump_symtab_1)
	(maintenance_print_one_line_table): Update.
	* symfile.c (init_entry_point_info, section_is_mapped)
	(list_overlays_command, simple_read_overlay_table)
	(simple_overlay_update_1): Update.
	* stap-probe.c (handle_stap_probe): Update.
	* stabsread.c (dbx_init_float_type, define_symbol)
	(read_one_struct_field, read_enum_type, read_range_type): Update.
	* source.c (info_line_command): Update.
	* python/python.c (gdbpy_source_objfile_script)
	(gdbpy_execute_objfile_script): Update.
	* python/py-type.c (save_objfile_types): Update.
	* python/py-objfile.c (py_free_objfile): Update.
	* python/py-inferior.c (python_new_objfile): Update.
	* psymtab.c (psym_find_pc_sect_compunit_symtab, dump_psymtab)
	(dump_psymtab_addrmap_1, maintenance_info_psymtabs)
	(maintenance_check_psymtabs): Update.
	* printcmd.c (info_address_command): Update.
	* objfiles.h (struct objfile) <arch>: New method, from
	get_objfile_arch.
	(get_objfile_arch): Don't declare.
	* objfiles.c (get_objfile_arch): Remove.
	(filter_overlapping_sections): Update.
	* minsyms.c (msymbol_is_function): Update.
	* mi/mi-symbol-cmds.c (mi_cmd_symbol_list_lines)
	(output_nondebug_symbol): Update.
	* mdebugread.c (parse_symbol, basic_type, parse_partial_symbols)
	(mdebug_expand_psymtab): Update.
	* machoread.c (macho_add_oso_symfile): Update.
	* linux-tdep.c (linux_infcall_mmap, linux_infcall_munmap):
	Update.
	* linux-fork.c (checkpoint_command): Update.
	* linespec.c (convert_linespec_to_sals): Update.
	* jit.c (finalize_symtab): Update.
	* infrun.c (insert_exception_resume_from_probe): Update.
	* ia64-tdep.c (ia64_find_unwind_table): Update.
	* hppa-tdep.c (internalize_unwinds): Update.
	* gdbtypes.c (get_type_arch, init_float_type, objfile_type):
	Update.
	* gcore.c (call_target_sbrk): Update.
	* elfread.c (record_minimal_symbol, elf_symtab_read)
	(elf_rel_plt_read, elf_gnu_ifunc_record_cache)
	(elf_gnu_ifunc_resolve_by_got): Update.
	* dwarf2/read.c (create_addrmap_from_index)
	(create_addrmap_from_aranges, dw2_find_pc_sect_compunit_symtab)
	(read_debug_names_from_section)
	(process_psymtab_comp_unit_reader, add_partial_symbol)
	(add_partial_subprogram, process_full_comp_unit)
	(read_file_scope, read_func_scope, read_lexical_block_scope)
	(read_call_site_scope, dwarf2_ranges_read)
	(dwarf2_record_block_ranges, dwarf2_add_field)
	(mark_common_block_symbol_computed, read_tag_pointer_type)
	(read_tag_string_type, dwarf2_init_float_type)
	(dwarf2_init_complex_target_type, read_base_type)
	(partial_die_info::read, partial_die_info::read)
	(read_attribute_value, dwarf_decode_lines_1, new_symbol)
	(dwarf2_fetch_die_loc_sect_off): Update.
	* dwarf2/loc.c (dwarf2_find_location_expression)
	(class dwarf_evaluate_loc_desc, rw_pieced_value)
	(dwarf2_evaluate_loc_desc_full, dwarf2_locexpr_baton_eval)
	(dwarf2_loc_desc_get_symbol_read_needs)
	(locexpr_describe_location_piece, locexpr_describe_location_1)
	(loclist_describe_location): Update.
	* dwarf2/index-write.c (write_debug_names): Update.
	* dwarf2/frame.c (dwarf2_build_frame_info): Update.
	* dtrace-probe.c (dtrace_process_dof): Update.
	* dbxread.c (read_dbx_symtab, dbx_end_psymtab)
	(process_one_symbol): Update.
	* ctfread.c (ctf_init_float_type, read_base_type): Update.
	* coffread.c (coff_symtab_read, enter_linenos, decode_base_type)
	(coff_read_enum_type): Update.
	* cli/cli-cmds.c (edit_command, list_command): Update.
	* buildsym.c (buildsym_compunit::finish_block_internal): Update.
	* breakpoint.c (create_overlay_event_breakpoint)
	(create_longjmp_master_breakpoint)
	(create_std_terminate_master_breakpoint)
	(create_exception_master_breakpoint, get_sal_arch): Update.
	* block.c (block_gdbarch): Update.
	* annotate.c (annotate_source_line): Update.
This commit is contained in:
Tom Tromey 2020-04-18 08:35:04 -06:00
parent 18f9735354
commit 08feed99cb
47 changed files with 231 additions and 142 deletions

View File

@ -1,3 +1,95 @@
2020-04-18 Tom Tromey <tom@tromey.com>
* xcoffread.c (enter_line_range, scan_xcoff_symtab): Update.
* value.c (value_fn_field): Update.
* valops.c (find_function_in_inferior)
(value_allocate_space_in_inferior): Update.
* tui/tui-winsource.c (tui_update_source_windows_with_line):
Update.
* tui/tui-source.c (tui_source_window::set_contents): Update.
* symtab.c (lookup_global_or_static_symbol)
(find_function_start_sal_1, skip_prologue_sal)
(print_msymbol_info, find_gnu_ifunc, symbol_arch): Update.
* symmisc.c (dump_msymbols, dump_symtab_1)
(maintenance_print_one_line_table): Update.
* symfile.c (init_entry_point_info, section_is_mapped)
(list_overlays_command, simple_read_overlay_table)
(simple_overlay_update_1): Update.
* stap-probe.c (handle_stap_probe): Update.
* stabsread.c (dbx_init_float_type, define_symbol)
(read_one_struct_field, read_enum_type, read_range_type): Update.
* source.c (info_line_command): Update.
* python/python.c (gdbpy_source_objfile_script)
(gdbpy_execute_objfile_script): Update.
* python/py-type.c (save_objfile_types): Update.
* python/py-objfile.c (py_free_objfile): Update.
* python/py-inferior.c (python_new_objfile): Update.
* psymtab.c (psym_find_pc_sect_compunit_symtab, dump_psymtab)
(dump_psymtab_addrmap_1, maintenance_info_psymtabs)
(maintenance_check_psymtabs): Update.
* printcmd.c (info_address_command): Update.
* objfiles.h (struct objfile) <arch>: New method, from
get_objfile_arch.
(get_objfile_arch): Don't declare.
* objfiles.c (get_objfile_arch): Remove.
(filter_overlapping_sections): Update.
* minsyms.c (msymbol_is_function): Update.
* mi/mi-symbol-cmds.c (mi_cmd_symbol_list_lines)
(output_nondebug_symbol): Update.
* mdebugread.c (parse_symbol, basic_type, parse_partial_symbols)
(mdebug_expand_psymtab): Update.
* machoread.c (macho_add_oso_symfile): Update.
* linux-tdep.c (linux_infcall_mmap, linux_infcall_munmap):
Update.
* linux-fork.c (checkpoint_command): Update.
* linespec.c (convert_linespec_to_sals): Update.
* jit.c (finalize_symtab): Update.
* infrun.c (insert_exception_resume_from_probe): Update.
* ia64-tdep.c (ia64_find_unwind_table): Update.
* hppa-tdep.c (internalize_unwinds): Update.
* gdbtypes.c (get_type_arch, init_float_type, objfile_type):
Update.
* gcore.c (call_target_sbrk): Update.
* elfread.c (record_minimal_symbol, elf_symtab_read)
(elf_rel_plt_read, elf_gnu_ifunc_record_cache)
(elf_gnu_ifunc_resolve_by_got): Update.
* dwarf2/read.c (create_addrmap_from_index)
(create_addrmap_from_aranges, dw2_find_pc_sect_compunit_symtab)
(read_debug_names_from_section)
(process_psymtab_comp_unit_reader, add_partial_symbol)
(add_partial_subprogram, process_full_comp_unit)
(read_file_scope, read_func_scope, read_lexical_block_scope)
(read_call_site_scope, dwarf2_ranges_read)
(dwarf2_record_block_ranges, dwarf2_add_field)
(mark_common_block_symbol_computed, read_tag_pointer_type)
(read_tag_string_type, dwarf2_init_float_type)
(dwarf2_init_complex_target_type, read_base_type)
(partial_die_info::read, partial_die_info::read)
(read_attribute_value, dwarf_decode_lines_1, new_symbol)
(dwarf2_fetch_die_loc_sect_off): Update.
* dwarf2/loc.c (dwarf2_find_location_expression)
(class dwarf_evaluate_loc_desc, rw_pieced_value)
(dwarf2_evaluate_loc_desc_full, dwarf2_locexpr_baton_eval)
(dwarf2_loc_desc_get_symbol_read_needs)
(locexpr_describe_location_piece, locexpr_describe_location_1)
(loclist_describe_location): Update.
* dwarf2/index-write.c (write_debug_names): Update.
* dwarf2/frame.c (dwarf2_build_frame_info): Update.
* dtrace-probe.c (dtrace_process_dof): Update.
* dbxread.c (read_dbx_symtab, dbx_end_psymtab)
(process_one_symbol): Update.
* ctfread.c (ctf_init_float_type, read_base_type): Update.
* coffread.c (coff_symtab_read, enter_linenos, decode_base_type)
(coff_read_enum_type): Update.
* cli/cli-cmds.c (edit_command, list_command): Update.
* buildsym.c (buildsym_compunit::finish_block_internal): Update.
* breakpoint.c (create_overlay_event_breakpoint)
(create_longjmp_master_breakpoint)
(create_std_terminate_master_breakpoint)
(create_exception_master_breakpoint, get_sal_arch): Update.
* block.c (block_gdbarch): Update.
* annotate.c (annotate_source_line): Update.
2020-04-17 Tom Tromey <tromey@adacore.com> 2020-04-17 Tom Tromey <tromey@adacore.com>
* auto-load.c (show_auto_load_cmd): Remove. * auto-load.c (show_auto_load_cmd): Remove.

View File

@ -450,7 +450,7 @@ annotate_source_line (struct symtab *s, int line, int mid_statement,
return; return;
annotate_source (s->fullname, line, (int) (*offsets)[line - 1], annotate_source (s->fullname, line, (int) (*offsets)[line - 1],
mid_statement, get_objfile_arch (SYMTAB_OBJFILE (s)), mid_statement, SYMTAB_OBJFILE (s)->arch (),
pc); pc);
} }
} }

View File

@ -62,7 +62,7 @@ block_gdbarch (const struct block *block)
if (BLOCK_FUNCTION (block) != NULL) if (BLOCK_FUNCTION (block) != NULL)
return symbol_arch (BLOCK_FUNCTION (block)); return symbol_arch (BLOCK_FUNCTION (block));
return get_objfile_arch (block_objfile (block)); return block_objfile (block)->arch ();
} }
/* See block.h. */ /* See block.h. */

View File

@ -3201,7 +3201,7 @@ create_overlay_event_breakpoint (void)
} }
addr = BMSYMBOL_VALUE_ADDRESS (bp_objfile_data->overlay_msym); addr = BMSYMBOL_VALUE_ADDRESS (bp_objfile_data->overlay_msym);
b = create_internal_breakpoint (get_objfile_arch (objfile), addr, b = create_internal_breakpoint (objfile->arch (), addr,
bp_overlay_event, bp_overlay_event,
&internal_breakpoint_ops); &internal_breakpoint_ops);
initialize_explicit_location (&explicit_loc); initialize_explicit_location (&explicit_loc);
@ -3238,7 +3238,7 @@ create_longjmp_master_breakpoint (void)
struct gdbarch *gdbarch; struct gdbarch *gdbarch;
struct breakpoint_objfile_data *bp_objfile_data; struct breakpoint_objfile_data *bp_objfile_data;
gdbarch = get_objfile_arch (objfile); gdbarch = objfile->arch ();
bp_objfile_data = get_breakpoint_objfile_data (objfile); bp_objfile_data = get_breakpoint_objfile_data (objfile);
@ -3362,7 +3362,7 @@ create_std_terminate_master_breakpoint (void)
} }
addr = BMSYMBOL_VALUE_ADDRESS (bp_objfile_data->terminate_msym); addr = BMSYMBOL_VALUE_ADDRESS (bp_objfile_data->terminate_msym);
b = create_internal_breakpoint (get_objfile_arch (objfile), addr, b = create_internal_breakpoint (objfile->arch (), addr,
bp_std_terminate_master, bp_std_terminate_master,
&internal_breakpoint_ops); &internal_breakpoint_ops);
initialize_explicit_location (&explicit_loc); initialize_explicit_location (&explicit_loc);
@ -3414,7 +3414,7 @@ create_exception_master_breakpoint (void)
if (!bp_objfile_data->exception_probes.empty ()) if (!bp_objfile_data->exception_probes.empty ())
{ {
gdbarch = get_objfile_arch (objfile); gdbarch = objfile->arch ();
for (probe *p : bp_objfile_data->exception_probes) for (probe *p : bp_objfile_data->exception_probes)
{ {
@ -3434,7 +3434,7 @@ create_exception_master_breakpoint (void)
if (msym_not_found_p (bp_objfile_data->exception_msym.minsym)) if (msym_not_found_p (bp_objfile_data->exception_msym.minsym))
continue; continue;
gdbarch = get_objfile_arch (objfile); gdbarch = objfile->arch ();
if (bp_objfile_data->exception_msym.minsym == NULL) if (bp_objfile_data->exception_msym.minsym == NULL)
{ {
@ -7116,9 +7116,9 @@ struct gdbarch *
get_sal_arch (struct symtab_and_line sal) get_sal_arch (struct symtab_and_line sal)
{ {
if (sal.section) if (sal.section)
return get_objfile_arch (sal.section->objfile); return sal.section->objfile->arch ();
if (sal.symtab) if (sal.symtab)
return get_objfile_arch (SYMTAB_OBJFILE (sal.symtab)); return SYMTAB_OBJFILE (sal.symtab)->arch ();
return NULL; return NULL;
} }

View File

@ -213,7 +213,7 @@ buildsym_compunit::finish_block_internal
CORE_ADDR start, CORE_ADDR end, CORE_ADDR start, CORE_ADDR end,
int is_global, int expandable) int is_global, int expandable)
{ {
struct gdbarch *gdbarch = get_objfile_arch (m_objfile); struct gdbarch *gdbarch = m_objfile->arch ();
struct pending *next, *next1; struct pending *next, *next1;
struct block *block; struct block *block;
struct pending_block *pblock; struct pending_block *pblock;

View File

@ -925,7 +925,7 @@ edit_command (const char *arg, int from_tty)
error (_("No source file for address %s."), error (_("No source file for address %s."),
paddress (get_current_arch (), sal.pc)); paddress (get_current_arch (), sal.pc));
gdbarch = get_objfile_arch (SYMTAB_OBJFILE (sal.symtab)); gdbarch = SYMTAB_OBJFILE (sal.symtab)->arch ();
sym = find_pc_function (sal.pc); sym = find_pc_function (sal.pc);
if (sym) if (sym)
printf_filtered ("%s is in %s (%s:%d).\n", printf_filtered ("%s is in %s (%s:%d).\n",
@ -1257,7 +1257,7 @@ list_command (const char *arg, int from_tty)
error (_("No source file for address %s."), error (_("No source file for address %s."),
paddress (get_current_arch (), sal.pc)); paddress (get_current_arch (), sal.pc));
gdbarch = get_objfile_arch (SYMTAB_OBJFILE (sal.symtab)); gdbarch = SYMTAB_OBJFILE (sal.symtab)->arch ();
sym = find_pc_function (sal.pc); sym = find_pc_function (sal.pc);
if (sym) if (sym)
printf_filtered ("%s is in %s (%s:%d).\n", printf_filtered ("%s is in %s (%s:%d).\n",

View File

@ -753,7 +753,7 @@ coff_symtab_read (minimal_symbol_reader &reader,
long symtab_offset, unsigned int nsyms, long symtab_offset, unsigned int nsyms,
struct objfile *objfile) struct objfile *objfile)
{ {
struct gdbarch *gdbarch = get_objfile_arch (objfile); struct gdbarch *gdbarch = objfile->arch ();
struct context_stack *newobj = nullptr; struct context_stack *newobj = nullptr;
struct coff_symbol coff_symbol; struct coff_symbol coff_symbol;
struct coff_symbol *cs = &coff_symbol; struct coff_symbol *cs = &coff_symbol;
@ -1402,7 +1402,7 @@ static void
enter_linenos (long file_offset, int first_line, enter_linenos (long file_offset, int first_line,
int last_line, struct objfile *objfile) int last_line, struct objfile *objfile)
{ {
struct gdbarch *gdbarch = get_objfile_arch (objfile); struct gdbarch *gdbarch = objfile->arch ();
char *rawptr; char *rawptr;
struct internal_lineno lptr; struct internal_lineno lptr;
@ -1834,7 +1834,7 @@ decode_base_type (struct coff_symbol *cs,
union internal_auxent *aux, union internal_auxent *aux,
struct objfile *objfile) struct objfile *objfile)
{ {
struct gdbarch *gdbarch = get_objfile_arch (objfile); struct gdbarch *gdbarch = objfile->arch ();
struct type *type; struct type *type;
switch (c_type) switch (c_type)
@ -2062,7 +2062,7 @@ 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 objfile *objfile)
{ {
struct gdbarch *gdbarch = get_objfile_arch (objfile); struct gdbarch *gdbarch = objfile->arch ();
struct symbol *sym; struct symbol *sym;
struct type *type; struct type *type;
int nsyms = 0; int nsyms = 0;

View File

@ -330,7 +330,7 @@ ctf_init_float_type (struct objfile *objfile,
const char *name, const char *name,
const char *name_hint) const char *name_hint)
{ {
struct gdbarch *gdbarch = get_objfile_arch (objfile); struct gdbarch *gdbarch = objfile->arch ();
const struct floatformat **format; const struct floatformat **format;
struct type *type; struct type *type;
@ -521,7 +521,7 @@ read_base_type (struct ctf_context *ccp, ctf_id_t tid)
if (kind == CTF_K_INTEGER) if (kind == CTF_K_INTEGER)
{ {
uint32_t issigned, ischar, isbool; uint32_t issigned, ischar, isbool;
struct gdbarch *gdbarch = get_objfile_arch (of); struct gdbarch *gdbarch = of->arch ();
issigned = cet.cte_format & CTF_INT_SIGNED; issigned = cet.cte_format & CTF_INT_SIGNED;
ischar = cet.cte_format & CTF_INT_CHAR; ischar = cet.cte_format & CTF_INT_CHAR;

View File

@ -951,7 +951,7 @@ function_outside_compilation_unit_complaint (const char *arg1)
static void static void
read_dbx_symtab (minimal_symbol_reader &reader, struct objfile *objfile) read_dbx_symtab (minimal_symbol_reader &reader, struct objfile *objfile)
{ {
struct gdbarch *gdbarch = get_objfile_arch (objfile); struct gdbarch *gdbarch = objfile->arch ();
struct external_nlist *bufp = 0; /* =0 avoids gcc -Wall glitch. */ struct external_nlist *bufp = 0; /* =0 avoids gcc -Wall glitch. */
struct internal_nlist nlist; struct internal_nlist nlist;
CORE_ADDR text_addr; CORE_ADDR text_addr;
@ -1936,7 +1936,7 @@ dbx_end_psymtab (struct objfile *objfile, legacy_psymtab *pst,
int textlow_not_set) int textlow_not_set)
{ {
int i; int i;
struct gdbarch *gdbarch = get_objfile_arch (objfile); struct gdbarch *gdbarch = objfile->arch ();
if (capping_symbol_offset != -1) if (capping_symbol_offset != -1)
LDSYMLEN (pst) = capping_symbol_offset - LDSYMOFF (pst); LDSYMLEN (pst) = capping_symbol_offset - LDSYMOFF (pst);
@ -2338,7 +2338,7 @@ process_one_symbol (int type, int desc, CORE_ADDR valu, const char *name,
const section_offsets &section_offsets, const section_offsets &section_offsets,
struct objfile *objfile, enum language language) struct objfile *objfile, enum language language)
{ {
struct gdbarch *gdbarch = get_objfile_arch (objfile); struct gdbarch *gdbarch = objfile->arch ();
struct context_stack *newobj; struct context_stack *newobj;
struct context_stack cstk; struct context_stack cstk;
/* This remembers the address of the start of a function. It is /* This remembers the address of the start of a function. It is

View File

@ -520,7 +520,7 @@ dtrace_process_dof (asection *sect, struct objfile *objfile,
std::vector<std::unique_ptr<probe>> *probesp, std::vector<std::unique_ptr<probe>> *probesp,
struct dtrace_dof_hdr *dof) struct dtrace_dof_hdr *dof)
{ {
struct gdbarch *gdbarch = get_objfile_arch (objfile); struct gdbarch *gdbarch = objfile->arch ();
struct dtrace_dof_sect *section; struct dtrace_dof_sect *section;
int i; int i;

View File

@ -2147,7 +2147,7 @@ dwarf2_build_frame_info (struct objfile *objfile)
dwarf2_cie_table cie_table; dwarf2_cie_table cie_table;
dwarf2_fde_table fde_table; dwarf2_fde_table fde_table;
struct gdbarch *gdbarch = get_objfile_arch (objfile); struct gdbarch *gdbarch = objfile->arch ();
/* Build a minimal decoding of the DWARF2 compilation unit. */ /* Build a minimal decoding of the DWARF2 compilation unit. */
std::unique_ptr<comp_unit> unit (new comp_unit (objfile)); std::unique_ptr<comp_unit> unit (new comp_unit (objfile));

View File

@ -1493,7 +1493,7 @@ write_debug_names (struct dwarf2_per_objfile *dwarf2_per_objfile,
const bool dwarf5_is_dwarf64 = check_dwarf64_offsets (dwarf2_per_objfile); const bool dwarf5_is_dwarf64 = check_dwarf64_offsets (dwarf2_per_objfile);
struct objfile *objfile = dwarf2_per_objfile->objfile; struct objfile *objfile = dwarf2_per_objfile->objfile;
const enum bfd_endian dwarf5_byte_order const enum bfd_endian dwarf5_byte_order
= gdbarch_byte_order (get_objfile_arch (objfile)); = gdbarch_byte_order (objfile->arch ());
/* The CU list is already sorted, so we don't need to do additional /* The CU list is already sorted, so we don't need to do additional
work here. Also, the debug_types entries do not appear in work here. Also, the debug_types entries do not appear in

View File

@ -318,7 +318,7 @@ dwarf2_find_location_expression (struct dwarf2_loclist_baton *baton,
size_t *locexpr_length, CORE_ADDR pc) size_t *locexpr_length, CORE_ADDR pc)
{ {
struct objfile *objfile = baton->per_cu->objfile (); struct objfile *objfile = baton->per_cu->objfile ();
struct gdbarch *gdbarch = get_objfile_arch (objfile); struct gdbarch *gdbarch = objfile->arch ();
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
unsigned int addr_size = baton->per_cu->addr_size (); unsigned int addr_size = baton->per_cu->addr_size ();
int signed_addr_p = bfd_get_sign_extend_vma (objfile->obfd); int signed_addr_p = bfd_get_sign_extend_vma (objfile->obfd);
@ -729,7 +729,7 @@ class dwarf_evaluate_loc_desc : public dwarf_expr_context
(CORE_ADDR) 0); (CORE_ADDR) 0);
scoped_restore save_arch = make_scoped_restore (&this->gdbarch); scoped_restore save_arch = make_scoped_restore (&this->gdbarch);
this->gdbarch = get_objfile_arch (per_cu->objfile ()); this->gdbarch = per_cu->objfile ()->arch ();
scoped_restore save_addr_size = make_scoped_restore (&this->addr_size); scoped_restore save_addr_size = make_scoped_restore (&this->addr_size);
this->addr_size = per_cu->addr_size (); this->addr_size = per_cu->addr_size ();
scoped_restore save_offset = make_scoped_restore (&this->offset); scoped_restore save_offset = make_scoped_restore (&this->offset);
@ -1816,7 +1816,7 @@ rw_pieced_value (struct value *v, struct value *from)
} }
struct objfile *objfile = c->per_cu->objfile (); struct objfile *objfile = c->per_cu->objfile ();
struct gdbarch *objfile_gdbarch = get_objfile_arch (objfile); struct gdbarch *objfile_gdbarch = objfile->arch ();
ULONGEST stack_value_size_bits ULONGEST stack_value_size_bits
= 8 * TYPE_LENGTH (value_type (p->v.value)); = 8 * TYPE_LENGTH (value_type (p->v.value));
@ -2192,7 +2192,7 @@ dwarf2_evaluate_loc_desc_full (struct type *type, struct frame_info *frame,
scoped_value_mark free_values; scoped_value_mark free_values;
ctx.gdbarch = get_objfile_arch (objfile); ctx.gdbarch = objfile->arch ();
ctx.addr_size = per_cu->addr_size (); ctx.addr_size = per_cu->addr_size ();
ctx.ref_addr_size = per_cu->ref_addr_size (); ctx.ref_addr_size = per_cu->ref_addr_size ();
ctx.offset = per_cu->text_offset (); ctx.offset = per_cu->text_offset ();
@ -2315,7 +2315,7 @@ dwarf2_evaluate_loc_desc_full (struct type *type, struct frame_info *frame,
size_t n = TYPE_LENGTH (value_type (value)); size_t n = TYPE_LENGTH (value_type (value));
size_t len = TYPE_LENGTH (subobj_type); size_t len = TYPE_LENGTH (subobj_type);
size_t max = TYPE_LENGTH (type); size_t max = TYPE_LENGTH (type);
struct gdbarch *objfile_gdbarch = get_objfile_arch (objfile); struct gdbarch *objfile_gdbarch = objfile->arch ();
if (subobj_byte_offset + len > max) if (subobj_byte_offset + len > max)
invalid_synthetic_pointer (); invalid_synthetic_pointer ();
@ -2409,7 +2409,7 @@ dwarf2_locexpr_baton_eval (const struct dwarf2_locexpr_baton *dlbaton,
objfile = dlbaton->per_cu->objfile (); objfile = dlbaton->per_cu->objfile ();
ctx.gdbarch = get_objfile_arch (objfile); ctx.gdbarch = objfile->arch ();
ctx.addr_size = dlbaton->per_cu->addr_size (); ctx.addr_size = dlbaton->per_cu->addr_size ();
ctx.ref_addr_size = dlbaton->per_cu->ref_addr_size (); ctx.ref_addr_size = dlbaton->per_cu->ref_addr_size ();
ctx.offset = dlbaton->per_cu->text_offset (); ctx.offset = dlbaton->per_cu->text_offset ();
@ -2740,7 +2740,7 @@ dwarf2_loc_desc_get_symbol_read_needs (const gdb_byte *data, size_t size,
ctx.needs = SYMBOL_NEEDS_NONE; ctx.needs = SYMBOL_NEEDS_NONE;
ctx.per_cu = per_cu; ctx.per_cu = per_cu;
ctx.gdbarch = get_objfile_arch (objfile); ctx.gdbarch = objfile->arch ();
ctx.addr_size = per_cu->addr_size (); ctx.addr_size = per_cu->addr_size ();
ctx.ref_addr_size = per_cu->ref_addr_size (); ctx.ref_addr_size = per_cu->ref_addr_size ();
ctx.offset = per_cu->text_offset (); ctx.offset = per_cu->text_offset ();
@ -3638,7 +3638,7 @@ locexpr_describe_location_piece (struct symbol *symbol, struct ui_file *stream,
const gdb_byte *data, const gdb_byte *end, const gdb_byte *data, const gdb_byte *end,
unsigned int addr_size) unsigned int addr_size)
{ {
struct gdbarch *gdbarch = get_objfile_arch (objfile); struct gdbarch *gdbarch = objfile->arch ();
size_t leb128_size; size_t leb128_size;
if (data[0] >= DW_OP_reg0 && data[0] <= DW_OP_reg31) if (data[0] >= DW_OP_reg0 && data[0] <= DW_OP_reg31)
@ -4234,7 +4234,7 @@ locexpr_describe_location_1 (struct symbol *symbol, CORE_ADDR addr,
{ {
fprintf_filtered (stream, _("a complex DWARF expression:\n")); fprintf_filtered (stream, _("a complex DWARF expression:\n"));
data = disassemble_dwarf_expression (stream, data = disassemble_dwarf_expression (stream,
get_objfile_arch (objfile), objfile->arch (),
addr_size, offset_size, data, addr_size, offset_size, data,
data, end, 0, data, end, 0,
dwarf_always_disassemble, dwarf_always_disassemble,
@ -4436,7 +4436,7 @@ loclist_describe_location (struct symbol *symbol, CORE_ADDR addr,
= (struct dwarf2_loclist_baton *) SYMBOL_LOCATION_BATON (symbol); = (struct dwarf2_loclist_baton *) SYMBOL_LOCATION_BATON (symbol);
const gdb_byte *loc_ptr, *buf_end; const gdb_byte *loc_ptr, *buf_end;
struct objfile *objfile = dlbaton->per_cu->objfile (); struct objfile *objfile = dlbaton->per_cu->objfile ();
struct gdbarch *gdbarch = get_objfile_arch (objfile); struct gdbarch *gdbarch = objfile->arch ();
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
unsigned int addr_size = dlbaton->per_cu->addr_size (); unsigned int addr_size = dlbaton->per_cu->addr_size ();
int offset_size = dlbaton->per_cu->offset_size (); int offset_size = dlbaton->per_cu->offset_size ();

View File

@ -2567,7 +2567,7 @@ create_addrmap_from_index (struct dwarf2_per_objfile *dwarf2_per_objfile,
struct mapped_index *index) struct mapped_index *index)
{ {
struct objfile *objfile = dwarf2_per_objfile->objfile; struct objfile *objfile = dwarf2_per_objfile->objfile;
struct gdbarch *gdbarch = get_objfile_arch (objfile); struct gdbarch *gdbarch = objfile->arch ();
const gdb_byte *iter, *end; const gdb_byte *iter, *end;
struct addrmap *mutable_map; struct addrmap *mutable_map;
CORE_ADDR baseaddr; CORE_ADDR baseaddr;
@ -2624,7 +2624,7 @@ create_addrmap_from_aranges (struct dwarf2_per_objfile *dwarf2_per_objfile,
{ {
struct objfile *objfile = dwarf2_per_objfile->objfile; struct objfile *objfile = dwarf2_per_objfile->objfile;
bfd *abfd = objfile->obfd; bfd *abfd = objfile->obfd;
struct gdbarch *gdbarch = get_objfile_arch (objfile); struct gdbarch *gdbarch = objfile->arch ();
const CORE_ADDR baseaddr = objfile->text_section_offset (); const CORE_ADDR baseaddr = objfile->text_section_offset ();
auto_obstack temp_obstack; auto_obstack temp_obstack;
@ -4690,7 +4690,7 @@ dw2_find_pc_sect_compunit_symtab (struct objfile *objfile,
if (warn_if_readin && data->v.quick->compunit_symtab) if (warn_if_readin && data->v.quick->compunit_symtab)
warning (_("(Internal error: pc %s in read in CU, but not in symtab.)"), warning (_("(Internal error: pc %s in read in CU, but not in symtab.)"),
paddress (get_objfile_arch (objfile), pc)); paddress (objfile->arch (), pc));
result result
= recursively_find_pc_sect_compunit_symtab (dw2_instantiate_symtab (data, = recursively_find_pc_sect_compunit_symtab (dw2_instantiate_symtab (data,
@ -4820,7 +4820,7 @@ read_debug_names_from_section (struct objfile *objfile,
section->read (objfile); section->read (objfile);
map.dwarf5_byte_order = gdbarch_byte_order (get_objfile_arch (objfile)); map.dwarf5_byte_order = gdbarch_byte_order (objfile->arch ());
const gdb_byte *addr = section->buffer; const gdb_byte *addr = section->buffer;
@ -7253,7 +7253,7 @@ process_psymtab_comp_unit_reader (const struct die_reader_specs *reader,
{ {
struct dwarf2_cu *cu = reader->cu; struct dwarf2_cu *cu = reader->cu;
struct objfile *objfile = cu->per_cu->dwarf2_per_objfile->objfile; struct objfile *objfile = cu->per_cu->dwarf2_per_objfile->objfile;
struct gdbarch *gdbarch = get_objfile_arch (objfile); struct gdbarch *gdbarch = objfile->arch ();
struct dwarf2_per_cu_data *per_cu = cu->per_cu; struct dwarf2_per_cu_data *per_cu = cu->per_cu;
CORE_ADDR baseaddr; CORE_ADDR baseaddr;
CORE_ADDR best_lowpc = 0, best_highpc = 0; CORE_ADDR best_lowpc = 0, best_highpc = 0;
@ -8167,7 +8167,7 @@ add_partial_symbol (struct partial_die_info *pdi, struct dwarf2_cu *cu)
struct dwarf2_per_objfile *dwarf2_per_objfile struct dwarf2_per_objfile *dwarf2_per_objfile
= cu->per_cu->dwarf2_per_objfile; = cu->per_cu->dwarf2_per_objfile;
struct objfile *objfile = dwarf2_per_objfile->objfile; struct objfile *objfile = dwarf2_per_objfile->objfile;
struct gdbarch *gdbarch = get_objfile_arch (objfile); struct gdbarch *gdbarch = objfile->arch ();
CORE_ADDR addr = 0; CORE_ADDR addr = 0;
const char *actual_name = NULL; const char *actual_name = NULL;
CORE_ADDR baseaddr; CORE_ADDR baseaddr;
@ -8410,7 +8410,7 @@ add_partial_subprogram (struct partial_die_info *pdi,
if (set_addrmap) if (set_addrmap)
{ {
struct objfile *objfile = cu->per_cu->dwarf2_per_objfile->objfile; struct objfile *objfile = cu->per_cu->dwarf2_per_objfile->objfile;
struct gdbarch *gdbarch = get_objfile_arch (objfile); struct gdbarch *gdbarch = objfile->arch ();
CORE_ADDR baseaddr; CORE_ADDR baseaddr;
CORE_ADDR this_highpc; CORE_ADDR this_highpc;
CORE_ADDR this_lowpc; CORE_ADDR this_lowpc;
@ -9546,7 +9546,7 @@ process_full_comp_unit (struct dwarf2_per_cu_data *per_cu,
struct dwarf2_cu *cu = per_cu->cu; struct dwarf2_cu *cu = per_cu->cu;
struct dwarf2_per_objfile *dwarf2_per_objfile = per_cu->dwarf2_per_objfile; struct dwarf2_per_objfile *dwarf2_per_objfile = per_cu->dwarf2_per_objfile;
struct objfile *objfile = dwarf2_per_objfile->objfile; struct objfile *objfile = dwarf2_per_objfile->objfile;
struct gdbarch *gdbarch = get_objfile_arch (objfile); struct gdbarch *gdbarch = objfile->arch ();
CORE_ADDR lowpc, highpc; CORE_ADDR lowpc, highpc;
struct compunit_symtab *cust; struct compunit_symtab *cust;
CORE_ADDR baseaddr; CORE_ADDR baseaddr;
@ -10751,7 +10751,7 @@ read_file_scope (struct die_info *die, struct dwarf2_cu *cu)
struct dwarf2_per_objfile *dwarf2_per_objfile struct dwarf2_per_objfile *dwarf2_per_objfile
= cu->per_cu->dwarf2_per_objfile; = cu->per_cu->dwarf2_per_objfile;
struct objfile *objfile = dwarf2_per_objfile->objfile; struct objfile *objfile = dwarf2_per_objfile->objfile;
struct gdbarch *gdbarch = get_objfile_arch (objfile); struct gdbarch *gdbarch = objfile->arch ();
CORE_ADDR lowpc = ((CORE_ADDR) -1); CORE_ADDR lowpc = ((CORE_ADDR) -1);
CORE_ADDR highpc = ((CORE_ADDR) 0); CORE_ADDR highpc = ((CORE_ADDR) 0);
struct attribute *attr; struct attribute *attr;
@ -12830,7 +12830,7 @@ static void
read_func_scope (struct die_info *die, struct dwarf2_cu *cu) read_func_scope (struct die_info *die, struct dwarf2_cu *cu)
{ {
struct objfile *objfile = cu->per_cu->dwarf2_per_objfile->objfile; struct objfile *objfile = cu->per_cu->dwarf2_per_objfile->objfile;
struct gdbarch *gdbarch = get_objfile_arch (objfile); struct gdbarch *gdbarch = objfile->arch ();
struct context_stack *newobj; struct context_stack *newobj;
CORE_ADDR lowpc; CORE_ADDR lowpc;
CORE_ADDR highpc; CORE_ADDR highpc;
@ -13031,7 +13031,7 @@ static void
read_lexical_block_scope (struct die_info *die, struct dwarf2_cu *cu) read_lexical_block_scope (struct die_info *die, struct dwarf2_cu *cu)
{ {
struct objfile *objfile = cu->per_cu->dwarf2_per_objfile->objfile; struct objfile *objfile = cu->per_cu->dwarf2_per_objfile->objfile;
struct gdbarch *gdbarch = get_objfile_arch (objfile); struct gdbarch *gdbarch = objfile->arch ();
CORE_ADDR lowpc, highpc; CORE_ADDR lowpc, highpc;
struct die_info *child_die; struct die_info *child_die;
CORE_ADDR baseaddr; CORE_ADDR baseaddr;
@ -13102,7 +13102,7 @@ static void
read_call_site_scope (struct die_info *die, struct dwarf2_cu *cu) read_call_site_scope (struct die_info *die, struct dwarf2_cu *cu)
{ {
struct objfile *objfile = cu->per_cu->dwarf2_per_objfile->objfile; struct objfile *objfile = cu->per_cu->dwarf2_per_objfile->objfile;
struct gdbarch *gdbarch = get_objfile_arch (objfile); struct gdbarch *gdbarch = objfile->arch ();
CORE_ADDR pc, baseaddr; CORE_ADDR pc, baseaddr;
struct attribute *attr; struct attribute *attr;
struct call_site *call_site, call_site_local; struct call_site *call_site, call_site_local;
@ -13747,7 +13747,7 @@ dwarf2_ranges_read (unsigned offset, CORE_ADDR *low_return,
dwarf2_psymtab *ranges_pst) dwarf2_psymtab *ranges_pst)
{ {
struct objfile *objfile = cu->per_cu->dwarf2_per_objfile->objfile; struct objfile *objfile = cu->per_cu->dwarf2_per_objfile->objfile;
struct gdbarch *gdbarch = get_objfile_arch (objfile); struct gdbarch *gdbarch = objfile->arch ();
const CORE_ADDR baseaddr = objfile->text_section_offset (); const CORE_ADDR baseaddr = objfile->text_section_offset ();
int low_set = 0; int low_set = 0;
CORE_ADDR low = 0; CORE_ADDR low = 0;
@ -13991,7 +13991,7 @@ dwarf2_record_block_ranges (struct die_info *die, struct block *block,
CORE_ADDR baseaddr, struct dwarf2_cu *cu) CORE_ADDR baseaddr, struct dwarf2_cu *cu)
{ {
struct objfile *objfile = cu->per_cu->dwarf2_per_objfile->objfile; struct objfile *objfile = cu->per_cu->dwarf2_per_objfile->objfile;
struct gdbarch *gdbarch = get_objfile_arch (objfile); struct gdbarch *gdbarch = objfile->arch ();
struct attribute *attr; struct attribute *attr;
struct attribute *attr_high; struct attribute *attr_high;
@ -14179,7 +14179,7 @@ dwarf2_add_field (struct field_info *fip, struct die_info *die,
struct dwarf2_cu *cu) struct dwarf2_cu *cu)
{ {
struct objfile *objfile = cu->per_cu->dwarf2_per_objfile->objfile; struct objfile *objfile = cu->per_cu->dwarf2_per_objfile->objfile;
struct gdbarch *gdbarch = get_objfile_arch (objfile); struct gdbarch *gdbarch = objfile->arch ();
struct nextfield *new_field; struct nextfield *new_field;
struct attribute *attr; struct attribute *attr;
struct field *fp; struct field *fp;
@ -15945,7 +15945,7 @@ mark_common_block_symbol_computed (struct symbol *sym,
struct dwarf2_locexpr_baton *baton; struct dwarf2_locexpr_baton *baton;
gdb_byte *ptr; gdb_byte *ptr;
unsigned int cu_off; unsigned int cu_off;
enum bfd_endian byte_order = gdbarch_byte_order (get_objfile_arch (objfile)); enum bfd_endian byte_order = gdbarch_byte_order (objfile->arch ());
LONGEST offset = 0; LONGEST offset = 0;
gdb_assert (common_loc && member_loc); gdb_assert (common_loc && member_loc);
@ -16253,7 +16253,7 @@ static struct type *
read_tag_pointer_type (struct die_info *die, struct dwarf2_cu *cu) read_tag_pointer_type (struct die_info *die, struct dwarf2_cu *cu)
{ {
struct gdbarch *gdbarch struct gdbarch *gdbarch
= get_objfile_arch (cu->per_cu->dwarf2_per_objfile->objfile); = cu->per_cu->dwarf2_per_objfile->objfile->arch ();
struct comp_unit_head *cu_header = &cu->header; struct comp_unit_head *cu_header = &cu->header;
struct type *type; struct type *type;
struct attribute *attr_byte_size; struct attribute *attr_byte_size;
@ -16512,7 +16512,7 @@ static struct type *
read_tag_string_type (struct die_info *die, struct dwarf2_cu *cu) read_tag_string_type (struct die_info *die, struct dwarf2_cu *cu)
{ {
struct objfile *objfile = cu->per_cu->dwarf2_per_objfile->objfile; struct objfile *objfile = cu->per_cu->dwarf2_per_objfile->objfile;
struct gdbarch *gdbarch = get_objfile_arch (objfile); struct gdbarch *gdbarch = objfile->arch ();
struct type *type, *range_type, *index_type, *char_type; struct type *type, *range_type, *index_type, *char_type;
struct attribute *attr; struct attribute *attr;
struct dynamic_prop prop; struct dynamic_prop prop;
@ -16830,7 +16830,7 @@ static struct type *
dwarf2_init_float_type (struct objfile *objfile, int bits, const char *name, dwarf2_init_float_type (struct objfile *objfile, int bits, const char *name,
const char *name_hint, enum bfd_endian byte_order) const char *name_hint, enum bfd_endian byte_order)
{ {
struct gdbarch *gdbarch = get_objfile_arch (objfile); struct gdbarch *gdbarch = objfile->arch ();
const struct floatformat **format; const struct floatformat **format;
struct type *type; struct type *type;
@ -16878,7 +16878,7 @@ dwarf2_init_complex_target_type (struct dwarf2_cu *cu,
int bits, const char *name_hint, int bits, const char *name_hint,
enum bfd_endian byte_order) enum bfd_endian byte_order)
{ {
gdbarch *gdbarch = get_objfile_arch (objfile); gdbarch *gdbarch = objfile->arch ();
struct type *tt = nullptr; struct type *tt = nullptr;
/* Try to find a suitable floating point builtin type of size BITS. /* Try to find a suitable floating point builtin type of size BITS.
@ -16951,7 +16951,7 @@ read_base_type (struct die_info *die, struct dwarf2_cu *cu)
if (!name) if (!name)
complaint (_("DW_AT_name missing from DW_TAG_base_type")); complaint (_("DW_AT_name missing from DW_TAG_base_type"));
arch = get_objfile_arch (objfile); arch = objfile->arch ();
enum bfd_endian byte_order = gdbarch_byte_order (arch); enum bfd_endian byte_order = gdbarch_byte_order (arch);
attr = dwarf2_attr (die, DW_AT_endianity, cu); attr = dwarf2_attr (die, DW_AT_endianity, cu);
@ -18173,7 +18173,7 @@ partial_die_info::read (const struct die_reader_specs *reader,
if (lowpc == 0 && !dwarf2_per_objfile->has_section_at_zero) if (lowpc == 0 && !dwarf2_per_objfile->has_section_at_zero)
{ {
struct objfile *objfile = dwarf2_per_objfile->objfile; struct objfile *objfile = dwarf2_per_objfile->objfile;
struct gdbarch *gdbarch = get_objfile_arch (objfile); struct gdbarch *gdbarch = objfile->arch ();
complaint (_("DW_AT_low_pc %s is zero " complaint (_("DW_AT_low_pc %s is zero "
"for DIE at %s [in module %s]"), "for DIE at %s [in module %s]"),
@ -18185,7 +18185,7 @@ partial_die_info::read (const struct die_reader_specs *reader,
else if (lowpc >= highpc) else if (lowpc >= highpc)
{ {
struct objfile *objfile = dwarf2_per_objfile->objfile; struct objfile *objfile = dwarf2_per_objfile->objfile;
struct gdbarch *gdbarch = get_objfile_arch (objfile); struct gdbarch *gdbarch = objfile->arch ();
complaint (_("DW_AT_low_pc %s is not < DW_AT_high_pc %s " complaint (_("DW_AT_low_pc %s is not < DW_AT_high_pc %s "
"for DIE at %s [in module %s]"), "for DIE at %s [in module %s]"),
@ -18589,7 +18589,6 @@ read_attribute_value (const struct die_reader_specs *reader,
struct dwarf2_per_objfile *dwarf2_per_objfile struct dwarf2_per_objfile *dwarf2_per_objfile
= cu->per_cu->dwarf2_per_objfile; = cu->per_cu->dwarf2_per_objfile;
struct objfile *objfile = dwarf2_per_objfile->objfile; struct objfile *objfile = dwarf2_per_objfile->objfile;
struct gdbarch *gdbarch = get_objfile_arch (objfile);
bfd *abfd = reader->abfd; bfd *abfd = reader->abfd;
struct comp_unit_head *cu_header = &cu->header; struct comp_unit_head *cu_header = &cu->header;
unsigned int bytes_read; unsigned int bytes_read;
@ -18613,9 +18612,12 @@ read_attribute_value (const struct die_reader_specs *reader,
info_ptr += bytes_read; info_ptr += bytes_read;
break; break;
case DW_FORM_addr: case DW_FORM_addr:
DW_ADDR (attr) = cu->header.read_address (abfd, info_ptr, &bytes_read); {
DW_ADDR (attr) = gdbarch_adjust_dwarf2_addr (gdbarch, DW_ADDR (attr)); struct gdbarch *gdbarch = objfile->arch ();
info_ptr += bytes_read; DW_ADDR (attr) = cu->header.read_address (abfd, info_ptr, &bytes_read);
DW_ADDR (attr) = gdbarch_adjust_dwarf2_addr (gdbarch, DW_ADDR (attr));
info_ptr += bytes_read;
}
break; break;
case DW_FORM_block2: case DW_FORM_block2:
blk = dwarf_alloc_block (cu); blk = dwarf_alloc_block (cu);
@ -19827,7 +19829,7 @@ dwarf_decode_lines_1 (struct line_header *lh, struct dwarf2_cu *cu,
CORE_ADDR baseaddr; CORE_ADDR baseaddr;
struct objfile *objfile = cu->per_cu->dwarf2_per_objfile->objfile; struct objfile *objfile = cu->per_cu->dwarf2_per_objfile->objfile;
bfd *abfd = objfile->obfd; bfd *abfd = objfile->obfd;
struct gdbarch *gdbarch = get_objfile_arch (objfile); struct gdbarch *gdbarch = objfile->arch ();
/* True if we're recording line info (as opposed to building partial /* True if we're recording line info (as opposed to building partial
symtabs and just interested in finding include files mentioned by symtabs and just interested in finding include files mentioned by
the line number program). */ the line number program). */
@ -20251,7 +20253,7 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu,
struct dwarf2_per_objfile *dwarf2_per_objfile struct dwarf2_per_objfile *dwarf2_per_objfile
= cu->per_cu->dwarf2_per_objfile; = cu->per_cu->dwarf2_per_objfile;
struct objfile *objfile = dwarf2_per_objfile->objfile; struct objfile *objfile = dwarf2_per_objfile->objfile;
struct gdbarch *gdbarch = get_objfile_arch (objfile); struct gdbarch *gdbarch = objfile->arch ();
struct symbol *sym = NULL; struct symbol *sym = NULL;
const char *name; const char *name;
struct attribute *attr = NULL; struct attribute *attr = NULL;
@ -21898,7 +21900,7 @@ dwarf2_fetch_die_loc_sect_off (sect_offset sect_off,
{ {
CORE_ADDR pc = (*get_frame_pc) (baton); CORE_ADDR pc = (*get_frame_pc) (baton);
CORE_ADDR baseaddr = objfile->text_section_offset (); CORE_ADDR baseaddr = objfile->text_section_offset ();
struct gdbarch *gdbarch = get_objfile_arch (objfile); struct gdbarch *gdbarch = objfile->arch ();
for (const auto &cand_off for (const auto &cand_off
: dwarf2_per_objfile->abstract_to_concrete[die->sect_off]) : dwarf2_per_objfile->abstract_to_concrete[die->sect_off])

View File

@ -206,7 +206,7 @@ record_minimal_symbol (minimal_symbol_reader &reader,
enum minimal_symbol_type ms_type, enum minimal_symbol_type ms_type,
asection *bfd_section, struct objfile *objfile) asection *bfd_section, struct objfile *objfile)
{ {
struct gdbarch *gdbarch = get_objfile_arch (objfile); struct gdbarch *gdbarch = objfile->arch ();
if (ms_type == mst_text || ms_type == mst_file_text if (ms_type == mst_text || ms_type == mst_file_text
|| ms_type == mst_text_gnu_ifunc) || ms_type == mst_text_gnu_ifunc)
@ -251,7 +251,7 @@ elf_symtab_read (minimal_symbol_reader &reader,
long number_of_symbols, asymbol **symbol_table, long number_of_symbols, asymbol **symbol_table,
bool copy_names) bool copy_names)
{ {
struct gdbarch *gdbarch = get_objfile_arch (objfile); struct gdbarch *gdbarch = objfile->arch ();
asymbol *sym; asymbol *sym;
long i; long i;
CORE_ADDR symaddr; CORE_ADDR symaddr;
@ -559,7 +559,7 @@ elf_rel_plt_read (minimal_symbol_reader &reader,
const struct elf_backend_data *bed = get_elf_backend_data (obfd); const struct elf_backend_data *bed = get_elf_backend_data (obfd);
asection *relplt, *got_plt; asection *relplt, *got_plt;
bfd_size_type reloc_count, reloc; bfd_size_type reloc_count, reloc;
struct gdbarch *gdbarch = get_objfile_arch (objfile); struct gdbarch *gdbarch = objfile->arch ();
struct type *ptr_type = builtin_type (gdbarch)->builtin_data_ptr; struct type *ptr_type = builtin_type (gdbarch)->builtin_data_ptr;
size_t ptr_size = TYPE_LENGTH (ptr_type); size_t ptr_size = TYPE_LENGTH (ptr_type);
@ -747,7 +747,7 @@ elf_gnu_ifunc_record_cache (const char *name, CORE_ADDR addr)
{ {
struct elf_gnu_ifunc_cache *entry_found_p struct elf_gnu_ifunc_cache *entry_found_p
= (struct elf_gnu_ifunc_cache *) *slot; = (struct elf_gnu_ifunc_cache *) *slot;
struct gdbarch *gdbarch = get_objfile_arch (objfile); struct gdbarch *gdbarch = objfile->arch ();
if (entry_found_p->addr != addr) if (entry_found_p->addr != addr)
{ {
@ -825,7 +825,7 @@ elf_gnu_ifunc_resolve_by_got (const char *name, CORE_ADDR *addr_p)
for (objfile *objfile : current_program_space->objfiles ()) for (objfile *objfile : current_program_space->objfiles ())
{ {
bfd *obfd = objfile->obfd; bfd *obfd = objfile->obfd;
struct gdbarch *gdbarch = get_objfile_arch (objfile); struct gdbarch *gdbarch = objfile->arch ();
struct type *ptr_type = builtin_type (gdbarch)->builtin_data_ptr; struct type *ptr_type = builtin_type (gdbarch)->builtin_data_ptr;
size_t ptr_size = TYPE_LENGTH (ptr_type); size_t ptr_size = TYPE_LENGTH (ptr_type);
CORE_ADDR pointer_address, addr; CORE_ADDR pointer_address, addr;

View File

@ -282,7 +282,7 @@ call_target_sbrk (int sbrk_arg)
else else
return (bfd_vma) 0; return (bfd_vma) 0;
gdbarch = get_objfile_arch (sbrk_objf); gdbarch = sbrk_objf->arch ();
target_sbrk_arg = value_from_longest (builtin_type (gdbarch)->builtin_int, target_sbrk_arg = value_from_longest (builtin_type (gdbarch)->builtin_int,
sbrk_arg); sbrk_arg);
gdb_assert (target_sbrk_arg); gdb_assert (target_sbrk_arg);

View File

@ -236,7 +236,7 @@ get_type_arch (const struct type *type)
struct gdbarch *arch; struct gdbarch *arch;
if (TYPE_OBJFILE_OWNED (type)) if (TYPE_OBJFILE_OWNED (type))
arch = get_objfile_arch (TYPE_OWNER (type).objfile); arch = TYPE_OWNER (type).objfile->arch ();
else else
arch = TYPE_OWNER (type).gdbarch; arch = TYPE_OWNER (type).gdbarch;
@ -3000,7 +3000,7 @@ init_float_type (struct objfile *objfile,
{ {
if (byte_order == BFD_ENDIAN_UNKNOWN) if (byte_order == BFD_ENDIAN_UNKNOWN)
{ {
struct gdbarch *gdbarch = get_objfile_arch (objfile); struct gdbarch *gdbarch = objfile->arch ();
byte_order = gdbarch_byte_order (gdbarch); byte_order = gdbarch_byte_order (gdbarch);
} }
const struct floatformat *fmt = floatformats[byte_order]; const struct floatformat *fmt = floatformats[byte_order];
@ -5607,7 +5607,7 @@ objfile_type (struct objfile *objfile)
1, struct objfile_type); 1, struct objfile_type);
/* Use the objfile architecture to determine basic type properties. */ /* Use the objfile architecture to determine basic type properties. */
gdbarch = get_objfile_arch (objfile); gdbarch = objfile->arch ();
/* Basic types. */ /* Basic types. */
objfile_type->builtin_void objfile_type->builtin_void

View File

@ -258,7 +258,7 @@ internalize_unwinds (struct objfile *objfile, struct unwind_table_entry *table,
if (size > 0) if (size > 0)
{ {
struct gdbarch *gdbarch = get_objfile_arch (objfile); struct gdbarch *gdbarch = objfile->arch ();
unsigned long tmp; unsigned long tmp;
unsigned i; unsigned i;
char *buf = (char *) alloca (size); char *buf = (char *) alloca (size);

View File

@ -2764,7 +2764,7 @@ ia64_find_unwind_table (struct objfile *objfile, unw_word_t ip,
dip->start_ip = p_text->p_vaddr + load_base; dip->start_ip = p_text->p_vaddr + load_base;
dip->end_ip = dip->start_ip + p_text->p_memsz; dip->end_ip = dip->start_ip + p_text->p_memsz;
dip->gp = ia64_find_global_pointer (get_objfile_arch (objfile), ip); dip->gp = ia64_find_global_pointer (objfile->arch (), ip);
dip->format = UNW_INFO_FORMAT_REMOTE_TABLE; dip->format = UNW_INFO_FORMAT_REMOTE_TABLE;
dip->u.rti.name_ptr = (unw_word_t) bfd_get_filename (bfd); dip->u.rti.name_ptr = (unw_word_t) bfd_get_filename (bfd);
dip->u.rti.segbase = segbase; dip->u.rti.segbase = segbase;

View File

@ -7819,7 +7819,7 @@ insert_exception_resume_from_probe (struct thread_info *tp,
if (debug_infrun) if (debug_infrun)
fprintf_unfiltered (gdb_stdlog, fprintf_unfiltered (gdb_stdlog,
"infrun: exception resume at %s\n", "infrun: exception resume at %s\n",
paddress (get_objfile_arch (probe->objfile), paddress (probe->objfile->arch (),
handler)); handler));
bp = set_momentary_breakpoint_at_pc (get_frame_arch (frame), bp = set_momentary_breakpoint_at_pc (get_frame_arch (frame),

View File

@ -656,7 +656,7 @@ finalize_symtab (struct gdb_symtab *stab, struct objfile *objfile)
{ {
struct block *new_block = allocate_block (&objfile->objfile_obstack); struct block *new_block = allocate_block (&objfile->objfile_obstack);
struct symbol *block_name = allocate_symbol (objfile); struct symbol *block_name = allocate_symbol (objfile);
struct type *block_type = arch_type (get_objfile_arch (objfile), struct type *block_type = arch_type (objfile->arch (),
TYPE_CODE_VOID, TYPE_CODE_VOID,
TARGET_CHAR_BIT, TARGET_CHAR_BIT,
"void"); "void");

View File

@ -2291,7 +2291,7 @@ convert_linespec_to_sals (struct linespec_state *state, linespec_p ls)
if (MSYMBOL_TYPE (elem.minsym) == mst_data_gnu_ifunc) if (MSYMBOL_TYPE (elem.minsym) == mst_data_gnu_ifunc)
{ {
struct gdbarch *gdbarch struct gdbarch *gdbarch
= get_objfile_arch (elem.objfile); = elem.objfile->arch ();
msym_addr msym_addr
= (gdbarch_convert_from_func_ptr_addr = (gdbarch_convert_from_func_ptr_addr
(gdbarch, (gdbarch,

View File

@ -663,7 +663,7 @@ checkpoint_command (const char *args, int from_tty)
if (!fork_fn) if (!fork_fn)
error (_("checkpoint: can't find fork function in inferior.")); error (_("checkpoint: can't find fork function in inferior."));
gdbarch = get_objfile_arch (fork_objf); gdbarch = fork_objf->arch ();
ret = value_from_longest (builtin_type (gdbarch)->builtin_int, 0); ret = value_from_longest (builtin_type (gdbarch)->builtin_int, 0);
/* Tell linux-nat.c that we're checkpointing this inferior. */ /* Tell linux-nat.c that we're checkpointing this inferior. */

View File

@ -2326,7 +2326,7 @@ linux_infcall_mmap (CORE_ADDR size, unsigned prot)
"mmap" uses 64-bit off_t on x86_64 and 32-bit off_t on i386 and x32. */ "mmap" uses 64-bit off_t on x86_64 and 32-bit off_t on i386 and x32. */
struct value *mmap_val = find_function_in_inferior ("mmap64", &objf); struct value *mmap_val = find_function_in_inferior ("mmap64", &objf);
struct value *addr_val; struct value *addr_val;
struct gdbarch *gdbarch = get_objfile_arch (objf); struct gdbarch *gdbarch = objf->arch ();
CORE_ADDR retval; CORE_ADDR retval;
enum enum
{ {
@ -2365,7 +2365,7 @@ linux_infcall_munmap (CORE_ADDR addr, CORE_ADDR size)
struct objfile *objf; struct objfile *objf;
struct value *munmap_val = find_function_in_inferior ("munmap", &objf); struct value *munmap_val = find_function_in_inferior ("munmap", &objf);
struct value *retval_val; struct value *retval_val;
struct gdbarch *gdbarch = get_objfile_arch (objf); struct gdbarch *gdbarch = objf->arch ();
LONGEST retval; LONGEST retval;
enum enum
{ {

View File

@ -493,7 +493,7 @@ macho_add_oso_symfile (oso_el *oso, const gdb_bfd_ref_ptr &abfd,
{ {
if (mach_o_debug_level > 4) if (mach_o_debug_level > 4)
{ {
struct gdbarch *arch = get_objfile_arch (main_objfile); struct gdbarch *arch = main_objfile->arch ();
printf_unfiltered printf_unfiltered
(_("Adding symbol %s (addr: %s)\n"), (_("Adding symbol %s (addr: %s)\n"),
sym->name, paddress (arch, sym->value)); sym->name, paddress (arch, sym->value));
@ -567,7 +567,7 @@ macho_add_oso_symfile (oso_el *oso, const gdb_bfd_ref_ptr &abfd,
if (mach_o_debug_level > 3) if (mach_o_debug_level > 3)
{ {
struct gdbarch *arch = get_objfile_arch (main_objfile); struct gdbarch *arch = main_objfile->arch ();
printf_unfiltered printf_unfiltered
(_("resolve sect %s with %s (set to %s)\n"), (_("resolve sect %s with %s (set to %s)\n"),
sec->name, sym->name, sec->name, sym->name,

View File

@ -573,7 +573,7 @@ static int
parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend, parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend,
const section_offsets &section_offsets, struct objfile *objfile) const section_offsets &section_offsets, struct objfile *objfile)
{ {
struct gdbarch *gdbarch = get_objfile_arch (objfile); struct gdbarch *gdbarch = objfile->arch ();
const bfd_size_type external_sym_size = debug_swap->external_sym_size; 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; void (*const swap_sym_in) (bfd *, void *, SYMR *) = debug_swap->swap_sym_in;
const char *name; const char *name;
@ -1357,7 +1357,7 @@ static const struct objfile_key<struct type *,
static struct type * static struct type *
basic_type (int bt, struct objfile *objfile) basic_type (int bt, struct objfile *objfile)
{ {
struct gdbarch *gdbarch = get_objfile_arch (objfile); struct gdbarch *gdbarch = objfile->arch ();
struct type **map_bt = basic_type_data.get (objfile); struct type **map_bt = basic_type_data.get (objfile);
struct type *tp; struct type *tp;
@ -2283,7 +2283,7 @@ static void
parse_partial_symbols (minimal_symbol_reader &reader, parse_partial_symbols (minimal_symbol_reader &reader,
struct objfile *objfile) struct objfile *objfile)
{ {
struct gdbarch *gdbarch = get_objfile_arch (objfile); struct gdbarch *gdbarch = objfile->arch ();
const bfd_size_type external_sym_size = debug_swap->external_sym_size; 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_rfd_size = debug_swap->external_rfd_size;
const bfd_size_type external_ext_size = debug_swap->external_ext_size; const bfd_size_type external_ext_size = debug_swap->external_ext_size;
@ -3899,7 +3899,7 @@ mdebug_expand_psymtab (legacy_psymtab *pst, struct objfile *objfile)
if (processing_gcc_compilation != 0) if (processing_gcc_compilation != 0)
{ {
struct gdbarch *gdbarch = get_objfile_arch (objfile); struct gdbarch *gdbarch = objfile->arch ();
/* This symbol table contains stabs-in-ecoff entries. */ /* This symbol table contains stabs-in-ecoff entries. */

View File

@ -50,7 +50,7 @@ mi_cmd_symbol_list_lines (const char *command, char **argv, int argc)
already sorted by increasing values in the symbol table, so no already sorted by increasing values in the symbol table, so no
need to perform any other sorting. */ need to perform any other sorting. */
gdbarch = get_objfile_arch (SYMTAB_OBJFILE (s)); gdbarch = SYMTAB_OBJFILE (s)->arch ();
ui_out_emit_list list_emitter (uiout, "lines"); ui_out_emit_list list_emitter (uiout, "lines");
if (SYMTAB_LINETABLE (s) != NULL && SYMTAB_LINETABLE (s)->nitems > 0) if (SYMTAB_LINETABLE (s) != NULL && SYMTAB_LINETABLE (s)->nitems > 0)
@ -96,7 +96,7 @@ static void
output_nondebug_symbol (ui_out *uiout, output_nondebug_symbol (ui_out *uiout,
const struct bound_minimal_symbol &msymbol) const struct bound_minimal_symbol &msymbol)
{ {
struct gdbarch *gdbarch = get_objfile_arch (msymbol.objfile); struct gdbarch *gdbarch = msymbol.objfile->arch ();
ui_out_emit_tuple tuple_emitter (uiout, NULL); ui_out_emit_tuple tuple_emitter (uiout, NULL);
uiout->field_core_addr ("address", gdbarch, uiout->field_core_addr ("address", gdbarch,

View File

@ -77,7 +77,7 @@ msymbol_is_function (struct objfile *objfile, minimal_symbol *minsym,
case mst_file_bss: case mst_file_bss:
case mst_data_gnu_ifunc: case mst_data_gnu_ifunc:
{ {
struct gdbarch *gdbarch = get_objfile_arch (objfile); struct gdbarch *gdbarch = objfile->arch ();
CORE_ADDR pc CORE_ADDR pc
= gdbarch_convert_from_func_ptr_addr (gdbarch, msym_addr, = gdbarch_convert_from_func_ptr_addr (gdbarch, msym_addr,
current_top_target ()); current_top_target ());

View File

@ -374,14 +374,6 @@ objfile::objfile (bfd *abfd, const char *name, objfile_flags flags_)
per_bfd = get_objfile_bfd_data (this, abfd); per_bfd = get_objfile_bfd_data (this, abfd);
} }
/* Retrieve the gdbarch associated with OBJFILE. */
struct gdbarch *
get_objfile_arch (const struct objfile *objfile)
{
return objfile->per_bfd->gdbarch;
}
/* If there is a valid and known entry point, function fills *ENTRY_P with it /* If there is a valid and known entry point, function fills *ENTRY_P with it
and returns non-zero; otherwise it returns zero. */ and returns non-zero; otherwise it returns zero. */
@ -1132,7 +1124,7 @@ filter_overlapping_sections (struct obj_section **map, int map_size)
const CORE_ADDR sect2_endaddr = obj_section_endaddr (sect2); const CORE_ADDR sect2_endaddr = obj_section_endaddr (sect2);
struct gdbarch *const gdbarch = get_objfile_arch (objf1); struct gdbarch *const gdbarch = objf1->arch ();
complaint (_("unexpected overlap between:\n" complaint (_("unexpected overlap between:\n"
" (A) section `%s' from `%s' [%s, %s)\n" " (A) section `%s' from `%s' [%s, %s)\n"

View File

@ -544,6 +544,12 @@ public:
str.size () + 1); str.size () + 1);
} }
/* Retrieve the gdbarch associated with this objfile. */
struct gdbarch *arch () const
{
return per_bfd->gdbarch;
}
/* The object file's original name as specified by the user, /* The object file's original name as specified by the user,
made absolute, and tilde-expanded. However, it is not canonicalized made absolute, and tilde-expanded. However, it is not canonicalized
@ -709,8 +715,6 @@ typedef std::unique_ptr<objfile, objfile_deleter> objfile_up;
/* Declarations for functions defined in objfiles.c */ /* Declarations for functions defined in objfiles.c */
extern struct gdbarch *get_objfile_arch (const struct objfile *);
extern int entry_point_address_query (CORE_ADDR *entry_p); extern int entry_point_address_query (CORE_ADDR *entry_p);
extern CORE_ADDR entry_point_address (void); extern CORE_ADDR entry_point_address (void);

View File

@ -1442,7 +1442,7 @@ info_address_command (const char *exp, int from_tty)
{ {
struct objfile *objfile = msymbol.objfile; struct objfile *objfile = msymbol.objfile;
gdbarch = get_objfile_arch (objfile); gdbarch = objfile->arch ();
load_addr = BMSYMBOL_VALUE_ADDRESS (msymbol); load_addr = BMSYMBOL_VALUE_ADDRESS (msymbol);
printf_filtered ("Symbol \""); printf_filtered ("Symbol \"");

View File

@ -392,7 +392,7 @@ psym_find_pc_sect_compunit_symtab (struct objfile *objfile,
continue, so let's not. */ continue, so let's not. */
warning (_("\ warning (_("\
(Internal error: pc %s in read in psymtab, but not in symtab.)\n"), (Internal error: pc %s in read in psymtab, but not in symtab.)\n"),
paddress (get_objfile_arch (objfile), pc)); paddress (objfile->arch (), pc));
psymtab_to_symtab (objfile, ps); psymtab_to_symtab (objfile, ps);
return ps->get_compunit_symtab (); return ps->get_compunit_symtab ();
} }
@ -927,7 +927,7 @@ static void
dump_psymtab (struct objfile *objfile, struct partial_symtab *psymtab, dump_psymtab (struct objfile *objfile, struct partial_symtab *psymtab,
struct ui_file *outfile) struct ui_file *outfile)
{ {
struct gdbarch *gdbarch = get_objfile_arch (objfile); struct gdbarch *gdbarch = objfile->arch ();
int i; int i;
if (psymtab->anonymous) if (psymtab->anonymous)
@ -1779,7 +1779,7 @@ dump_psymtab_addrmap_1 (void *datap, CORE_ADDR start_addr, void *obj)
{ {
struct dump_psymtab_addrmap_data *data struct dump_psymtab_addrmap_data *data
= (struct dump_psymtab_addrmap_data *) datap; = (struct dump_psymtab_addrmap_data *) datap;
struct gdbarch *gdbarch = get_objfile_arch (data->objfile); struct gdbarch *gdbarch = data->objfile->arch ();
struct partial_symtab *addrmap_psymtab = (struct partial_symtab *) obj; struct partial_symtab *addrmap_psymtab = (struct partial_symtab *) obj;
const char *psymtab_address_or_end = NULL; const char *psymtab_address_or_end = NULL;
@ -1999,7 +1999,7 @@ maintenance_info_psymtabs (const char *regexp, int from_tty)
ALL_PSPACES (pspace) ALL_PSPACES (pspace)
for (objfile *objfile : pspace->objfiles ()) for (objfile *objfile : pspace->objfiles ())
{ {
struct gdbarch *gdbarch = get_objfile_arch (objfile); struct gdbarch *gdbarch = objfile->arch ();
/* We don't want to print anything for this objfile until we /* We don't want to print anything for this objfile until we
actually find a symtab whose name matches. */ actually find a symtab whose name matches. */
@ -2118,7 +2118,7 @@ maintenance_check_psymtabs (const char *ignore, int from_tty)
for (objfile *objfile : current_program_space->objfiles ()) for (objfile *objfile : current_program_space->objfiles ())
for (partial_symtab *ps : require_partial_symbols (objfile, true)) for (partial_symtab *ps : require_partial_symbols (objfile, true))
{ {
struct gdbarch *gdbarch = get_objfile_arch (objfile); struct gdbarch *gdbarch = objfile->arch ();
/* We don't call psymtab_to_symtab here because that may cause symtab /* We don't call psymtab_to_symtab here because that may cause symtab
expansion. When debugging a problem it helps if checkers leave expansion. When debugging a problem it helps if checkers leave

View File

@ -193,7 +193,7 @@ python_new_objfile (struct objfile *objfile)
return; return;
gdbpy_enter enter_py (objfile != NULL gdbpy_enter enter_py (objfile != NULL
? get_objfile_arch (objfile) ? objfile->arch ()
: target_gdbarch (), : target_gdbarch (),
current_language); current_language);

View File

@ -661,7 +661,7 @@ gdbpy_lookup_objfile (PyObject *self, PyObject *args, PyObject *kw)
static void static void
py_free_objfile (struct objfile *objfile, void *datum) py_free_objfile (struct objfile *objfile, void *datum)
{ {
gdbpy_enter enter_py (get_objfile_arch (objfile), current_language); gdbpy_enter enter_py (objfile->arch (), current_language);
gdbpy_ref<objfile_object> object ((objfile_object *) datum); gdbpy_ref<objfile_object> object ((objfile_object *) datum);
object->objfile = NULL; object->objfile = NULL;
} }

View File

@ -1049,7 +1049,7 @@ save_objfile_types (struct objfile *objfile, void *datum)
/* This prevents another thread from freeing the objects we're /* This prevents another thread from freeing the objects we're
operating on. */ operating on. */
gdbpy_enter enter_py (get_objfile_arch (objfile), current_language); gdbpy_enter enter_py (objfile->arch (), current_language);
copied_types = create_copied_types_hash (objfile); copied_types = create_copied_types_hash (objfile);

View File

@ -1389,7 +1389,7 @@ gdbpy_source_objfile_script (const struct extension_language_defn *extlang,
if (!gdb_python_initialized) if (!gdb_python_initialized)
return; return;
gdbpy_enter enter_py (get_objfile_arch (objfile), current_language); gdbpy_enter enter_py (objfile->arch (), current_language);
gdbpy_current_objfile = objfile; gdbpy_current_objfile = objfile;
python_run_simple_file (file, filename); python_run_simple_file (file, filename);
@ -1411,7 +1411,7 @@ gdbpy_execute_objfile_script (const struct extension_language_defn *extlang,
if (!gdb_python_initialized) if (!gdb_python_initialized)
return; return;
gdbpy_enter enter_py (get_objfile_arch (objfile), current_language); gdbpy_enter enter_py (objfile->arch (), current_language);
gdbpy_current_objfile = objfile; gdbpy_current_objfile = objfile;
PyRun_SimpleString (script); PyRun_SimpleString (script);

View File

@ -1499,8 +1499,7 @@ info_line_command (const char *arg, int from_tty)
else if (sal.line > 0 else if (sal.line > 0
&& find_line_pc_range (sal, &start_pc, &end_pc)) && find_line_pc_range (sal, &start_pc, &end_pc))
{ {
struct gdbarch *gdbarch struct gdbarch *gdbarch = SYMTAB_OBJFILE (sal.symtab)->arch ();
= get_objfile_arch (SYMTAB_OBJFILE (sal.symtab));
if (start_pc == end_pc) if (start_pc == end_pc)
{ {

View File

@ -369,7 +369,7 @@ dbx_alloc_type (int typenums[2], struct objfile *objfile)
static struct type * static struct type *
dbx_init_float_type (struct objfile *objfile, int bits) dbx_init_float_type (struct objfile *objfile, int bits)
{ {
struct gdbarch *gdbarch = get_objfile_arch (objfile); struct gdbarch *gdbarch = objfile->arch ();
const struct floatformat **format; const struct floatformat **format;
struct type *type; struct type *type;
@ -649,7 +649,7 @@ struct symbol *
define_symbol (CORE_ADDR valu, const char *string, int desc, int type, define_symbol (CORE_ADDR valu, const char *string, int desc, int type,
struct objfile *objfile) struct objfile *objfile)
{ {
struct gdbarch *gdbarch = get_objfile_arch (objfile); struct gdbarch *gdbarch = objfile->arch ();
struct symbol *sym; struct symbol *sym;
const char *p = find_name_end (string); const char *p = find_name_end (string);
int deftype; int deftype;
@ -2823,7 +2823,7 @@ read_one_struct_field (struct stab_field_info *fip, const char **pp,
const char *p, struct type *type, const char *p, struct type *type,
struct objfile *objfile) struct objfile *objfile)
{ {
struct gdbarch *gdbarch = get_objfile_arch (objfile); struct gdbarch *gdbarch = objfile->arch ();
fip->list->field.name fip->list->field.name
= obstack_strndup (&objfile->objfile_obstack, *pp, p - *pp); = obstack_strndup (&objfile->objfile_obstack, *pp, p - *pp);
@ -3581,7 +3581,7 @@ static struct type *
read_enum_type (const char **pp, struct type *type, read_enum_type (const char **pp, struct type *type,
struct objfile *objfile) struct objfile *objfile)
{ {
struct gdbarch *gdbarch = get_objfile_arch (objfile); struct gdbarch *gdbarch = objfile->arch ();
const char *p; const char *p;
char *name; char *name;
long n; long n;
@ -3997,7 +3997,7 @@ static struct type *
read_range_type (const char **pp, int typenums[2], int type_size, read_range_type (const char **pp, int typenums[2], int type_size,
struct objfile *objfile) struct objfile *objfile)
{ {
struct gdbarch *gdbarch = get_objfile_arch (objfile); struct gdbarch *gdbarch = objfile->arch ();
const char *orig_pp = *pp; const char *orig_pp = *pp;
int rangenums[2]; int rangenums[2];
long n2, n3; long n2, n3;

View File

@ -1517,7 +1517,7 @@ handle_stap_probe (struct objfile *objfile, struct sdt_note *el,
{ {
bfd *abfd = objfile->obfd; bfd *abfd = objfile->obfd;
int size = bfd_get_arch_size (abfd) / 8; int size = bfd_get_arch_size (abfd) / 8;
struct gdbarch *gdbarch = get_objfile_arch (objfile); struct gdbarch *gdbarch = objfile->arch ();
struct type *ptr_type = builtin_type (gdbarch)->builtin_data_ptr; struct type *ptr_type = builtin_type (gdbarch)->builtin_data_ptr;
/* Provider and the name of the probe. */ /* Provider and the name of the probe. */

View File

@ -852,14 +852,14 @@ init_entry_point_info (struct objfile *objfile)
/* Make certain that the address points at real code, and not a /* Make certain that the address points at real code, and not a
function descriptor. */ function descriptor. */
entry_point entry_point
= gdbarch_convert_from_func_ptr_addr (get_objfile_arch (objfile), = gdbarch_convert_from_func_ptr_addr (objfile->arch (),
entry_point, entry_point,
current_top_target ()); current_top_target ());
/* Remove any ISA markers, so that this matches entries in the /* Remove any ISA markers, so that this matches entries in the
symbol table. */ symbol table. */
ei->entry_point ei->entry_point
= gdbarch_addr_bits_remove (get_objfile_arch (objfile), entry_point); = gdbarch_addr_bits_remove (objfile->arch (), entry_point);
found = 0; found = 0;
ALL_OBJFILE_OSECTIONS (objfile, osect) ALL_OBJFILE_OSECTIONS (objfile, osect)
@ -2998,7 +2998,7 @@ section_is_mapped (struct obj_section *osect)
case ovly_auto: /* overlay debugging automatic */ case ovly_auto: /* overlay debugging automatic */
/* Unles there is a gdbarch_overlay_update function, /* Unles there is a gdbarch_overlay_update function,
there's really nothing useful to do here (can't really go auto). */ there's really nothing useful to do here (can't really go auto). */
gdbarch = get_objfile_arch (osect->objfile); gdbarch = osect->objfile->arch ();
if (gdbarch_overlay_update_p (gdbarch)) if (gdbarch_overlay_update_p (gdbarch))
{ {
if (overlay_cache_invalid) if (overlay_cache_invalid)
@ -3197,7 +3197,7 @@ list_overlays_command (const char *args, int from_tty)
ALL_OBJFILE_OSECTIONS (objfile, osect) ALL_OBJFILE_OSECTIONS (objfile, osect)
if (section_is_mapped (osect)) if (section_is_mapped (osect))
{ {
struct gdbarch *gdbarch = get_objfile_arch (objfile); struct gdbarch *gdbarch = objfile->arch ();
const char *name; const char *name;
bfd_vma lma, vma; bfd_vma lma, vma;
int size; int size;
@ -3453,7 +3453,7 @@ simple_read_overlay_table (void)
return 0; return 0;
} }
gdbarch = get_objfile_arch (ovly_table_msym.objfile); gdbarch = ovly_table_msym.objfile->arch ();
word_size = gdbarch_long_bit (gdbarch) / TARGET_CHAR_BIT; word_size = gdbarch_long_bit (gdbarch) / TARGET_CHAR_BIT;
byte_order = gdbarch_byte_order (gdbarch); byte_order = gdbarch_byte_order (gdbarch);
@ -3482,7 +3482,7 @@ simple_overlay_update_1 (struct obj_section *osect)
{ {
int i; int i;
asection *bsect = osect->the_bfd_section; asection *bsect = osect->the_bfd_section;
struct gdbarch *gdbarch = get_objfile_arch (osect->objfile); struct gdbarch *gdbarch = osect->objfile->arch ();
int word_size = gdbarch_long_bit (gdbarch) / TARGET_CHAR_BIT; int word_size = gdbarch_long_bit (gdbarch) / TARGET_CHAR_BIT;
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);

View File

@ -179,7 +179,7 @@ dump_objfile (struct objfile *objfile)
static void static void
dump_msymbols (struct objfile *objfile, struct ui_file *outfile) dump_msymbols (struct objfile *objfile, struct ui_file *outfile)
{ {
struct gdbarch *gdbarch = get_objfile_arch (objfile); struct gdbarch *gdbarch = objfile->arch ();
int index; int index;
char ms_type; char ms_type;
@ -269,7 +269,7 @@ static void
dump_symtab_1 (struct symtab *symtab, struct ui_file *outfile) dump_symtab_1 (struct symtab *symtab, struct ui_file *outfile)
{ {
struct objfile *objfile = SYMTAB_OBJFILE (symtab); struct objfile *objfile = SYMTAB_OBJFILE (symtab);
struct gdbarch *gdbarch = get_objfile_arch (objfile); struct gdbarch *gdbarch = objfile->arch ();
int i; int i;
struct mdict_iterator miter; struct mdict_iterator miter;
int len; int len;
@ -1050,7 +1050,7 @@ maintenance_print_one_line_table (struct symtab *symtab, void *data)
uiout->field_signed ("line", item->line); uiout->field_signed ("line", item->line);
else else
uiout->field_string ("line", _("END")); uiout->field_string ("line", _("END"));
uiout->field_core_addr ("address", get_objfile_arch (objfile), uiout->field_core_addr ("address", objfile->arch (),
item->pc); item->pc);
uiout->field_string ("is-stmt", item->is_stmt ? "Y" : ""); uiout->field_string ("is-stmt", item->is_stmt ? "Y" : "");
uiout->text ("\n"); uiout->text ("\n");

View File

@ -2666,7 +2666,7 @@ lookup_global_or_static_symbol (const char *name,
lookup_data.block_index = block_index; lookup_data.block_index = block_index;
lookup_data.domain = domain; lookup_data.domain = domain;
gdbarch_iterate_over_objfiles_in_search_order gdbarch_iterate_over_objfiles_in_search_order
(objfile != NULL ? get_objfile_arch (objfile) : target_gdbarch (), (objfile != NULL ? objfile->arch () : target_gdbarch (),
lookup_symbol_global_or_static_iterator_cb, &lookup_data, objfile); lookup_symbol_global_or_static_iterator_cb, &lookup_data, objfile);
result = lookup_data.result; result = lookup_data.result;
} }
@ -3647,7 +3647,7 @@ find_function_start_sal_1 (CORE_ADDR func_addr, obj_section *section,
&& (COMPUNIT_LOCATIONS_VALID (SYMTAB_COMPUNIT (sal.symtab)) && (COMPUNIT_LOCATIONS_VALID (SYMTAB_COMPUNIT (sal.symtab))
|| SYMTAB_LANGUAGE (sal.symtab) == language_asm)) || SYMTAB_LANGUAGE (sal.symtab) == language_asm))
{ {
struct gdbarch *gdbarch = get_objfile_arch (SYMTAB_OBJFILE (sal.symtab)); struct gdbarch *gdbarch = SYMTAB_OBJFILE (sal.symtab)->arch ();
sal.pc = func_addr; sal.pc = func_addr;
if (gdbarch_skip_entrypoint_p (gdbarch)) if (gdbarch_skip_entrypoint_p (gdbarch))
@ -3806,7 +3806,7 @@ skip_prologue_sal (struct symtab_and_line *sal)
name = msymbol.minsym->linkage_name (); name = msymbol.minsym->linkage_name ();
} }
gdbarch = get_objfile_arch (objfile); gdbarch = objfile->arch ();
/* Process the prologue in two passes. In the first pass try to skip the /* Process the prologue in two passes. In the first pass try to skip the
prologue (SKIP is true) and verify there is a real need for it (indicated prologue (SKIP is true) and verify there is a real need for it (indicated
@ -4928,7 +4928,7 @@ print_symbol_info (enum search_domain kind,
static void static void
print_msymbol_info (struct bound_minimal_symbol msymbol) print_msymbol_info (struct bound_minimal_symbol msymbol)
{ {
struct gdbarch *gdbarch = get_objfile_arch (msymbol.objfile); struct gdbarch *gdbarch = msymbol.objfile->arch ();
char *tmp; char *tmp;
if (gdbarch_addr_bit (gdbarch) <= 32) if (gdbarch_addr_bit (gdbarch) <= 32)
@ -5550,7 +5550,7 @@ find_gnu_ifunc (const symbol *sym)
CORE_ADDR msym_addr = MSYMBOL_VALUE_ADDRESS (objfile, minsym); CORE_ADDR msym_addr = MSYMBOL_VALUE_ADDRESS (objfile, minsym);
if (MSYMBOL_TYPE (minsym) == mst_data_gnu_ifunc) if (MSYMBOL_TYPE (minsym) == mst_data_gnu_ifunc)
{ {
struct gdbarch *gdbarch = get_objfile_arch (objfile); struct gdbarch *gdbarch = objfile->arch ();
msym_addr msym_addr
= gdbarch_convert_from_func_ptr_addr (gdbarch, = gdbarch_convert_from_func_ptr_addr (gdbarch,
msym_addr, msym_addr,
@ -6405,7 +6405,7 @@ symbol_arch (const struct symbol *symbol)
{ {
if (!SYMBOL_OBJFILE_OWNED (symbol)) if (!SYMBOL_OBJFILE_OWNED (symbol))
return symbol->owner.arch; return symbol->owner.arch;
return get_objfile_arch (SYMTAB_OBJFILE (symbol->owner.symtab)); return SYMTAB_OBJFILE (symbol->owner.symtab)->arch ();
} }
/* See symtab.h. */ /* See symtab.h. */

View File

@ -74,7 +74,7 @@ tui_source_window::set_contents (struct gdbarch *arch,
m_fullname = make_unique_xstrdup (symtab_to_fullname (s)); m_fullname = make_unique_xstrdup (symtab_to_fullname (s));
cur_line = 0; cur_line = 0;
m_gdbarch = get_objfile_arch (SYMTAB_OBJFILE (s)); m_gdbarch = SYMTAB_OBJFILE (s)->arch ();
m_start_line_or_addr.loa = LOA_LINE; m_start_line_or_addr.loa = LOA_LINE;
cur_line_no = m_start_line_or_addr.u.line_no = line_no; cur_line_no = m_start_line_or_addr.u.line_no = line_no;

View File

@ -216,7 +216,7 @@ tui_update_source_windows_with_line (struct symtab_and_line sal)
if (sal.symtab != nullptr) if (sal.symtab != nullptr)
{ {
find_line_pc (sal.symtab, sal.line, &sal.pc); find_line_pc (sal.symtab, sal.line, &sal.pc);
gdbarch = get_objfile_arch (SYMTAB_OBJFILE (sal.symtab)); gdbarch = SYMTAB_OBJFILE (sal.symtab)->arch ();
} }
for (struct tui_source_window_base *win_info : tui_source_windows ()) for (struct tui_source_window_base *win_info : tui_source_windows ())

View File

@ -139,7 +139,7 @@ find_function_in_inferior (const char *name, struct objfile **objf_p)
if (msymbol.minsym != NULL) if (msymbol.minsym != NULL)
{ {
struct objfile *objfile = msymbol.objfile; struct objfile *objfile = msymbol.objfile;
struct gdbarch *gdbarch = get_objfile_arch (objfile); struct gdbarch *gdbarch = objfile->arch ();
struct type *type; struct type *type;
CORE_ADDR maddr; CORE_ADDR maddr;
@ -175,7 +175,7 @@ value_allocate_space_in_inferior (int len)
{ {
struct objfile *objf; struct objfile *objf;
struct value *val = find_function_in_inferior ("malloc", &objf); struct value *val = find_function_in_inferior ("malloc", &objf);
struct gdbarch *gdbarch = get_objfile_arch (objf); struct gdbarch *gdbarch = objf->arch ();
struct value *blocklen; struct value *blocklen;
blocklen = value_from_longest (builtin_type (gdbarch)->builtin_int, len); blocklen = value_from_longest (builtin_type (gdbarch)->builtin_int, len);

View File

@ -3068,7 +3068,7 @@ value_fn_field (struct value **arg1p, struct fn_field *f,
/* The minimal symbol might point to a function descriptor; /* The minimal symbol might point to a function descriptor;
resolve it to the actual code address instead. */ resolve it to the actual code address instead. */
struct objfile *objfile = msym.objfile; struct objfile *objfile = msym.objfile;
struct gdbarch *gdbarch = get_objfile_arch (objfile); struct gdbarch *gdbarch = objfile->arch ();
set_value_address (v, set_value_address (v,
gdbarch_convert_from_func_ptr_addr gdbarch_convert_from_func_ptr_addr

View File

@ -829,7 +829,7 @@ enter_line_range (struct subfile *subfile, unsigned beginoffset,
CORE_ADDR endaddr, unsigned *firstLine) CORE_ADDR endaddr, unsigned *firstLine)
{ {
struct objfile *objfile = this_symtab_objfile; struct objfile *objfile = this_symtab_objfile;
struct gdbarch *gdbarch = get_objfile_arch (objfile); struct gdbarch *gdbarch = objfile->arch ();
unsigned int curoffset; unsigned int curoffset;
CORE_ADDR addr; CORE_ADDR addr;
void *ext_lnno; void *ext_lnno;
@ -2121,7 +2121,7 @@ static void
scan_xcoff_symtab (minimal_symbol_reader &reader, scan_xcoff_symtab (minimal_symbol_reader &reader,
struct objfile *objfile) struct objfile *objfile)
{ {
struct gdbarch *gdbarch = get_objfile_arch (objfile); struct gdbarch *gdbarch = objfile->arch ();
CORE_ADDR toc_offset = 0; /* toc offset value in data section. */ CORE_ADDR toc_offset = 0; /* toc offset value in data section. */
const char *filestring = NULL; const char *filestring = NULL;