mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-28 15:18:37 +08:00
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:
@ -318,7 +318,7 @@ dwarf2_find_location_expression (struct dwarf2_loclist_baton *baton,
|
||||
size_t *locexpr_length, CORE_ADDR pc)
|
||||
{
|
||||
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);
|
||||
unsigned int addr_size = baton->per_cu->addr_size ();
|
||||
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);
|
||||
|
||||
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);
|
||||
this->addr_size = per_cu->addr_size ();
|
||||
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 gdbarch *objfile_gdbarch = get_objfile_arch (objfile);
|
||||
struct gdbarch *objfile_gdbarch = objfile->arch ();
|
||||
ULONGEST stack_value_size_bits
|
||||
= 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;
|
||||
|
||||
ctx.gdbarch = get_objfile_arch (objfile);
|
||||
ctx.gdbarch = objfile->arch ();
|
||||
ctx.addr_size = per_cu->addr_size ();
|
||||
ctx.ref_addr_size = per_cu->ref_addr_size ();
|
||||
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 len = TYPE_LENGTH (subobj_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)
|
||||
invalid_synthetic_pointer ();
|
||||
@ -2409,7 +2409,7 @@ dwarf2_locexpr_baton_eval (const struct dwarf2_locexpr_baton *dlbaton,
|
||||
|
||||
objfile = dlbaton->per_cu->objfile ();
|
||||
|
||||
ctx.gdbarch = get_objfile_arch (objfile);
|
||||
ctx.gdbarch = objfile->arch ();
|
||||
ctx.addr_size = dlbaton->per_cu->addr_size ();
|
||||
ctx.ref_addr_size = dlbaton->per_cu->ref_addr_size ();
|
||||
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.per_cu = per_cu;
|
||||
ctx.gdbarch = get_objfile_arch (objfile);
|
||||
ctx.gdbarch = objfile->arch ();
|
||||
ctx.addr_size = per_cu->addr_size ();
|
||||
ctx.ref_addr_size = per_cu->ref_addr_size ();
|
||||
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,
|
||||
unsigned int addr_size)
|
||||
{
|
||||
struct gdbarch *gdbarch = get_objfile_arch (objfile);
|
||||
struct gdbarch *gdbarch = objfile->arch ();
|
||||
size_t leb128_size;
|
||||
|
||||
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"));
|
||||
data = disassemble_dwarf_expression (stream,
|
||||
get_objfile_arch (objfile),
|
||||
objfile->arch (),
|
||||
addr_size, offset_size, data,
|
||||
data, end, 0,
|
||||
dwarf_always_disassemble,
|
||||
@ -4436,7 +4436,7 @@ loclist_describe_location (struct symbol *symbol, CORE_ADDR addr,
|
||||
= (struct dwarf2_loclist_baton *) SYMBOL_LOCATION_BATON (symbol);
|
||||
const gdb_byte *loc_ptr, *buf_end;
|
||||
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);
|
||||
unsigned int addr_size = dlbaton->per_cu->addr_size ();
|
||||
int offset_size = dlbaton->per_cu->offset_size ();
|
||||
|
Reference in New Issue
Block a user