binutils-gdb/gdb/mipsread.c

388 lines
12 KiB
C
Raw Normal View History

/* Read a symbol table in MIPS' format (Third-Eye).
* mipsread.c: Cleanup coding style. (mipscoff_new_init, mipscoff_symfile_init, mipscoff_symfile_read) (mipscoff_symfile_finish): Remove prototypes. * mips-tdep.c (mips_fetch_instruction, mips16_fetch_instruction) (mips_mdebug_frame_cache, mips16_scan_prologue) (mips32_scan_prologue, mips_stub_frame_cache) (heuristic_proc_start, heuristic_proc_desc) (mips_eabi_push_dummy_call, mips_n32n64_push_dummy_call) (mips_n32n64_return_value, mips_o32_push_dummy_call) (mips_o32_return_value, mips_o64_push_dummy_call) (mips_step_skips_delay, mips_skip_trampoline_code) (mips_gdbarch_init): Use MIPS_A0_REGNUM instead of A0_REGNUM, MIPS_RA_REGNUM instead of RA_REGNUM, MIPS_T9_REGNUM instead of T9_REGNUM, MIPS_V0_REGNUM instead of V0_REGNUM, MIPS_ZERO_REGNUM instead of ZERO_REGNUM, MIPS32_SIZE_INSN instead of MIPS_INSTLEN and MIPS16_INSN_SIZE instead of MIPS16_INSTLEN. (mips_dump_tdep): Don't print A0_REGNUM, RA_REGNUM, T9_REGNUM, V0_REGNUM, ZERO_REGNUM, MIPS_INSTLEN and MIPS16_INSTLEN. Use MIPS_A0_REGNUM instead of A0_REGNUM. * mips-linux-tdep.c (mips_linux_o32_sigframe_init) (mips_linux_n32n64_sigframe_init): Use MIPS_ZERO_REGNUM instead of ZERO_REGNUM. * mipsnbsd-tdep.c (mipsnbsd_cannot_fetch_register) (mipsnbsd_cannot_store_register): Use MIPS_ZERO_REGNUM instead of ZERO_REGNUM. (mipsnbsd_get_longjmp_target): Use MIPS_A0_REGNUM instead of A0_REGNUM. * mipsnbsd-nat.c: Include "mips-tdep.h". (getregs_supplies): Use MIPS_ZERO_REGNUM instead of ZERO_REGNUM. * Makefile.in (mipsnbsd-nat.o): Update dependencies.
2004-10-30 17:01:31 +02:00
Copyright (C) 1986-2018 Free Software Foundation, Inc.
* mipsread.c: Cleanup coding style. (mipscoff_new_init, mipscoff_symfile_init, mipscoff_symfile_read) (mipscoff_symfile_finish): Remove prototypes. * mips-tdep.c (mips_fetch_instruction, mips16_fetch_instruction) (mips_mdebug_frame_cache, mips16_scan_prologue) (mips32_scan_prologue, mips_stub_frame_cache) (heuristic_proc_start, heuristic_proc_desc) (mips_eabi_push_dummy_call, mips_n32n64_push_dummy_call) (mips_n32n64_return_value, mips_o32_push_dummy_call) (mips_o32_return_value, mips_o64_push_dummy_call) (mips_step_skips_delay, mips_skip_trampoline_code) (mips_gdbarch_init): Use MIPS_A0_REGNUM instead of A0_REGNUM, MIPS_RA_REGNUM instead of RA_REGNUM, MIPS_T9_REGNUM instead of T9_REGNUM, MIPS_V0_REGNUM instead of V0_REGNUM, MIPS_ZERO_REGNUM instead of ZERO_REGNUM, MIPS32_SIZE_INSN instead of MIPS_INSTLEN and MIPS16_INSN_SIZE instead of MIPS16_INSTLEN. (mips_dump_tdep): Don't print A0_REGNUM, RA_REGNUM, T9_REGNUM, V0_REGNUM, ZERO_REGNUM, MIPS_INSTLEN and MIPS16_INSTLEN. Use MIPS_A0_REGNUM instead of A0_REGNUM. * mips-linux-tdep.c (mips_linux_o32_sigframe_init) (mips_linux_n32n64_sigframe_init): Use MIPS_ZERO_REGNUM instead of ZERO_REGNUM. * mipsnbsd-tdep.c (mipsnbsd_cannot_fetch_register) (mipsnbsd_cannot_store_register): Use MIPS_ZERO_REGNUM instead of ZERO_REGNUM. (mipsnbsd_get_longjmp_target): Use MIPS_A0_REGNUM instead of A0_REGNUM. * mipsnbsd-nat.c: Include "mips-tdep.h". (getregs_supplies): Use MIPS_ZERO_REGNUM instead of ZERO_REGNUM. * Makefile.in (mipsnbsd-nat.o): Update dependencies.
2004-10-30 17:01:31 +02:00
Contributed by Alessandro Forin (af@cs.cmu.edu) at CMU. Major work
by Per Bothner, John Gilmore and Ian Lance Taylor at Cygnus Support.
1999-07-07 22:19:36 +02:00
This file is part of GDB.
1999-07-07 22:19:36 +02:00
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
1999-07-07 22:19:36 +02:00
(at your option) any later version.
1999-07-07 22:19:36 +02:00
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
1999-07-07 22:19:36 +02:00
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* Read symbols from an ECOFF file. Most of the work is done in
mdebugread.c. */
#include "defs.h"
#include "bfd.h"
#include "symtab.h"
#include "objfiles.h"
#include "stabsread.h"
#include "coff/sym.h"
#include "coff/internal.h"
#include "coff/ecoff.h"
#include "libcoff.h" /* Private BFD COFF information. */
#include "libecoff.h" /* Private BFD ECOFF information. */
#include "elf/common.h"
include/elf/ PR 5900 * common.h (SHN_BAD): Delete. (SHN_LORESERVE .. SHN_HIRESERVE): Move to.. * external.h: ..here. * internal.h (SHN_LORESERVE, SHN_HIRESERVE): Define. (SHN_LOPROC, SHN_HIPROC, SHN_LOOS, SHN_HIOS): Define. (SHN_ABS, SHN_COMMON, SHN_XINDEX, SHN_BAD): Define. bfd/ PR 5900 * elf-bfd.h: Include elf/internal.h after elf/external.h. * elfcode.h (elf_swap_symbol_in): Map reserved shndx range. (elf_swap_symbol_out): Adjust SHN_XINDEX test. (elf_swap_ehdr_out): Mask SHN_LORESERVE and SHN_XINDEX to values seen in external structs. (valid_section_index_p): Delete. (elf_object_p): Don't increment section numbers over reserved range. Simplify test for valid sh_link, sh_info and e_shstrndx fields. (elf_write_shdrs_and_ehdr): Mask SHN_LORESERVE and SHN_XINDEX to values seen in external structs. Don't increment section numbers over reserved range. * elf.c (bfd_elf_sym_name): Remove redundant tests on st_shndx. (bfd_section_from_shdr): Likewise. (group_signature): Range check before accessing elf_elfsections. (_bfd_elf_setup_sections): Likewise. (bfd_section_from_shdr): Likewise. (bfd_section_from_shdr): Don't increment section number over reserved sections. (assign_file_positions_for_non_load_sections): Likewise. (assign_file_positions_except_relocs): Likewise. (_bfd_elf_write_object_contents): Likewise. (assign_section_numbers): Likewise. Adjust for changed SHN_*. (prep_headers): Delete unused variable. * elflink.c (bfd_elf_link_record_local_dynamic_symbol): Adjust for changed SHN_* values. (check_dynsym, elf_link_input_bfd): Likewise. (bfd_elf_final_link): Likewise. Don't skip over reserved section range. (elf_fixup_link_order): Check that sh_link field is valid. * elf-hppa.h (elf_hppa_add_symbol_hook): Make "index" unsigned. * elf32-arm.c (elf32_arm_gc_mark_extra_sections): Range check before accesssing elf_elfsections. * elf32-avr.c (elf32_avr_size_stubs): Likewise. * elf32-hppa.c (elf32_hppa_size_stubs): Likewise. * elf32-m68hc1x.c (elf32_m68hc11_size_stubs): Likewise. * elf64-hppa.c (elf64_hppa_check_relocs): Adjust for changed SHN_* defines. Test for SHN_BAD return from _bfd_elf_section_from_bfd_section binutils/ PR 5900 * readelf.c (SECTION_HEADER_INDEX, SECTION_HEADER_NUM): Delete. Remove use throughout file. (SECTION_HEADER): Likewise. (dump_relocations): Don't adjust st_shndx for reserved range. (process_file_header): Mask SHN_XINDEX to values seen in external elf structs. Simplify valid section index tests. (get_32bit_elf_symbols, get_64bit_elf_symbols): Mask SHN_XINDEX. Map reserved st_shndx to internal form. (process_section_groups): Test that group symbol st_shndx is in range, not just non-zero. Delete reserved range check. (get_symbol_index_type): Mask "type" to 16 bits when printing PRC, OS or RSV. gdb/ PR 5900 * elfread.c (elf_symtab_read): Make shndx an unsigned int. * mipsread.c: Include elf/internal.h. (read_alphacoff_dynamic_symtab): Map external reserved sym_shndx to internal range. ld/testsuite/ PR 5900 * ld-elf/sec64k.exp: Update.
2008-03-12 09:37:09 +01:00
#include "elf/internal.h"
#include "elf/mips.h"
gdb * xcoffread.c: Include psymtab.h. (xcoff_sym_fns): Update. * symtab.h (struct partial_symbol): Remove. (PSYMBOL_DOMAIN, PSYMBOL_CLASS): Remove. (struct partial_symtab): Remove. (PSYMTAB_TO_SYMTAB): Remove. (lookup_partial_symbol, lookup_partial_symtab, find_pc_psymtab) (find_pc_sect_psymtab): Remove. (find_pc_sect_symtab_via_partial): Declare. (find_pc_psymtab, find_pc_sect_psymbol, psymtab_to_symtab) (find_main_psymtab): Remove. (find_main_filename): Declare. (fixup_psymbol_section): Remove. (fixup_section): Declare. * symtab.c: Include psymtab.h. (lookup_symtab): Use lookup_symtab method. (lookup_partial_symtab): Remove. (find_pc_sect_psymtab_closer): Remove. (find_pc_sect_psymtab): Remove. (find_pc_sect_symtab_via_partial): New function. (find_pc_psymtab, find_pc_sect_psymbol, find_pc_psymbol): Remove. (fixup_section): No longer static. (fixup_psymbol_section): Remove. (lookup_symbol_aux): Use lookup_symbol_aux_quick. (lookup_global_symbol_from_objfile): Likewise. (lookup_symbol_aux_psymtabs): Remove. (lookup_symbol_aux_quick): New function. (lookup_symbol_global): Use lookup_symbol_aux_quick. (lookup_partial_symbol): Remove. (basic_lookup_transparent_type_quick): New function. (basic_lookup_transparent_type): Use it. (find_main_psymtab): Remove. (find_main_filename): New function. (find_pc_sect_symtab): Use find_pc_sect_symtab method. (find_line_symtab): Use expand_symtabs_with_filename method. (output_partial_symbol_filename): New function. (sources_info): Use map_partial_symbol_filenames. (struct search_symbols_data): New type. (search_symbols_file_matches): New function. (search_symbols_name_matches): Likewise. (search_symbols): Use expand_symtabs_matching method. (struct add_name_data): Rename from add_macro_name_data. (add_macro_name): Update. (add_partial_symbol_name): New function. (default_make_symbol_completion_list): Use map_partial_symbol_names. (struct add_partial_symbol_name): New type. (maybe_add_partial_symtab_filename): New function. (make_source_files_completion_list): Use map_partial_symbol_filenames. (expand_line_sal): Use expand_symtabs_with_filename method. * symmisc.c: Include psymtab.h. (print_objfile_statistics): Use print_stats method. (dump_objfile): Use dump method. (dump_psymtab, maintenance_print_psymbols) (maintenance_info_psymtabs, maintenance_check_symtabs) (extend_psymbol_list): Remove. * symfile.h (struct quick_symbol_functions): New struct. (struct sym_fns) <qf>: New field. (sort_pst_symbols): Remove. (increment_reading_symtab): Declare. * symfile.c: Include psymtab.h. (compare_psymbols, sort_pst_symbols): Remove. (psymtab_to_symtab): Remove. (increment_reading_symtab): New function. (symbol_file_add_with_addrs_or_offsets): Use expand_all_symtabs method. (set_initial_language): Use find_main_filename. (allocate_psymtab, discard_psymtab, cashier_psymtab): Remove. (free_named_symtabs): Remove unused code. (start_psymtab_common, add_psymbol_to_bcache) (append_psymbol_to_list, add_psymbol_to_list, init_psymbol_list): Remove. * stack.c: Include psymtab.h, symfile.h. (backtrace_command_1): Use find_pc_sect_symtab_via_partial. * source.h (psymtab_to_fullname): Don't declare. * source.c: Include psymtab.h. (select_source_symtab): Use find_last_source_symtab method. (forget_cached_source_info): Use forget_cached_source_info method. (find_and_open_source): No longer static. (psymtab_to_fullname): Remove. * somread.c: Include psymtab.h. (som_sym_fns): Update. * psympriv.h: New file. * psymtab.h: New file. * psymtab.c: New file. * objfiles.h: (ALL_OBJFILE_PSYMTABS): Remove. (ALL_PSYMTABS, ALL_PSPACE_PSYMTABS): Likewise. * objfiles.c: Include psymtab.h. (objfile_relocate1): Use relocate method. (objfile_has_partial_symbols): Use has_symbols method. * mipsread.c: Include psymtab.h. (ecoff_sym_fns): Update. * mi/mi-cmd-file.c: Include psymtab.h. (print_partial_file_name): New function. (mi_cmd_file_list_exec_source_files): Use map_partial_symbol_filenames. * mdebugread.c: Include psympriv.h. * machoread.c: Include psympriv.h. (macho_sym_fns): Update. * m2-exp.y (yylex): Use lookup_symtab. * elfread.c: Include psympriv.h. (elf_sym_fns): Update. * dwarf2read.c: Include psympriv.h. * dbxread.c: Include psympriv.h. (aout_sym_fns): Update. * cp-support.c: Include psymtab.h. (read_in_psymtabs): Remove. (make_symbol_overload_list_qualified): Use expand_symtabs_for_function method. * coffread.c: Include psympriv.h. (coff_sym_fns): Update. * blockframe.c: Include psymtab.h. (find_pc_partial_function): Use find_pc_sect_symtab method. * ada-lang.h (ada_update_initial_language): Update. * ada-lang.c: Include psymtab.h. (ada_update_initial_language): Remove 'main_pst' argument. (ada_lookup_partial_symbol): Remove. (struct ada_psym_data): New type. (ada_add_psyms): New function. (ada_add_non_local_symbols): Use map_ada_symtabs method. (struct add_partial_datum): New type. (ada_add_partial_symbol_completions): New function. (ada_make_symbol_completion_list): Use map_partial_symbol_names. (ada_exception_support_info_sniffer): Update. * Makefile.in (SFILES): Add psymtab.c. (COMMON_OBS): Add psymtab.o. (HFILES_NO_SRCDIR): Add psymtab.h, psympriv.h. gdb/doc * gdbint.texinfo (Symbol Handling): Update.
2010-03-10 19:20:08 +01:00
#include "psymtab.h"
static void
Record minimal symbols directly in reader. This patch changes minimal symbol creation in two ways. First, it removes global variables in favor of members of minimal_symbol_reader. Second, it changes functions like prim_record_minimal_symbol to be member functions of minimal_symbol_reader. 2016-10-21 Tom Tromey <tom@tromey.com> * xcoffread.c (record_minimal_symbol, scan_xcoff_symtab): Add "reader" argument. Update. (xcoff_initial_scan): Update. * symfile.h (mdebug_build_psymtabs): Add "reader" argument. * mipsread.c (mipscoff_symfile_read): Update. (read_alphacoff_dynamic_symtab): Add "reader" argument. Update. * minsyms.h (minimal_symbol_reader) <record, record_full>: Declare. <m_msym_bunch, m_msym_bunch_index, m_msym_count>: New members. <record_with_info>: New function, renamed from prim_record_minimal_symbol_and_info. * minsyms.c (msym_bunch, msym_bunch_index, msym_count): Remove globals. (minimal_symbol_reader): Initialize new members. (minimal_symbol_reader::record): Renamed from prim_record_minimal_symbol. (minimal_symbol_reader::record_full): Renamed from prim_record_minimal_symbol_full. (prim_record_minimal_symbol_and_info): Move to minsyms.h; rename. * mdebugread.c (mdebug_build_psymtabs, parse_partial_symbols) (record_minimal_symbol): Add "reader" argument. Update. (elfmdebug_build_psymtabs): Update. * machoread.c (macho_symtab_add_minsym, macho_symtab_read): Add "reader" argument. Update. (macho_symfile_read): Update. * elfread.c (record_minimal_symbol, elf_symtab_read) (elf_rel_plt_read): Add "reader" argument. Update. (elf_read_minimal_symbols): Update. * dbxread.c (record_minimal_symbol, read_dbx_dynamic_symtab) (read_dbx_symtab): Add "reader" argument. Update. (dbx_symfile_read): Update. * coffread.c (record_minimal_symbol, coff_symtab_read): Add "reader" argument. Update. (coff_symfile_read): Update. * coff-pe-read.h (read_pe_exported_syms): Add "reader" argument. * coff-pe-read.c (add_pe_exported_sym, add_pe_forwarded_sym) (read_pe_exported_syms): Add "reader" argument. Update.
2016-09-22 22:25:08 +02:00
read_alphacoff_dynamic_symtab (minimal_symbol_reader &,
struct section_offsets *,
2000-05-28 03:12:42 +02:00
struct objfile *objfile);
/* Initialize anything that needs initializing when a completely new
symbol file is specified (not just adding some symbols from another
file, e.g. a shared library). */
static void
2000-07-30 03:48:28 +02:00
mipscoff_new_init (struct objfile *ignore)
{
stabsread_new_init ();
}
/* Initialize to read a symbol file (nothing to do). */
static void
2000-07-30 03:48:28 +02:00
mipscoff_symfile_init (struct objfile *objfile)
{
}
/* Read a symbol file from a file. */
static void
Make symfile_add_flags and objfile->flags strongly typed This makes these flag types be "enum flag" types. The benefit is making use of C++'s stronger typing -- mixing the flags types by mistake errors at compile time. This caught one old bug in symbol_file_add_main_1 already, fixed by this patch as well: @@ -1318,7 +1326,7 @@ symbol_file_add_main_1 (const char *args, int from_tty, int flags) what is frameless. */ reinit_frame_cache (); - if ((flags & SYMFILE_NO_READ) == 0) + if ((add_flags & SYMFILE_NO_READ) == 0) set_initial_language (); } Above, "flags" are objfile flags, not symfile_add_flags. So that was actually checking for "flag & OBJF_PSYMTABS_READ", which has the same value as SYMFILE_NO_READ... I moved the flags definitions to separate files to break circular dependencies. Built with --enable-targets=all and tested on x86-64 Fedora 23. gdb/ChangeLog: 2016-10-26 Pedro Alves <palves@redhat.com> * coffread.c (coff_symfile_read): Use symfile_add_flags. * dbxread.c (dbx_symfile_read): Ditto. * elfread.c (elf_symfile_read): Ditto. * inferior.h: Include symfile-add-flags.h. (struct inferior) <symfile_flags>: Now symfile_add_flags. * machoread.c (macho_add_oso_symfile, macho_symfile_read_all_oso) (macho_symfile_read, mipscoff_symfile_read): Use symfile_add_flags. * objfile-flags.h: New file. * objfiles.c (allocate_objfile): Use objfile_flags. * objfiles.h: Include objfile-flags.h. (struct objfile) <flags>: Now an objfile_flags. (OBJF_REORDERED, OBJF_SHARED, OBJF_READNOW, OBJF_USERLOADED) (OBJF_PSYMTABS_READ, OBJF_MAINLINE, OBJF_NOT_FILENAME): Delete. Converted to an enum-flags in objfile-flags.h. (allocate_objfile): Use objfile_flags. * python/py-objfile.c (objfpy_add_separate_debug_file): Remove unnecessary local. * solib.c (solib_read_symbols, solib_add) (reload_shared_libraries_1): Use symfile_add_flags. * solib.h: Include "symfile-add-flags.h". (solib_read_symbols): Use symfile_add_flags. * symfile-add-flags.h: New file. * symfile-debug.c (debug_sym_read): Use symfile_add_flags. * symfile-mem.c (symbol_file_add_from_memory): Use symfile_add_flags. * symfile.c (read_symbols, syms_from_objfile_1) (syms_from_objfile, finish_new_objfile): Use symfile_add_flags. (symbol_file_add_with_addrs): Use symfile_add_flags and objfile_flags. (symbol_file_add_separate): Use symfile_add_flags. (symbol_file_add_from_bfd, symbol_file_add): Use symfile_add_flags and objfile_flags. (symbol_file_add_main_1): : Use objfile_flags. Fix add_flags vs flags confusion. (symbol_file_command): Use objfile_flags. (add_symbol_file_command): Use symfile_add_flags and objfile_flags. (clear_symtab_users): Use symfile_add_flags. * symfile.h: Include "symfile-add-flags.h" and "objfile-flags.h". (struct sym_fns) <sym_read>: Use symfile_add_flags. (clear_symtab_users): Use symfile_add_flags. (enum symfile_add_flags): Delete, moved to symfile-add-flags.h and converted to enum-flags. (symbol_file_add, symbol_file_add_from_bfd) (symbol_file_add_separate): Use symfile_add_flags. * xcoffread.c (xcoff_initial_scan): Use symfile_add_flags.
2016-10-26 17:47:10 +02:00
mipscoff_symfile_read (struct objfile *objfile, symfile_add_flags symfile_flags)
{
bfd *abfd = objfile->obfd;
minimal_symbol_reader reader (objfile);
/* Now that the executable file is positioned at symbol table,
process it and define symbols accordingly. */
if (!((*ecoff_backend (abfd)->debug_swap.read_debug_info)
(abfd, (asection *) NULL, &ecoff_data (abfd)->debug_info)))
2005-02-10 Andrew Cagney <cagney@gnu.org> Mark up all error and warning messages. * ada-lang.c, amd64-tdep.c, arch-utils.c, breakpoint.c: Update. * bsd-kvm.c, bsd-uthread.c, coff-solib.h, coffread.c: Update. * core-aout.c, core-regset.c, corefile.c, corelow.c: Update. * cp-abi.c, cp-support.c, cp-valprint.c, cris-tdep.c: Update. * dbxread.c, demangle.c, doublest.c, dsrec.c: Update. * dve3900-rom.c, dwarf2expr.c, dwarf2loc.c: Update. * dwarf2read.c, dwarfread.c, elfread.c, eval.c: Update. * event-top.c, exec.c, expprint.c, f-lang.c: Update. * f-typeprint.c, f-valprint.c, fbsd-nat.c, findvar.c: Update. * frame.c, frv-linux-tdep.c, gcore.c, gdbtypes.c: Update. * gnu-nat.c, gnu-v2-abi.c, gnu-v3-abi.c, go32-nat.c: Update. * hpacc-abi.c, hppa-hpux-nat.c, hppa-hpux-tdep.c: Update. * hppa-linux-nat.c, hppa-linux-tdep.c, hppa-tdep.c: Update. * hpread.c, hpux-thread.c, i386-linux-nat.c: Update. * i386-linux-tdep.c, i386-tdep.c, i386bsd-nat.c: Update. * i386gnu-nat.c, i387-tdep.c, ia64-linux-nat.c: Update. * ia64-tdep.c, inf-child.c, inf-ptrace.c, inf-ttrace.c: Update. * infcall.c, infcmd.c, inflow.c, infptrace.c, infrun.c: Update. * inftarg.c, interps.c, irix5-nat.c, jv-lang.c: Update. * kod-cisco.c, kod.c, language.c, libunwind-frame.c: Update. * linespec.c, linux-nat.c, linux-thread-db.c, m2-lang.c: Update. * m32r-rom.c, m68hc11-tdep.c, m68k-tdep.c: Update. * m68klinux-nat.c, macrocmd.c, macroexp.c, main.c: Update. * maint.c, mdebugread.c, mem-break.c, memattr.c: Update. * mips-linux-tdep.c, mips-tdep.c, mipsread.c, monitor.c: Update. * nlmread.c, nto-procfs.c, objc-lang.c, objfiles.c: Update. * observer.c, ocd.c, p-lang.c, p-typeprint.c: Update. * p-valprint.c, pa64solib.c, parse.c, ppc-linux-tdep.c: Update. * ppcnbsd-tdep.c, printcmd.c, procfs.c, remote-e7000.c: Update. * remote-fileio.c, remote-m32r-sdi.c, remote-rdi.c: Update. * remote-rdp.c, remote-sim.c, remote-st.c: Update. * remote-utils.c, remote-utils.h, remote.c: Update. * rom68k-rom.c, rs6000-nat.c, s390-tdep.c, scm-lang.c: Update. * ser-e7kpc.c, ser-tcp.c, ser-unix.c, sh-tdep.c: Update. * sh3-rom.c, shnbsd-tdep.c, sol-thread.c, solib-aix5.c: Update. * solib-frv.c, solib-irix.c, solib-osf.c, solib-pa64.c: Update. * solib-som.c, solib-sunos.c, solib-svr4.c, solib.c: Update. * somread.c, somsolib.c, source.c, stabsread.c: Update. * stack.c, std-regs.c, symfile-mem.c, symfile.c: Update. * symmisc.c, symtab.c, target.c, thread.c, top.c: Update. * tracepoint.c, trad-frame.c, typeprint.c, utils.c: Update. * uw-thread.c, valarith.c, valops.c, valprint.c: Update. * value.c, varobj.c, version.in, win32-nat.c, wince.c: Update. * xcoffread.c, xcoffsolib.c, cli/cli-cmds.c: Update. * cli/cli-decode.c, cli/cli-dump.c, cli/cli-logging.c: Update. * cli/cli-script.c, cli/cli-setshow.c, mi/mi-cmd-break.c: Update. * mi/mi-cmd-disas.c, mi/mi-cmd-env.c, mi/mi-cmd-file.c: Update. * mi/mi-cmd-stack.c, mi/mi-cmd-var.c, mi/mi-getopt.c: Update. * mi/mi-symbol-cmds.c, tui/tui-layout.c, tui/tui-stack.c: Update. * tui/tui-win.c: Update.
2005-02-11 05:06:14 +01:00
error (_("Error reading symbol table: %s"), bfd_errmsg (bfd_get_error ()));
Record minimal symbols directly in reader. This patch changes minimal symbol creation in two ways. First, it removes global variables in favor of members of minimal_symbol_reader. Second, it changes functions like prim_record_minimal_symbol to be member functions of minimal_symbol_reader. 2016-10-21 Tom Tromey <tom@tromey.com> * xcoffread.c (record_minimal_symbol, scan_xcoff_symtab): Add "reader" argument. Update. (xcoff_initial_scan): Update. * symfile.h (mdebug_build_psymtabs): Add "reader" argument. * mipsread.c (mipscoff_symfile_read): Update. (read_alphacoff_dynamic_symtab): Add "reader" argument. Update. * minsyms.h (minimal_symbol_reader) <record, record_full>: Declare. <m_msym_bunch, m_msym_bunch_index, m_msym_count>: New members. <record_with_info>: New function, renamed from prim_record_minimal_symbol_and_info. * minsyms.c (msym_bunch, msym_bunch_index, msym_count): Remove globals. (minimal_symbol_reader): Initialize new members. (minimal_symbol_reader::record): Renamed from prim_record_minimal_symbol. (minimal_symbol_reader::record_full): Renamed from prim_record_minimal_symbol_full. (prim_record_minimal_symbol_and_info): Move to minsyms.h; rename. * mdebugread.c (mdebug_build_psymtabs, parse_partial_symbols) (record_minimal_symbol): Add "reader" argument. Update. (elfmdebug_build_psymtabs): Update. * machoread.c (macho_symtab_add_minsym, macho_symtab_read): Add "reader" argument. Update. (macho_symfile_read): Update. * elfread.c (record_minimal_symbol, elf_symtab_read) (elf_rel_plt_read): Add "reader" argument. Update. (elf_read_minimal_symbols): Update. * dbxread.c (record_minimal_symbol, read_dbx_dynamic_symtab) (read_dbx_symtab): Add "reader" argument. Update. (dbx_symfile_read): Update. * coffread.c (record_minimal_symbol, coff_symtab_read): Add "reader" argument. Update. (coff_symfile_read): Update. * coff-pe-read.h (read_pe_exported_syms): Add "reader" argument. * coff-pe-read.c (add_pe_exported_sym, add_pe_forwarded_sym) (read_pe_exported_syms): Add "reader" argument. Update.
2016-09-22 22:25:08 +02:00
mdebug_build_psymtabs (reader, objfile, &ecoff_backend (abfd)->debug_swap,
1999-09-09 02:02:17 +02:00
&ecoff_data (abfd)->debug_info);
/* Add alpha coff dynamic symbols. */
Record minimal symbols directly in reader. This patch changes minimal symbol creation in two ways. First, it removes global variables in favor of members of minimal_symbol_reader. Second, it changes functions like prim_record_minimal_symbol to be member functions of minimal_symbol_reader. 2016-10-21 Tom Tromey <tom@tromey.com> * xcoffread.c (record_minimal_symbol, scan_xcoff_symtab): Add "reader" argument. Update. (xcoff_initial_scan): Update. * symfile.h (mdebug_build_psymtabs): Add "reader" argument. * mipsread.c (mipscoff_symfile_read): Update. (read_alphacoff_dynamic_symtab): Add "reader" argument. Update. * minsyms.h (minimal_symbol_reader) <record, record_full>: Declare. <m_msym_bunch, m_msym_bunch_index, m_msym_count>: New members. <record_with_info>: New function, renamed from prim_record_minimal_symbol_and_info. * minsyms.c (msym_bunch, msym_bunch_index, msym_count): Remove globals. (minimal_symbol_reader): Initialize new members. (minimal_symbol_reader::record): Renamed from prim_record_minimal_symbol. (minimal_symbol_reader::record_full): Renamed from prim_record_minimal_symbol_full. (prim_record_minimal_symbol_and_info): Move to minsyms.h; rename. * mdebugread.c (mdebug_build_psymtabs, parse_partial_symbols) (record_minimal_symbol): Add "reader" argument. Update. (elfmdebug_build_psymtabs): Update. * machoread.c (macho_symtab_add_minsym, macho_symtab_read): Add "reader" argument. Update. (macho_symfile_read): Update. * elfread.c (record_minimal_symbol, elf_symtab_read) (elf_rel_plt_read): Add "reader" argument. Update. (elf_read_minimal_symbols): Update. * dbxread.c (record_minimal_symbol, read_dbx_dynamic_symtab) (read_dbx_symtab): Add "reader" argument. Update. (dbx_symfile_read): Update. * coffread.c (record_minimal_symbol, coff_symtab_read): Add "reader" argument. Update. (coff_symfile_read): Update. * coff-pe-read.h (read_pe_exported_syms): Add "reader" argument. * coff-pe-read.c (add_pe_exported_sym, add_pe_forwarded_sym) (read_pe_exported_syms): Add "reader" argument. Update.
2016-09-22 22:25:08 +02:00
read_alphacoff_dynamic_symtab (reader, objfile->section_offsets, objfile);
/* Install any minimal symbols that have been collected as the current
minimal symbols for this objfile. */
reader.install ();
}
/* Perform any local cleanups required when we are done with a
particular objfile. */
static void
2000-07-30 03:48:28 +02:00
mipscoff_symfile_finish (struct objfile *objfile)
{
}
/* Alpha OSF/1 encapsulates the dynamic symbols in ELF format in a
* mipsread.c: Cleanup coding style. (mipscoff_new_init, mipscoff_symfile_init, mipscoff_symfile_read) (mipscoff_symfile_finish): Remove prototypes. * mips-tdep.c (mips_fetch_instruction, mips16_fetch_instruction) (mips_mdebug_frame_cache, mips16_scan_prologue) (mips32_scan_prologue, mips_stub_frame_cache) (heuristic_proc_start, heuristic_proc_desc) (mips_eabi_push_dummy_call, mips_n32n64_push_dummy_call) (mips_n32n64_return_value, mips_o32_push_dummy_call) (mips_o32_return_value, mips_o64_push_dummy_call) (mips_step_skips_delay, mips_skip_trampoline_code) (mips_gdbarch_init): Use MIPS_A0_REGNUM instead of A0_REGNUM, MIPS_RA_REGNUM instead of RA_REGNUM, MIPS_T9_REGNUM instead of T9_REGNUM, MIPS_V0_REGNUM instead of V0_REGNUM, MIPS_ZERO_REGNUM instead of ZERO_REGNUM, MIPS32_SIZE_INSN instead of MIPS_INSTLEN and MIPS16_INSN_SIZE instead of MIPS16_INSTLEN. (mips_dump_tdep): Don't print A0_REGNUM, RA_REGNUM, T9_REGNUM, V0_REGNUM, ZERO_REGNUM, MIPS_INSTLEN and MIPS16_INSTLEN. Use MIPS_A0_REGNUM instead of A0_REGNUM. * mips-linux-tdep.c (mips_linux_o32_sigframe_init) (mips_linux_n32n64_sigframe_init): Use MIPS_ZERO_REGNUM instead of ZERO_REGNUM. * mipsnbsd-tdep.c (mipsnbsd_cannot_fetch_register) (mipsnbsd_cannot_store_register): Use MIPS_ZERO_REGNUM instead of ZERO_REGNUM. (mipsnbsd_get_longjmp_target): Use MIPS_A0_REGNUM instead of A0_REGNUM. * mipsnbsd-nat.c: Include "mips-tdep.h". (getregs_supplies): Use MIPS_ZERO_REGNUM instead of ZERO_REGNUM. * Makefile.in (mipsnbsd-nat.o): Update dependencies.
2004-10-30 17:01:31 +02:00
standard COFF section. The ELF format for the symbols differs from
the format defined in elf/external.h. It seems that a normal ELF
32-bit format is used, and the representation only changes because
longs are 64-bit on the alpha. In addition, the handling of
* mipsread.c: Cleanup coding style. (mipscoff_new_init, mipscoff_symfile_init, mipscoff_symfile_read) (mipscoff_symfile_finish): Remove prototypes. * mips-tdep.c (mips_fetch_instruction, mips16_fetch_instruction) (mips_mdebug_frame_cache, mips16_scan_prologue) (mips32_scan_prologue, mips_stub_frame_cache) (heuristic_proc_start, heuristic_proc_desc) (mips_eabi_push_dummy_call, mips_n32n64_push_dummy_call) (mips_n32n64_return_value, mips_o32_push_dummy_call) (mips_o32_return_value, mips_o64_push_dummy_call) (mips_step_skips_delay, mips_skip_trampoline_code) (mips_gdbarch_init): Use MIPS_A0_REGNUM instead of A0_REGNUM, MIPS_RA_REGNUM instead of RA_REGNUM, MIPS_T9_REGNUM instead of T9_REGNUM, MIPS_V0_REGNUM instead of V0_REGNUM, MIPS_ZERO_REGNUM instead of ZERO_REGNUM, MIPS32_SIZE_INSN instead of MIPS_INSTLEN and MIPS16_INSN_SIZE instead of MIPS16_INSTLEN. (mips_dump_tdep): Don't print A0_REGNUM, RA_REGNUM, T9_REGNUM, V0_REGNUM, ZERO_REGNUM, MIPS_INSTLEN and MIPS16_INSTLEN. Use MIPS_A0_REGNUM instead of A0_REGNUM. * mips-linux-tdep.c (mips_linux_o32_sigframe_init) (mips_linux_n32n64_sigframe_init): Use MIPS_ZERO_REGNUM instead of ZERO_REGNUM. * mipsnbsd-tdep.c (mipsnbsd_cannot_fetch_register) (mipsnbsd_cannot_store_register): Use MIPS_ZERO_REGNUM instead of ZERO_REGNUM. (mipsnbsd_get_longjmp_target): Use MIPS_A0_REGNUM instead of A0_REGNUM. * mipsnbsd-nat.c: Include "mips-tdep.h". (getregs_supplies): Use MIPS_ZERO_REGNUM instead of ZERO_REGNUM. * Makefile.in (mipsnbsd-nat.o): Update dependencies.
2004-10-30 17:01:31 +02:00
text/data section indices for symbols is different from the ELF
ABI. As the BFD linker currently does not support dynamic linking
on the alpha, there seems to be no reason to pollute BFD with
another mixture of object file formats for now. */
/* Format of an alpha external ELF symbol. */
1999-07-07 22:19:36 +02:00
typedef struct
{
* mipsread.c: Cleanup coding style. (mipscoff_new_init, mipscoff_symfile_init, mipscoff_symfile_read) (mipscoff_symfile_finish): Remove prototypes. * mips-tdep.c (mips_fetch_instruction, mips16_fetch_instruction) (mips_mdebug_frame_cache, mips16_scan_prologue) (mips32_scan_prologue, mips_stub_frame_cache) (heuristic_proc_start, heuristic_proc_desc) (mips_eabi_push_dummy_call, mips_n32n64_push_dummy_call) (mips_n32n64_return_value, mips_o32_push_dummy_call) (mips_o32_return_value, mips_o64_push_dummy_call) (mips_step_skips_delay, mips_skip_trampoline_code) (mips_gdbarch_init): Use MIPS_A0_REGNUM instead of A0_REGNUM, MIPS_RA_REGNUM instead of RA_REGNUM, MIPS_T9_REGNUM instead of T9_REGNUM, MIPS_V0_REGNUM instead of V0_REGNUM, MIPS_ZERO_REGNUM instead of ZERO_REGNUM, MIPS32_SIZE_INSN instead of MIPS_INSTLEN and MIPS16_INSN_SIZE instead of MIPS16_INSTLEN. (mips_dump_tdep): Don't print A0_REGNUM, RA_REGNUM, T9_REGNUM, V0_REGNUM, ZERO_REGNUM, MIPS_INSTLEN and MIPS16_INSTLEN. Use MIPS_A0_REGNUM instead of A0_REGNUM. * mips-linux-tdep.c (mips_linux_o32_sigframe_init) (mips_linux_n32n64_sigframe_init): Use MIPS_ZERO_REGNUM instead of ZERO_REGNUM. * mipsnbsd-tdep.c (mipsnbsd_cannot_fetch_register) (mipsnbsd_cannot_store_register): Use MIPS_ZERO_REGNUM instead of ZERO_REGNUM. (mipsnbsd_get_longjmp_target): Use MIPS_A0_REGNUM instead of A0_REGNUM. * mipsnbsd-nat.c: Include "mips-tdep.h". (getregs_supplies): Use MIPS_ZERO_REGNUM instead of ZERO_REGNUM. * Makefile.in (mipsnbsd-nat.o): Update dependencies.
2004-10-30 17:01:31 +02:00
unsigned char st_name[4]; /* Symbol name, index in string table. */
unsigned char st_pad[4]; /* Pad to long word boundary. */
unsigned char st_value[8]; /* Value of the symbol. */
unsigned char st_size[4]; /* Associated symbol size. */
unsigned char st_info[1]; /* Type and binding attributes. */
unsigned char st_other[1]; /* No defined meaning, 0. */
unsigned char st_shndx[2]; /* Associated section index. */
} Elfalpha_External_Sym;
/* Format of an alpha external ELF dynamic info structure. */
1999-07-07 22:19:36 +02:00
typedef struct
* mipsread.c: Cleanup coding style. (mipscoff_new_init, mipscoff_symfile_init, mipscoff_symfile_read) (mipscoff_symfile_finish): Remove prototypes. * mips-tdep.c (mips_fetch_instruction, mips16_fetch_instruction) (mips_mdebug_frame_cache, mips16_scan_prologue) (mips32_scan_prologue, mips_stub_frame_cache) (heuristic_proc_start, heuristic_proc_desc) (mips_eabi_push_dummy_call, mips_n32n64_push_dummy_call) (mips_n32n64_return_value, mips_o32_push_dummy_call) (mips_o32_return_value, mips_o64_push_dummy_call) (mips_step_skips_delay, mips_skip_trampoline_code) (mips_gdbarch_init): Use MIPS_A0_REGNUM instead of A0_REGNUM, MIPS_RA_REGNUM instead of RA_REGNUM, MIPS_T9_REGNUM instead of T9_REGNUM, MIPS_V0_REGNUM instead of V0_REGNUM, MIPS_ZERO_REGNUM instead of ZERO_REGNUM, MIPS32_SIZE_INSN instead of MIPS_INSTLEN and MIPS16_INSN_SIZE instead of MIPS16_INSTLEN. (mips_dump_tdep): Don't print A0_REGNUM, RA_REGNUM, T9_REGNUM, V0_REGNUM, ZERO_REGNUM, MIPS_INSTLEN and MIPS16_INSTLEN. Use MIPS_A0_REGNUM instead of A0_REGNUM. * mips-linux-tdep.c (mips_linux_o32_sigframe_init) (mips_linux_n32n64_sigframe_init): Use MIPS_ZERO_REGNUM instead of ZERO_REGNUM. * mipsnbsd-tdep.c (mipsnbsd_cannot_fetch_register) (mipsnbsd_cannot_store_register): Use MIPS_ZERO_REGNUM instead of ZERO_REGNUM. (mipsnbsd_get_longjmp_target): Use MIPS_A0_REGNUM instead of A0_REGNUM. * mipsnbsd-nat.c: Include "mips-tdep.h". (getregs_supplies): Use MIPS_ZERO_REGNUM instead of ZERO_REGNUM. * Makefile.in (mipsnbsd-nat.o): Update dependencies.
2004-10-30 17:01:31 +02:00
{
unsigned char d_tag[4]; /* Tag. */
unsigned char d_pad[4]; /* Pad to long word boundary. */
union
1999-07-07 22:19:36 +02:00
{
* mipsread.c: Cleanup coding style. (mipscoff_new_init, mipscoff_symfile_init, mipscoff_symfile_read) (mipscoff_symfile_finish): Remove prototypes. * mips-tdep.c (mips_fetch_instruction, mips16_fetch_instruction) (mips_mdebug_frame_cache, mips16_scan_prologue) (mips32_scan_prologue, mips_stub_frame_cache) (heuristic_proc_start, heuristic_proc_desc) (mips_eabi_push_dummy_call, mips_n32n64_push_dummy_call) (mips_n32n64_return_value, mips_o32_push_dummy_call) (mips_o32_return_value, mips_o64_push_dummy_call) (mips_step_skips_delay, mips_skip_trampoline_code) (mips_gdbarch_init): Use MIPS_A0_REGNUM instead of A0_REGNUM, MIPS_RA_REGNUM instead of RA_REGNUM, MIPS_T9_REGNUM instead of T9_REGNUM, MIPS_V0_REGNUM instead of V0_REGNUM, MIPS_ZERO_REGNUM instead of ZERO_REGNUM, MIPS32_SIZE_INSN instead of MIPS_INSTLEN and MIPS16_INSN_SIZE instead of MIPS16_INSTLEN. (mips_dump_tdep): Don't print A0_REGNUM, RA_REGNUM, T9_REGNUM, V0_REGNUM, ZERO_REGNUM, MIPS_INSTLEN and MIPS16_INSTLEN. Use MIPS_A0_REGNUM instead of A0_REGNUM. * mips-linux-tdep.c (mips_linux_o32_sigframe_init) (mips_linux_n32n64_sigframe_init): Use MIPS_ZERO_REGNUM instead of ZERO_REGNUM. * mipsnbsd-tdep.c (mipsnbsd_cannot_fetch_register) (mipsnbsd_cannot_store_register): Use MIPS_ZERO_REGNUM instead of ZERO_REGNUM. (mipsnbsd_get_longjmp_target): Use MIPS_A0_REGNUM instead of A0_REGNUM. * mipsnbsd-nat.c: Include "mips-tdep.h". (getregs_supplies): Use MIPS_ZERO_REGNUM instead of ZERO_REGNUM. * Makefile.in (mipsnbsd-nat.o): Update dependencies.
2004-10-30 17:01:31 +02:00
unsigned char d_ptr[8]; /* Pointer value. */
unsigned char d_val[4]; /* Integer value. */
1999-07-07 22:19:36 +02:00
}
* mipsread.c: Cleanup coding style. (mipscoff_new_init, mipscoff_symfile_init, mipscoff_symfile_read) (mipscoff_symfile_finish): Remove prototypes. * mips-tdep.c (mips_fetch_instruction, mips16_fetch_instruction) (mips_mdebug_frame_cache, mips16_scan_prologue) (mips32_scan_prologue, mips_stub_frame_cache) (heuristic_proc_start, heuristic_proc_desc) (mips_eabi_push_dummy_call, mips_n32n64_push_dummy_call) (mips_n32n64_return_value, mips_o32_push_dummy_call) (mips_o32_return_value, mips_o64_push_dummy_call) (mips_step_skips_delay, mips_skip_trampoline_code) (mips_gdbarch_init): Use MIPS_A0_REGNUM instead of A0_REGNUM, MIPS_RA_REGNUM instead of RA_REGNUM, MIPS_T9_REGNUM instead of T9_REGNUM, MIPS_V0_REGNUM instead of V0_REGNUM, MIPS_ZERO_REGNUM instead of ZERO_REGNUM, MIPS32_SIZE_INSN instead of MIPS_INSTLEN and MIPS16_INSN_SIZE instead of MIPS16_INSTLEN. (mips_dump_tdep): Don't print A0_REGNUM, RA_REGNUM, T9_REGNUM, V0_REGNUM, ZERO_REGNUM, MIPS_INSTLEN and MIPS16_INSTLEN. Use MIPS_A0_REGNUM instead of A0_REGNUM. * mips-linux-tdep.c (mips_linux_o32_sigframe_init) (mips_linux_n32n64_sigframe_init): Use MIPS_ZERO_REGNUM instead of ZERO_REGNUM. * mipsnbsd-tdep.c (mipsnbsd_cannot_fetch_register) (mipsnbsd_cannot_store_register): Use MIPS_ZERO_REGNUM instead of ZERO_REGNUM. (mipsnbsd_get_longjmp_target): Use MIPS_A0_REGNUM instead of A0_REGNUM. * mipsnbsd-nat.c: Include "mips-tdep.h". (getregs_supplies): Use MIPS_ZERO_REGNUM instead of ZERO_REGNUM. * Makefile.in (mipsnbsd-nat.o): Update dependencies.
2004-10-30 17:01:31 +02:00
d_un;
} Elfalpha_External_Dyn;
/* Struct to obtain the section pointers for alpha dynamic symbol info. */
1999-07-07 22:19:36 +02:00
struct alphacoff_dynsecinfo
* mipsread.c: Cleanup coding style. (mipscoff_new_init, mipscoff_symfile_init, mipscoff_symfile_read) (mipscoff_symfile_finish): Remove prototypes. * mips-tdep.c (mips_fetch_instruction, mips16_fetch_instruction) (mips_mdebug_frame_cache, mips16_scan_prologue) (mips32_scan_prologue, mips_stub_frame_cache) (heuristic_proc_start, heuristic_proc_desc) (mips_eabi_push_dummy_call, mips_n32n64_push_dummy_call) (mips_n32n64_return_value, mips_o32_push_dummy_call) (mips_o32_return_value, mips_o64_push_dummy_call) (mips_step_skips_delay, mips_skip_trampoline_code) (mips_gdbarch_init): Use MIPS_A0_REGNUM instead of A0_REGNUM, MIPS_RA_REGNUM instead of RA_REGNUM, MIPS_T9_REGNUM instead of T9_REGNUM, MIPS_V0_REGNUM instead of V0_REGNUM, MIPS_ZERO_REGNUM instead of ZERO_REGNUM, MIPS32_SIZE_INSN instead of MIPS_INSTLEN and MIPS16_INSN_SIZE instead of MIPS16_INSTLEN. (mips_dump_tdep): Don't print A0_REGNUM, RA_REGNUM, T9_REGNUM, V0_REGNUM, ZERO_REGNUM, MIPS_INSTLEN and MIPS16_INSTLEN. Use MIPS_A0_REGNUM instead of A0_REGNUM. * mips-linux-tdep.c (mips_linux_o32_sigframe_init) (mips_linux_n32n64_sigframe_init): Use MIPS_ZERO_REGNUM instead of ZERO_REGNUM. * mipsnbsd-tdep.c (mipsnbsd_cannot_fetch_register) (mipsnbsd_cannot_store_register): Use MIPS_ZERO_REGNUM instead of ZERO_REGNUM. (mipsnbsd_get_longjmp_target): Use MIPS_A0_REGNUM instead of A0_REGNUM. * mipsnbsd-nat.c: Include "mips-tdep.h". (getregs_supplies): Use MIPS_ZERO_REGNUM instead of ZERO_REGNUM. * Makefile.in (mipsnbsd-nat.o): Update dependencies.
2004-10-30 17:01:31 +02:00
{
asection *sym_sect; /* Section pointer for .dynsym section. */
asection *str_sect; /* Section pointer for .dynstr section. */
asection *dyninfo_sect; /* Section pointer for .dynamic section. */
asection *got_sect; /* Section pointer for .got section. */
};
/* We are called once per section from read_alphacoff_dynamic_symtab.
* mipsread.c: Cleanup coding style. (mipscoff_new_init, mipscoff_symfile_init, mipscoff_symfile_read) (mipscoff_symfile_finish): Remove prototypes. * mips-tdep.c (mips_fetch_instruction, mips16_fetch_instruction) (mips_mdebug_frame_cache, mips16_scan_prologue) (mips32_scan_prologue, mips_stub_frame_cache) (heuristic_proc_start, heuristic_proc_desc) (mips_eabi_push_dummy_call, mips_n32n64_push_dummy_call) (mips_n32n64_return_value, mips_o32_push_dummy_call) (mips_o32_return_value, mips_o64_push_dummy_call) (mips_step_skips_delay, mips_skip_trampoline_code) (mips_gdbarch_init): Use MIPS_A0_REGNUM instead of A0_REGNUM, MIPS_RA_REGNUM instead of RA_REGNUM, MIPS_T9_REGNUM instead of T9_REGNUM, MIPS_V0_REGNUM instead of V0_REGNUM, MIPS_ZERO_REGNUM instead of ZERO_REGNUM, MIPS32_SIZE_INSN instead of MIPS_INSTLEN and MIPS16_INSN_SIZE instead of MIPS16_INSTLEN. (mips_dump_tdep): Don't print A0_REGNUM, RA_REGNUM, T9_REGNUM, V0_REGNUM, ZERO_REGNUM, MIPS_INSTLEN and MIPS16_INSTLEN. Use MIPS_A0_REGNUM instead of A0_REGNUM. * mips-linux-tdep.c (mips_linux_o32_sigframe_init) (mips_linux_n32n64_sigframe_init): Use MIPS_ZERO_REGNUM instead of ZERO_REGNUM. * mipsnbsd-tdep.c (mipsnbsd_cannot_fetch_register) (mipsnbsd_cannot_store_register): Use MIPS_ZERO_REGNUM instead of ZERO_REGNUM. (mipsnbsd_get_longjmp_target): Use MIPS_A0_REGNUM instead of A0_REGNUM. * mipsnbsd-nat.c: Include "mips-tdep.h". (getregs_supplies): Use MIPS_ZERO_REGNUM instead of ZERO_REGNUM. * Makefile.in (mipsnbsd-nat.o): Update dependencies.
2004-10-30 17:01:31 +02:00
We need to examine each section we are passed, check to see if it
is something we are interested in processing, and if so, stash away
some access information for the section. */
static void
alphacoff_locate_sections (bfd *ignore_abfd, asection *sectp, void *sip)
{
struct alphacoff_dynsecinfo *si;
si = (struct alphacoff_dynsecinfo *) sip;
* mipsread.c: Cleanup coding style. (mipscoff_new_init, mipscoff_symfile_init, mipscoff_symfile_read) (mipscoff_symfile_finish): Remove prototypes. * mips-tdep.c (mips_fetch_instruction, mips16_fetch_instruction) (mips_mdebug_frame_cache, mips16_scan_prologue) (mips32_scan_prologue, mips_stub_frame_cache) (heuristic_proc_start, heuristic_proc_desc) (mips_eabi_push_dummy_call, mips_n32n64_push_dummy_call) (mips_n32n64_return_value, mips_o32_push_dummy_call) (mips_o32_return_value, mips_o64_push_dummy_call) (mips_step_skips_delay, mips_skip_trampoline_code) (mips_gdbarch_init): Use MIPS_A0_REGNUM instead of A0_REGNUM, MIPS_RA_REGNUM instead of RA_REGNUM, MIPS_T9_REGNUM instead of T9_REGNUM, MIPS_V0_REGNUM instead of V0_REGNUM, MIPS_ZERO_REGNUM instead of ZERO_REGNUM, MIPS32_SIZE_INSN instead of MIPS_INSTLEN and MIPS16_INSN_SIZE instead of MIPS16_INSTLEN. (mips_dump_tdep): Don't print A0_REGNUM, RA_REGNUM, T9_REGNUM, V0_REGNUM, ZERO_REGNUM, MIPS_INSTLEN and MIPS16_INSTLEN. Use MIPS_A0_REGNUM instead of A0_REGNUM. * mips-linux-tdep.c (mips_linux_o32_sigframe_init) (mips_linux_n32n64_sigframe_init): Use MIPS_ZERO_REGNUM instead of ZERO_REGNUM. * mipsnbsd-tdep.c (mipsnbsd_cannot_fetch_register) (mipsnbsd_cannot_store_register): Use MIPS_ZERO_REGNUM instead of ZERO_REGNUM. (mipsnbsd_get_longjmp_target): Use MIPS_A0_REGNUM instead of A0_REGNUM. * mipsnbsd-nat.c: Include "mips-tdep.h". (getregs_supplies): Use MIPS_ZERO_REGNUM instead of ZERO_REGNUM. * Makefile.in (mipsnbsd-nat.o): Update dependencies.
2004-10-30 17:01:31 +02:00
if (strcmp (sectp->name, ".dynsym") == 0)
si->sym_sect = sectp;
else if (strcmp (sectp->name, ".dynstr") == 0)
si->str_sect = sectp;
else if (strcmp (sectp->name, ".dynamic") == 0)
si->dyninfo_sect = sectp;
else if (strcmp (sectp->name, ".got") == 0)
si->got_sect = sectp;
}
* mipsread.c: Cleanup coding style. (mipscoff_new_init, mipscoff_symfile_init, mipscoff_symfile_read) (mipscoff_symfile_finish): Remove prototypes. * mips-tdep.c (mips_fetch_instruction, mips16_fetch_instruction) (mips_mdebug_frame_cache, mips16_scan_prologue) (mips32_scan_prologue, mips_stub_frame_cache) (heuristic_proc_start, heuristic_proc_desc) (mips_eabi_push_dummy_call, mips_n32n64_push_dummy_call) (mips_n32n64_return_value, mips_o32_push_dummy_call) (mips_o32_return_value, mips_o64_push_dummy_call) (mips_step_skips_delay, mips_skip_trampoline_code) (mips_gdbarch_init): Use MIPS_A0_REGNUM instead of A0_REGNUM, MIPS_RA_REGNUM instead of RA_REGNUM, MIPS_T9_REGNUM instead of T9_REGNUM, MIPS_V0_REGNUM instead of V0_REGNUM, MIPS_ZERO_REGNUM instead of ZERO_REGNUM, MIPS32_SIZE_INSN instead of MIPS_INSTLEN and MIPS16_INSN_SIZE instead of MIPS16_INSTLEN. (mips_dump_tdep): Don't print A0_REGNUM, RA_REGNUM, T9_REGNUM, V0_REGNUM, ZERO_REGNUM, MIPS_INSTLEN and MIPS16_INSTLEN. Use MIPS_A0_REGNUM instead of A0_REGNUM. * mips-linux-tdep.c (mips_linux_o32_sigframe_init) (mips_linux_n32n64_sigframe_init): Use MIPS_ZERO_REGNUM instead of ZERO_REGNUM. * mipsnbsd-tdep.c (mipsnbsd_cannot_fetch_register) (mipsnbsd_cannot_store_register): Use MIPS_ZERO_REGNUM instead of ZERO_REGNUM. (mipsnbsd_get_longjmp_target): Use MIPS_A0_REGNUM instead of A0_REGNUM. * mipsnbsd-nat.c: Include "mips-tdep.h". (getregs_supplies): Use MIPS_ZERO_REGNUM instead of ZERO_REGNUM. * Makefile.in (mipsnbsd-nat.o): Update dependencies.
2004-10-30 17:01:31 +02:00
/* Scan an alpha dynamic symbol table for symbols of interest and add
them to the minimal symbol table. */
static void
Record minimal symbols directly in reader. This patch changes minimal symbol creation in two ways. First, it removes global variables in favor of members of minimal_symbol_reader. Second, it changes functions like prim_record_minimal_symbol to be member functions of minimal_symbol_reader. 2016-10-21 Tom Tromey <tom@tromey.com> * xcoffread.c (record_minimal_symbol, scan_xcoff_symtab): Add "reader" argument. Update. (xcoff_initial_scan): Update. * symfile.h (mdebug_build_psymtabs): Add "reader" argument. * mipsread.c (mipscoff_symfile_read): Update. (read_alphacoff_dynamic_symtab): Add "reader" argument. Update. * minsyms.h (minimal_symbol_reader) <record, record_full>: Declare. <m_msym_bunch, m_msym_bunch_index, m_msym_count>: New members. <record_with_info>: New function, renamed from prim_record_minimal_symbol_and_info. * minsyms.c (msym_bunch, msym_bunch_index, msym_count): Remove globals. (minimal_symbol_reader): Initialize new members. (minimal_symbol_reader::record): Renamed from prim_record_minimal_symbol. (minimal_symbol_reader::record_full): Renamed from prim_record_minimal_symbol_full. (prim_record_minimal_symbol_and_info): Move to minsyms.h; rename. * mdebugread.c (mdebug_build_psymtabs, parse_partial_symbols) (record_minimal_symbol): Add "reader" argument. Update. (elfmdebug_build_psymtabs): Update. * machoread.c (macho_symtab_add_minsym, macho_symtab_read): Add "reader" argument. Update. (macho_symfile_read): Update. * elfread.c (record_minimal_symbol, elf_symtab_read) (elf_rel_plt_read): Add "reader" argument. Update. (elf_read_minimal_symbols): Update. * dbxread.c (record_minimal_symbol, read_dbx_dynamic_symtab) (read_dbx_symtab): Add "reader" argument. Update. (dbx_symfile_read): Update. * coffread.c (record_minimal_symbol, coff_symtab_read): Add "reader" argument. Update. (coff_symfile_read): Update. * coff-pe-read.h (read_pe_exported_syms): Add "reader" argument. * coff-pe-read.c (add_pe_exported_sym, add_pe_forwarded_sym) (read_pe_exported_syms): Add "reader" argument. Update.
2016-09-22 22:25:08 +02:00
read_alphacoff_dynamic_symtab (minimal_symbol_reader &reader,
struct section_offsets *section_offsets,
2000-07-30 03:48:28 +02:00
struct objfile *objfile)
{
bfd *abfd = objfile->obfd;
struct alphacoff_dynsecinfo si;
int sym_count;
int i;
int stripped;
Elfalpha_External_Sym *x_symp;
gdb_byte *dyninfo_p;
gdb_byte *dyninfo_end;
int got_entry_size = 8;
int dt_mips_local_gotno = -1;
int dt_mips_gotsym = -1;
/* We currently only know how to handle alpha dynamic symbols. */
if (bfd_get_arch (abfd) != bfd_arch_alpha)
return;
/* Locate the dynamic symbols sections and read them in. */
memset ((char *) &si, 0, sizeof (si));
bfd_map_over_sections (abfd, alphacoff_locate_sections, (void *) & si);
* mipsread.c: Cleanup coding style. (mipscoff_new_init, mipscoff_symfile_init, mipscoff_symfile_read) (mipscoff_symfile_finish): Remove prototypes. * mips-tdep.c (mips_fetch_instruction, mips16_fetch_instruction) (mips_mdebug_frame_cache, mips16_scan_prologue) (mips32_scan_prologue, mips_stub_frame_cache) (heuristic_proc_start, heuristic_proc_desc) (mips_eabi_push_dummy_call, mips_n32n64_push_dummy_call) (mips_n32n64_return_value, mips_o32_push_dummy_call) (mips_o32_return_value, mips_o64_push_dummy_call) (mips_step_skips_delay, mips_skip_trampoline_code) (mips_gdbarch_init): Use MIPS_A0_REGNUM instead of A0_REGNUM, MIPS_RA_REGNUM instead of RA_REGNUM, MIPS_T9_REGNUM instead of T9_REGNUM, MIPS_V0_REGNUM instead of V0_REGNUM, MIPS_ZERO_REGNUM instead of ZERO_REGNUM, MIPS32_SIZE_INSN instead of MIPS_INSTLEN and MIPS16_INSN_SIZE instead of MIPS16_INSTLEN. (mips_dump_tdep): Don't print A0_REGNUM, RA_REGNUM, T9_REGNUM, V0_REGNUM, ZERO_REGNUM, MIPS_INSTLEN and MIPS16_INSTLEN. Use MIPS_A0_REGNUM instead of A0_REGNUM. * mips-linux-tdep.c (mips_linux_o32_sigframe_init) (mips_linux_n32n64_sigframe_init): Use MIPS_ZERO_REGNUM instead of ZERO_REGNUM. * mipsnbsd-tdep.c (mipsnbsd_cannot_fetch_register) (mipsnbsd_cannot_store_register): Use MIPS_ZERO_REGNUM instead of ZERO_REGNUM. (mipsnbsd_get_longjmp_target): Use MIPS_A0_REGNUM instead of A0_REGNUM. * mipsnbsd-nat.c: Include "mips-tdep.h". (getregs_supplies): Use MIPS_ZERO_REGNUM instead of ZERO_REGNUM. * Makefile.in (mipsnbsd-nat.o): Update dependencies.
2004-10-30 17:01:31 +02:00
if (si.sym_sect == NULL || si.str_sect == NULL
|| si.dyninfo_sect == NULL || si.got_sect == NULL)
return;
gdb::byte_vector sym_sec (bfd_get_section_size (si.sym_sect));
gdb::byte_vector str_sec (bfd_get_section_size (si.str_sect));
gdb::byte_vector dyninfo_sec (bfd_get_section_size (si.dyninfo_sect));
gdb::byte_vector got_sec (bfd_get_section_size (si.got_sect));
if (!bfd_get_section_contents (abfd, si.sym_sect, sym_sec.data (),
(file_ptr) 0, sym_sec.size ()))
return;
if (!bfd_get_section_contents (abfd, si.str_sect, str_sec.data (),
(file_ptr) 0, str_sec.size ()))
return;
if (!bfd_get_section_contents (abfd, si.dyninfo_sect, dyninfo_sec.data (),
(file_ptr) 0, dyninfo_sec.size ()))
return;
if (!bfd_get_section_contents (abfd, si.got_sect, got_sec.data (),
(file_ptr) 0, got_sec.size ()))
return;
gdb * windows-tdep.c (windows_xfer_shared_library): * windows-nat.c (get_module_name, windows_make_so): * v850-tdep.c (v850_handle_pushm): * utils.c (null_cleanup, gdb_realpath): * ui-out.c (get_next_header): * tracepoint.c (clear_traceframe_info): * symtab.c (lookup_symtab): * serial.h (struct serial_ops): * mipsread.c (read_alphacoff_dynamic_symtab): * infcmd.c (print_return_value): * ia64-linux-tdep.c (ia64_linux_sigcontext_register_address): * f-exp.y (parse_number): * exceptions.c (catch_exceptions): * dummy-frame.c (dummy_frame_this_id): * defs.h (struct cleanup): * breakpoint.c (disable_breakpoints_in_unloaded_shlib): * arm-tdep.c (arm_push_dummy_call): * amd64-tdep.h (amd64_collect_xsave): * amd64-tdep.c (amd64_collect_xsave): * alpha-tdep.c (alpha_heuristic_frame_unwind_cache): * README (typing): Remove duplicate words. * cli/cli-decode.c (lookup_cmd_composition): Add comma. * infrun.c (siginfo_value_read): Fix typo. * solib-frv.c (frv_fdpic_find_global_pointer): Likewise. * top.c (source_line_number): Add comma. gdb/doc * gdbint.texinfo (Register Information Functions): Remove duplicate "the". * gdb.texinfo (Emacs): Remove duplicate "to". (GDB/MI Variable Objects): Remove duplicate "the". (General Query Packets): Likewise. gdb/testsuite * gdb.mi/mi-nsmoribund.exp: * gdb.hp/gdb.objdbg/objdbg01.exp: * gdb.base/structs.exp (test_struct_returns): * gdb.base/call-sc.exp (test_scalar_returns): * gdb.base/bigcore.exp: Remove duplicate words. gdb/gdbserver * win32-low.c (handle_load_dll): Remove duplicate "the".
2011-04-19 20:04:11 +02:00
/* Find the number of local GOT entries and the index for the
* mipsread.c: Cleanup coding style. (mipscoff_new_init, mipscoff_symfile_init, mipscoff_symfile_read) (mipscoff_symfile_finish): Remove prototypes. * mips-tdep.c (mips_fetch_instruction, mips16_fetch_instruction) (mips_mdebug_frame_cache, mips16_scan_prologue) (mips32_scan_prologue, mips_stub_frame_cache) (heuristic_proc_start, heuristic_proc_desc) (mips_eabi_push_dummy_call, mips_n32n64_push_dummy_call) (mips_n32n64_return_value, mips_o32_push_dummy_call) (mips_o32_return_value, mips_o64_push_dummy_call) (mips_step_skips_delay, mips_skip_trampoline_code) (mips_gdbarch_init): Use MIPS_A0_REGNUM instead of A0_REGNUM, MIPS_RA_REGNUM instead of RA_REGNUM, MIPS_T9_REGNUM instead of T9_REGNUM, MIPS_V0_REGNUM instead of V0_REGNUM, MIPS_ZERO_REGNUM instead of ZERO_REGNUM, MIPS32_SIZE_INSN instead of MIPS_INSTLEN and MIPS16_INSN_SIZE instead of MIPS16_INSTLEN. (mips_dump_tdep): Don't print A0_REGNUM, RA_REGNUM, T9_REGNUM, V0_REGNUM, ZERO_REGNUM, MIPS_INSTLEN and MIPS16_INSTLEN. Use MIPS_A0_REGNUM instead of A0_REGNUM. * mips-linux-tdep.c (mips_linux_o32_sigframe_init) (mips_linux_n32n64_sigframe_init): Use MIPS_ZERO_REGNUM instead of ZERO_REGNUM. * mipsnbsd-tdep.c (mipsnbsd_cannot_fetch_register) (mipsnbsd_cannot_store_register): Use MIPS_ZERO_REGNUM instead of ZERO_REGNUM. (mipsnbsd_get_longjmp_target): Use MIPS_A0_REGNUM instead of A0_REGNUM. * mipsnbsd-nat.c: Include "mips-tdep.h". (getregs_supplies): Use MIPS_ZERO_REGNUM instead of ZERO_REGNUM. * Makefile.in (mipsnbsd-nat.o): Update dependencies.
2004-10-30 17:01:31 +02:00
first dynamic symbol in the GOT. */
for ((dyninfo_p = dyninfo_sec.data (),
dyninfo_end = dyninfo_p + dyninfo_sec.size ());
dyninfo_p < dyninfo_end;
dyninfo_p += sizeof (Elfalpha_External_Dyn))
{
1999-07-07 22:19:36 +02:00
Elfalpha_External_Dyn *x_dynp = (Elfalpha_External_Dyn *) dyninfo_p;
long dyn_tag;
dyn_tag = bfd_h_get_32 (abfd, (bfd_byte *) x_dynp->d_tag);
if (dyn_tag == DT_NULL)
break;
else if (dyn_tag == DT_MIPS_LOCAL_GOTNO)
{
if (dt_mips_local_gotno < 0)
dt_mips_local_gotno
= bfd_h_get_32 (abfd, (bfd_byte *) x_dynp->d_un.d_val);
}
else if (dyn_tag == DT_MIPS_GOTSYM)
{
if (dt_mips_gotsym < 0)
dt_mips_gotsym
= bfd_h_get_32 (abfd, (bfd_byte *) x_dynp->d_un.d_val);
}
}
if (dt_mips_local_gotno < 0 || dt_mips_gotsym < 0)
return;
* mipsread.c: Cleanup coding style. (mipscoff_new_init, mipscoff_symfile_init, mipscoff_symfile_read) (mipscoff_symfile_finish): Remove prototypes. * mips-tdep.c (mips_fetch_instruction, mips16_fetch_instruction) (mips_mdebug_frame_cache, mips16_scan_prologue) (mips32_scan_prologue, mips_stub_frame_cache) (heuristic_proc_start, heuristic_proc_desc) (mips_eabi_push_dummy_call, mips_n32n64_push_dummy_call) (mips_n32n64_return_value, mips_o32_push_dummy_call) (mips_o32_return_value, mips_o64_push_dummy_call) (mips_step_skips_delay, mips_skip_trampoline_code) (mips_gdbarch_init): Use MIPS_A0_REGNUM instead of A0_REGNUM, MIPS_RA_REGNUM instead of RA_REGNUM, MIPS_T9_REGNUM instead of T9_REGNUM, MIPS_V0_REGNUM instead of V0_REGNUM, MIPS_ZERO_REGNUM instead of ZERO_REGNUM, MIPS32_SIZE_INSN instead of MIPS_INSTLEN and MIPS16_INSN_SIZE instead of MIPS16_INSTLEN. (mips_dump_tdep): Don't print A0_REGNUM, RA_REGNUM, T9_REGNUM, V0_REGNUM, ZERO_REGNUM, MIPS_INSTLEN and MIPS16_INSTLEN. Use MIPS_A0_REGNUM instead of A0_REGNUM. * mips-linux-tdep.c (mips_linux_o32_sigframe_init) (mips_linux_n32n64_sigframe_init): Use MIPS_ZERO_REGNUM instead of ZERO_REGNUM. * mipsnbsd-tdep.c (mipsnbsd_cannot_fetch_register) (mipsnbsd_cannot_store_register): Use MIPS_ZERO_REGNUM instead of ZERO_REGNUM. (mipsnbsd_get_longjmp_target): Use MIPS_A0_REGNUM instead of A0_REGNUM. * mipsnbsd-nat.c: Include "mips-tdep.h". (getregs_supplies): Use MIPS_ZERO_REGNUM instead of ZERO_REGNUM. * Makefile.in (mipsnbsd-nat.o): Update dependencies.
2004-10-30 17:01:31 +02:00
/* Scan all dynamic symbols and enter them into the minimal symbol
table if appropriate. */
sym_count = sym_sec.size () / sizeof (Elfalpha_External_Sym);
stripped = (bfd_get_symcount (abfd) == 0);
/* Skip first symbol, which is a null dummy. */
for (i = 1, x_symp = (Elfalpha_External_Sym *) sym_sec.data () + 1;
i < sym_count;
i++, x_symp++)
{
unsigned long strx;
char *name;
bfd_vma sym_value;
unsigned char sym_info;
unsigned int sym_shndx;
int isglobal;
enum minimal_symbol_type ms_type;
strx = bfd_h_get_32 (abfd, (bfd_byte *) x_symp->st_name);
if (strx >= str_sec.size ())
continue;
name = (char *) (str_sec.data () + strx);
if (*name == '\0' || *name == '.')
continue;
sym_value = bfd_h_get_64 (abfd, (bfd_byte *) x_symp->st_value);
sym_info = bfd_h_get_8 (abfd, (bfd_byte *) x_symp->st_info);
sym_shndx = bfd_h_get_16 (abfd, (bfd_byte *) x_symp->st_shndx);
include/elf/ PR 5900 * common.h (SHN_BAD): Delete. (SHN_LORESERVE .. SHN_HIRESERVE): Move to.. * external.h: ..here. * internal.h (SHN_LORESERVE, SHN_HIRESERVE): Define. (SHN_LOPROC, SHN_HIPROC, SHN_LOOS, SHN_HIOS): Define. (SHN_ABS, SHN_COMMON, SHN_XINDEX, SHN_BAD): Define. bfd/ PR 5900 * elf-bfd.h: Include elf/internal.h after elf/external.h. * elfcode.h (elf_swap_symbol_in): Map reserved shndx range. (elf_swap_symbol_out): Adjust SHN_XINDEX test. (elf_swap_ehdr_out): Mask SHN_LORESERVE and SHN_XINDEX to values seen in external structs. (valid_section_index_p): Delete. (elf_object_p): Don't increment section numbers over reserved range. Simplify test for valid sh_link, sh_info and e_shstrndx fields. (elf_write_shdrs_and_ehdr): Mask SHN_LORESERVE and SHN_XINDEX to values seen in external structs. Don't increment section numbers over reserved range. * elf.c (bfd_elf_sym_name): Remove redundant tests on st_shndx. (bfd_section_from_shdr): Likewise. (group_signature): Range check before accessing elf_elfsections. (_bfd_elf_setup_sections): Likewise. (bfd_section_from_shdr): Likewise. (bfd_section_from_shdr): Don't increment section number over reserved sections. (assign_file_positions_for_non_load_sections): Likewise. (assign_file_positions_except_relocs): Likewise. (_bfd_elf_write_object_contents): Likewise. (assign_section_numbers): Likewise. Adjust for changed SHN_*. (prep_headers): Delete unused variable. * elflink.c (bfd_elf_link_record_local_dynamic_symbol): Adjust for changed SHN_* values. (check_dynsym, elf_link_input_bfd): Likewise. (bfd_elf_final_link): Likewise. Don't skip over reserved section range. (elf_fixup_link_order): Check that sh_link field is valid. * elf-hppa.h (elf_hppa_add_symbol_hook): Make "index" unsigned. * elf32-arm.c (elf32_arm_gc_mark_extra_sections): Range check before accesssing elf_elfsections. * elf32-avr.c (elf32_avr_size_stubs): Likewise. * elf32-hppa.c (elf32_hppa_size_stubs): Likewise. * elf32-m68hc1x.c (elf32_m68hc11_size_stubs): Likewise. * elf64-hppa.c (elf64_hppa_check_relocs): Adjust for changed SHN_* defines. Test for SHN_BAD return from _bfd_elf_section_from_bfd_section binutils/ PR 5900 * readelf.c (SECTION_HEADER_INDEX, SECTION_HEADER_NUM): Delete. Remove use throughout file. (SECTION_HEADER): Likewise. (dump_relocations): Don't adjust st_shndx for reserved range. (process_file_header): Mask SHN_XINDEX to values seen in external elf structs. Simplify valid section index tests. (get_32bit_elf_symbols, get_64bit_elf_symbols): Mask SHN_XINDEX. Map reserved st_shndx to internal form. (process_section_groups): Test that group symbol st_shndx is in range, not just non-zero. Delete reserved range check. (get_symbol_index_type): Mask "type" to 16 bits when printing PRC, OS or RSV. gdb/ PR 5900 * elfread.c (elf_symtab_read): Make shndx an unsigned int. * mipsread.c: Include elf/internal.h. (read_alphacoff_dynamic_symtab): Map external reserved sym_shndx to internal range. ld/testsuite/ PR 5900 * ld-elf/sec64k.exp: Update.
2008-03-12 09:37:09 +01:00
if (sym_shndx >= (SHN_LORESERVE & 0xffff))
sym_shndx += SHN_LORESERVE - (SHN_LORESERVE & 0xffff);
isglobal = (ELF_ST_BIND (sym_info) == STB_GLOBAL);
if (sym_shndx == SHN_UNDEF)
{
/* Handle undefined functions which are defined in a shared
library. */
if (ELF_ST_TYPE (sym_info) != STT_FUNC
|| ELF_ST_BIND (sym_info) != STB_GLOBAL)
continue;
ms_type = mst_solib_trampoline;
/* If sym_value is nonzero, it points to the shared library
trampoline entry, which is what we are looking for.
If sym_value is zero, then we have to get the GOT entry
for the symbol.
* mipsread.c: Cleanup coding style. (mipscoff_new_init, mipscoff_symfile_init, mipscoff_symfile_read) (mipscoff_symfile_finish): Remove prototypes. * mips-tdep.c (mips_fetch_instruction, mips16_fetch_instruction) (mips_mdebug_frame_cache, mips16_scan_prologue) (mips32_scan_prologue, mips_stub_frame_cache) (heuristic_proc_start, heuristic_proc_desc) (mips_eabi_push_dummy_call, mips_n32n64_push_dummy_call) (mips_n32n64_return_value, mips_o32_push_dummy_call) (mips_o32_return_value, mips_o64_push_dummy_call) (mips_step_skips_delay, mips_skip_trampoline_code) (mips_gdbarch_init): Use MIPS_A0_REGNUM instead of A0_REGNUM, MIPS_RA_REGNUM instead of RA_REGNUM, MIPS_T9_REGNUM instead of T9_REGNUM, MIPS_V0_REGNUM instead of V0_REGNUM, MIPS_ZERO_REGNUM instead of ZERO_REGNUM, MIPS32_SIZE_INSN instead of MIPS_INSTLEN and MIPS16_INSN_SIZE instead of MIPS16_INSTLEN. (mips_dump_tdep): Don't print A0_REGNUM, RA_REGNUM, T9_REGNUM, V0_REGNUM, ZERO_REGNUM, MIPS_INSTLEN and MIPS16_INSTLEN. Use MIPS_A0_REGNUM instead of A0_REGNUM. * mips-linux-tdep.c (mips_linux_o32_sigframe_init) (mips_linux_n32n64_sigframe_init): Use MIPS_ZERO_REGNUM instead of ZERO_REGNUM. * mipsnbsd-tdep.c (mipsnbsd_cannot_fetch_register) (mipsnbsd_cannot_store_register): Use MIPS_ZERO_REGNUM instead of ZERO_REGNUM. (mipsnbsd_get_longjmp_target): Use MIPS_A0_REGNUM instead of A0_REGNUM. * mipsnbsd-nat.c: Include "mips-tdep.h". (getregs_supplies): Use MIPS_ZERO_REGNUM instead of ZERO_REGNUM. * Makefile.in (mipsnbsd-nat.o): Update dependencies.
2004-10-30 17:01:31 +02:00
If the GOT entry is nonzero, it represents the quickstart
address of the function and we use that as the symbol
value.
If the GOT entry is zero, the function address has to be
resolved by the runtime loader before the executable is
started. We are unable to find any meaningful address
for these functions in the executable file, so we skip
them. */
if (sym_value == 0)
{
int got_entry_offset =
* mipsread.c: Cleanup coding style. (mipscoff_new_init, mipscoff_symfile_init, mipscoff_symfile_read) (mipscoff_symfile_finish): Remove prototypes. * mips-tdep.c (mips_fetch_instruction, mips16_fetch_instruction) (mips_mdebug_frame_cache, mips16_scan_prologue) (mips32_scan_prologue, mips_stub_frame_cache) (heuristic_proc_start, heuristic_proc_desc) (mips_eabi_push_dummy_call, mips_n32n64_push_dummy_call) (mips_n32n64_return_value, mips_o32_push_dummy_call) (mips_o32_return_value, mips_o64_push_dummy_call) (mips_step_skips_delay, mips_skip_trampoline_code) (mips_gdbarch_init): Use MIPS_A0_REGNUM instead of A0_REGNUM, MIPS_RA_REGNUM instead of RA_REGNUM, MIPS_T9_REGNUM instead of T9_REGNUM, MIPS_V0_REGNUM instead of V0_REGNUM, MIPS_ZERO_REGNUM instead of ZERO_REGNUM, MIPS32_SIZE_INSN instead of MIPS_INSTLEN and MIPS16_INSN_SIZE instead of MIPS16_INSTLEN. (mips_dump_tdep): Don't print A0_REGNUM, RA_REGNUM, T9_REGNUM, V0_REGNUM, ZERO_REGNUM, MIPS_INSTLEN and MIPS16_INSTLEN. Use MIPS_A0_REGNUM instead of A0_REGNUM. * mips-linux-tdep.c (mips_linux_o32_sigframe_init) (mips_linux_n32n64_sigframe_init): Use MIPS_ZERO_REGNUM instead of ZERO_REGNUM. * mipsnbsd-tdep.c (mipsnbsd_cannot_fetch_register) (mipsnbsd_cannot_store_register): Use MIPS_ZERO_REGNUM instead of ZERO_REGNUM. (mipsnbsd_get_longjmp_target): Use MIPS_A0_REGNUM instead of A0_REGNUM. * mipsnbsd-nat.c: Include "mips-tdep.h". (getregs_supplies): Use MIPS_ZERO_REGNUM instead of ZERO_REGNUM. * Makefile.in (mipsnbsd-nat.o): Update dependencies.
2004-10-30 17:01:31 +02:00
(i - dt_mips_gotsym + dt_mips_local_gotno) * got_entry_size;
if (got_entry_offset < 0
|| got_entry_offset >= got_sec.size ())
continue;
sym_value =
bfd_h_get_64 (abfd,
(bfd_byte *) (got_sec.data ()
+ got_entry_offset));
if (sym_value == 0)
continue;
}
}
else
{
/* Symbols defined in the executable itself. We only care
* mipsread.c: Cleanup coding style. (mipscoff_new_init, mipscoff_symfile_init, mipscoff_symfile_read) (mipscoff_symfile_finish): Remove prototypes. * mips-tdep.c (mips_fetch_instruction, mips16_fetch_instruction) (mips_mdebug_frame_cache, mips16_scan_prologue) (mips32_scan_prologue, mips_stub_frame_cache) (heuristic_proc_start, heuristic_proc_desc) (mips_eabi_push_dummy_call, mips_n32n64_push_dummy_call) (mips_n32n64_return_value, mips_o32_push_dummy_call) (mips_o32_return_value, mips_o64_push_dummy_call) (mips_step_skips_delay, mips_skip_trampoline_code) (mips_gdbarch_init): Use MIPS_A0_REGNUM instead of A0_REGNUM, MIPS_RA_REGNUM instead of RA_REGNUM, MIPS_T9_REGNUM instead of T9_REGNUM, MIPS_V0_REGNUM instead of V0_REGNUM, MIPS_ZERO_REGNUM instead of ZERO_REGNUM, MIPS32_SIZE_INSN instead of MIPS_INSTLEN and MIPS16_INSN_SIZE instead of MIPS16_INSTLEN. (mips_dump_tdep): Don't print A0_REGNUM, RA_REGNUM, T9_REGNUM, V0_REGNUM, ZERO_REGNUM, MIPS_INSTLEN and MIPS16_INSTLEN. Use MIPS_A0_REGNUM instead of A0_REGNUM. * mips-linux-tdep.c (mips_linux_o32_sigframe_init) (mips_linux_n32n64_sigframe_init): Use MIPS_ZERO_REGNUM instead of ZERO_REGNUM. * mipsnbsd-tdep.c (mipsnbsd_cannot_fetch_register) (mipsnbsd_cannot_store_register): Use MIPS_ZERO_REGNUM instead of ZERO_REGNUM. (mipsnbsd_get_longjmp_target): Use MIPS_A0_REGNUM instead of A0_REGNUM. * mipsnbsd-nat.c: Include "mips-tdep.h". (getregs_supplies): Use MIPS_ZERO_REGNUM instead of ZERO_REGNUM. * Makefile.in (mipsnbsd-nat.o): Update dependencies.
2004-10-30 17:01:31 +02:00
about them if this is a stripped executable, otherwise
they have been retrieved from the normal symbol table
already. */
if (!stripped)
continue;
if (sym_shndx == SHN_MIPS_TEXT)
{
if (isglobal)
ms_type = mst_text;
else
ms_type = mst_file_text;
}
else if (sym_shndx == SHN_MIPS_DATA)
{
if (isglobal)
ms_type = mst_data;
else
ms_type = mst_file_data;
}
else if (sym_shndx == SHN_MIPS_ACOMMON)
{
if (isglobal)
ms_type = mst_bss;
else
ms_type = mst_file_bss;
}
else if (sym_shndx == SHN_ABS)
{
ms_type = mst_abs;
}
else
{
continue;
}
}
Record minimal symbols directly in reader. This patch changes minimal symbol creation in two ways. First, it removes global variables in favor of members of minimal_symbol_reader. Second, it changes functions like prim_record_minimal_symbol to be member functions of minimal_symbol_reader. 2016-10-21 Tom Tromey <tom@tromey.com> * xcoffread.c (record_minimal_symbol, scan_xcoff_symtab): Add "reader" argument. Update. (xcoff_initial_scan): Update. * symfile.h (mdebug_build_psymtabs): Add "reader" argument. * mipsread.c (mipscoff_symfile_read): Update. (read_alphacoff_dynamic_symtab): Add "reader" argument. Update. * minsyms.h (minimal_symbol_reader) <record, record_full>: Declare. <m_msym_bunch, m_msym_bunch_index, m_msym_count>: New members. <record_with_info>: New function, renamed from prim_record_minimal_symbol_and_info. * minsyms.c (msym_bunch, msym_bunch_index, msym_count): Remove globals. (minimal_symbol_reader): Initialize new members. (minimal_symbol_reader::record): Renamed from prim_record_minimal_symbol. (minimal_symbol_reader::record_full): Renamed from prim_record_minimal_symbol_full. (prim_record_minimal_symbol_and_info): Move to minsyms.h; rename. * mdebugread.c (mdebug_build_psymtabs, parse_partial_symbols) (record_minimal_symbol): Add "reader" argument. Update. (elfmdebug_build_psymtabs): Update. * machoread.c (macho_symtab_add_minsym, macho_symtab_read): Add "reader" argument. Update. (macho_symfile_read): Update. * elfread.c (record_minimal_symbol, elf_symtab_read) (elf_rel_plt_read): Add "reader" argument. Update. (elf_read_minimal_symbols): Update. * dbxread.c (record_minimal_symbol, read_dbx_dynamic_symtab) (read_dbx_symtab): Add "reader" argument. Update. (dbx_symfile_read): Update. * coffread.c (record_minimal_symbol, coff_symtab_read): Add "reader" argument. Update. (coff_symfile_read): Update. * coff-pe-read.h (read_pe_exported_syms): Add "reader" argument. * coff-pe-read.c (add_pe_exported_sym, add_pe_forwarded_sym) (read_pe_exported_syms): Add "reader" argument. Update.
2016-09-22 22:25:08 +02:00
reader.record (name, sym_value, ms_type);
}
}
* mipsread.c: Cleanup coding style. (mipscoff_new_init, mipscoff_symfile_init, mipscoff_symfile_read) (mipscoff_symfile_finish): Remove prototypes. * mips-tdep.c (mips_fetch_instruction, mips16_fetch_instruction) (mips_mdebug_frame_cache, mips16_scan_prologue) (mips32_scan_prologue, mips_stub_frame_cache) (heuristic_proc_start, heuristic_proc_desc) (mips_eabi_push_dummy_call, mips_n32n64_push_dummy_call) (mips_n32n64_return_value, mips_o32_push_dummy_call) (mips_o32_return_value, mips_o64_push_dummy_call) (mips_step_skips_delay, mips_skip_trampoline_code) (mips_gdbarch_init): Use MIPS_A0_REGNUM instead of A0_REGNUM, MIPS_RA_REGNUM instead of RA_REGNUM, MIPS_T9_REGNUM instead of T9_REGNUM, MIPS_V0_REGNUM instead of V0_REGNUM, MIPS_ZERO_REGNUM instead of ZERO_REGNUM, MIPS32_SIZE_INSN instead of MIPS_INSTLEN and MIPS16_INSN_SIZE instead of MIPS16_INSTLEN. (mips_dump_tdep): Don't print A0_REGNUM, RA_REGNUM, T9_REGNUM, V0_REGNUM, ZERO_REGNUM, MIPS_INSTLEN and MIPS16_INSTLEN. Use MIPS_A0_REGNUM instead of A0_REGNUM. * mips-linux-tdep.c (mips_linux_o32_sigframe_init) (mips_linux_n32n64_sigframe_init): Use MIPS_ZERO_REGNUM instead of ZERO_REGNUM. * mipsnbsd-tdep.c (mipsnbsd_cannot_fetch_register) (mipsnbsd_cannot_store_register): Use MIPS_ZERO_REGNUM instead of ZERO_REGNUM. (mipsnbsd_get_longjmp_target): Use MIPS_A0_REGNUM instead of A0_REGNUM. * mipsnbsd-nat.c: Include "mips-tdep.h". (getregs_supplies): Use MIPS_ZERO_REGNUM instead of ZERO_REGNUM. * Makefile.in (mipsnbsd-nat.o): Update dependencies.
2004-10-30 17:01:31 +02:00
/* Initialization. */
static const struct sym_fns ecoff_sym_fns =
{
mipscoff_new_init, /* init anything gbl to entire symtab */
mipscoff_symfile_init, /* read initial info, setup for sym_read() */
mipscoff_symfile_read, /* read a symbol file into symtab */
* xcoffread.c (xcoff_sym_fns): Update. * symfile.h (struct sym_fns) <sym_read_psymbols>: New field. (enum symfile_add_flags) <SYMFILE_NO_READ>: New constant. * symfile.c (syms_from_objfile): Handle SYMFILE_NO_READ. (symbol_file_add_with_addrs_or_offsets): Likewise. (reread_symbols): Handle OBJF_PSYMTABS_READ. * somread.c (som_sym_fns): Update. * psymtab.h (require_partial_symbols): Declare. * psymtab.c (require_partial_symbols): New function. (ALL_OBJFILE_PSYMTABS_REQUIRED): New macro. (ALL_OBJFILE_PSYMTABS): Undef. (ALL_PSYMTABS): Move from psympriv.h. (lookup_partial_symtab, find_pc_sect_psymtab) (lookup_symbol_aux_psymtabs, relocate_psymtabs) (find_last_source_symtab_from_partial) (forget_cached_source_info_partial) (print_psymtab_stats_for_objfile, read_symtabs_for_function) (expand_partial_symbol_tables, read_psymtabs_with_filename) (map_symbol_names_psymtab, map_symbol_filenames_psymtab) (find_symbol_file_from_partial, map_matching_symbols_psymtab) (expand_symtabs_matching_via_partial, maintenance_info_psymtabs): Use ALL_OBJFILE_PSYMTABS_REQUIRED. * psympriv.h (ALL_PSYMTABS): Move to psymtab.c. * objfiles.h (OBJF_PSYMTABS_READ): New macro. * objfiles.c (objfile_has_partial_symbols): Handle lazily-read psymtabs. * mipsread.c (ecoff_sym_fns): Update. * machoread.c (macho_sym_fns): Update. * elfread.c (elf_symfile_read): Set up for lazy psymtab reading. (read_psyms): New function. (elf_sym_fns, elf_sym_fns_gdb_index): Update. (elf_sym_fns_lazy_psyms): New global. * dwarf2read.c (dwarf2_initialize_objfile): Don't call dwarf2_build_psymtabs. * dbxread.c (aout_sym_fns): Update. * coffread.c (coff_sym_fns): Update.
2011-03-07 17:17:29 +01:00
NULL, /* sym_read_psymbols */
mipscoff_symfile_finish, /* finished with file, cleanup */
default_symfile_offsets, /* dummy FIXME til implem sym reloc */
default_symfile_segments, /* Get segment information from a file. */
NULL,
default_symfile_relocate, /* Relocate a debug section. */
2012-04-27 Sergio Durigan Junior <sergiodj@redhat.com> Tom Tromey <tromey@redhat.com> Jan Kratochvil <jan.kratochvil@redhat.com> * Makefile.in (SFILES): Add `probe' and `stap-probe'. (COMMON_OBS): Likewise. (HFILES_NO_SRCDIR): Add `probe'. * NEWS: Mention support for static and SystemTap probes. * amd64-tdep.c (amd64_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * arm-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (arm_stap_is_single_operand): New function. (arm_stap_parse_special_token): Likewise. (arm_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * ax-gdb.c (require_rvalue): Removing static declaration. (gen_expr): Likewise. * ax-gdb.h (gen_expr): Declaring function. (require_rvalue): Likewise. * breakpoint.c: Include `gdb_regex.h' and `probe.h'. (bkpt_probe_breakpoint_ops): New variable. (momentary_breakpoint_from_master): Set the `probe' value. (add_location_to_breakpoint): Likewise. (break_command_1): Using proper breakpoint_ops according to the argument passed by the user in the command line. (bkpt_probe_insert_location): New function. (bkpt_probe_remove_location): Likewise. (bkpt_probe_create_sals_from_address): Likewise. (bkpt_probe_decode_linespec): Likewise. (tracepoint_probe_create_sals_from_address): Likewise. (tracepoint_probe_decode_linespec): Likewise. (tracepoint_probe_breakpoint_ops): New variable. (trace_command): Using proper breakpoint_ops according to the argument passed by the user in the command line. (initialize_breakpoint_ops): Initializing breakpoint_ops for static probes on breakpoints and tracepoints. * breakpoint.h (struct bp_location) <probe>: New field. * cli-utils.c (skip_spaces_const): New function. (extract_arg): Likewise. * cli-utils.h (skip_spaces_const): Likewise. (extract_arg): Likewise. * coffread.c (coff_sym_fns): Add `sym_probe_fns' value. * configure.ac: Append `stap-probe.o' to be generated when ELF support is present. * configure: Regenerate. * dbxread.c (aout_sym_fns): Add `sym_probe_fns' value. * elfread.c: Include `probe.h' and `arch-utils.h'. (probe_key): New variable. (elf_get_probes): New function. (elf_get_probe_argument_count): Likewise. (elf_evaluate_probe_argument): Likewise. (elf_compile_to_ax): Likewise. (elf_symfile_relocate_probe): Likewise. (stap_probe_key_free): Likewise. (elf_probe_fns): New variable. (elf_sym_fns): Add `sym_probe_fns' value. (elf_sym_fns_lazy_psyms): Likewise. (elf_sym_fns_gdb_index): Likewise. (_initialize_elfread): Initialize objfile cache for static probes. * gdb_vecs.h (struct probe): New forward declaration. (probe_p): New VEC declaration. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate. * gdbarch.sh (stap_integer_prefix): New variable. (stap_integer_suffix): Likewise. (stap_register_prefix): Likewise. (stap_register_suffix): Likewise. (stap_register_indirection_prefix): Likewise. (stap_register_indirection_suffix): Likewise. (stap_gdb_register_prefix): Likewise. (stap_gdb_register_suffix): Likewise. (stap_is_single_operand): New function. (stap_parse_special_token): Likewise. (struct stap_parse_info): Forward declaration. * i386-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. (i386_elf_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * i386-tdep.h (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. * machoread.c (macho_sym_fns): Add `sym_probe_fns' value. * mipsread.c (ecoff_sym_fns): Likewise. * objfiles.c (objfile_relocate1): Support relocation for static probes. * parse.c (prefixify_expression): Remove static declaration. (initialize_expout): Likewise. (reallocate_expout): Likewise. * parser-defs.h (initialize_expout): Declare function. (reallocate_expout): Likewise. (prefixify_expression): Likewise. * ppc-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (ppc_stap_is_single_operand): New function. (ppc_stap_parse_special_token): Likewise. (ppc_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * probe.c: New file, for generic statically defined probe support. * probe.h: Likewise. * s390-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (s390_stap_is_single_operand): New function. (s390_gdbarch_init): Initializing proper fields used by SystemTap probes' arguments parser. * somread.c (som_sym_fns): Add `sym_probe_fns' value. * stap-probe.c: New file, for SystemTap probe support. * stap-probe.h: Likewise. * symfile.h: Include `gdb_vecs.h'. (struct sym_probe_fns): New struct. (struct sym_fns) <sym_probe_fns>: New field. * symtab.c (init_sal): Initialize `probe' field. * symtab.h (struct probe): Forward declaration. (struct symtab_and_line) <probe>: New field. * tracepoint.c (start_tracing): Adjust semaphore on breakpoints locations. (stop_tracing): Likewise. * xcoffread.c (xcoff_sym_fns): Add `sym_probe_fns' value.
2012-04-27 22:47:57 +02:00
NULL, /* sym_probe_fns */
&psym_functions
};
void
2000-07-30 03:48:28 +02:00
_initialize_mipsread (void)
{
add_symtab_fns (bfd_target_ecoff_flavour, &ecoff_sym_fns);
}