diff options
author | Tom Tromey <tom@tromey.com> | 2016-09-22 14:25:08 -0600 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2016-10-21 14:17:33 -0600 |
commit | 8dddcb8f005e8470312bf33041bb6ddaa5084e32 (patch) | |
tree | d88f904c0193031ec5215f25f03201d321a558cc /gdb/dbxread.c | |
parent | d25e87199327846e42b5a23f4365d75e75517ab3 (diff) | |
download | gdb-8dddcb8f005e8470312bf33041bb6ddaa5084e32.zip gdb-8dddcb8f005e8470312bf33041bb6ddaa5084e32.tar.gz gdb-8dddcb8f005e8470312bf33041bb6ddaa5084e32.tar.bz2 |
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.
Diffstat (limited to 'gdb/dbxread.c')
-rw-r--r-- | gdb/dbxread.c | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/gdb/dbxread.c b/gdb/dbxread.c index a5bb2e0..9e6df69 100644 --- a/gdb/dbxread.c +++ b/gdb/dbxread.c @@ -262,9 +262,10 @@ static void dbx_read_symtab (struct partial_symtab *self, static void dbx_psymtab_to_symtab_1 (struct objfile *, struct partial_symtab *); -static void read_dbx_dynamic_symtab (struct objfile *objfile); +static void read_dbx_dynamic_symtab (minimal_symbol_reader &reader, + struct objfile *objfile); -static void read_dbx_symtab (struct objfile *); +static void read_dbx_symtab (minimal_symbol_reader &, struct objfile *); static void free_bincl_list (struct objfile *); @@ -286,7 +287,8 @@ static void dbx_symfile_read (struct objfile *, int); static void dbx_symfile_finish (struct objfile *); -static void record_minimal_symbol (const char *, CORE_ADDR, int, +static void record_minimal_symbol (minimal_symbol_reader &, + const char *, CORE_ADDR, int, struct objfile *); static void add_new_header_file (char *, int); @@ -429,7 +431,8 @@ explicit_lookup_type (int real_filenum, int index) #endif static void -record_minimal_symbol (const char *name, CORE_ADDR address, int type, +record_minimal_symbol (minimal_symbol_reader &reader, + const char *name, CORE_ADDR address, int type, struct objfile *objfile) { enum minimal_symbol_type ms_type; @@ -508,8 +511,7 @@ record_minimal_symbol (const char *name, CORE_ADDR address, int type, && address < lowest_text_address) lowest_text_address = address; - prim_record_minimal_symbol_and_info - (name, address, ms_type, section, objfile); + reader.record_with_info (name, address, ms_type, section); } /* Scan and build partial symbols for a symbol file. @@ -562,11 +564,11 @@ dbx_symfile_read (struct objfile *objfile, int symfile_flags) /* Read stabs data from executable file and define symbols. */ - read_dbx_symtab (objfile); + read_dbx_symtab (reader, objfile); /* Add the dynamic symbols. */ - read_dbx_dynamic_symtab (objfile); + read_dbx_dynamic_symtab (reader, objfile); /* Install any minimal symbols that have been collected as the current minimal symbols for this objfile. */ @@ -978,7 +980,8 @@ set_namestring (struct objfile *objfile, const struct internal_nlist *nlist) add them to the minimal symbol table. */ static void -read_dbx_dynamic_symtab (struct objfile *objfile) +read_dbx_dynamic_symtab (minimal_symbol_reader &reader, + struct objfile *objfile) { bfd *abfd = objfile->obfd; struct cleanup *back_to; @@ -1052,7 +1055,7 @@ read_dbx_dynamic_symtab (struct objfile *objfile) if (sym->flags & BSF_GLOBAL) type |= N_EXT; - record_minimal_symbol (bfd_asymbol_name (sym), sym_value, + record_minimal_symbol (reader, bfd_asymbol_name (sym), sym_value, type, objfile); } } @@ -1105,8 +1108,7 @@ read_dbx_dynamic_symtab (struct objfile *objfile) } name = bfd_asymbol_name (*rel->sym_ptr_ptr); - prim_record_minimal_symbol (name, address, mst_solib_trampoline, - objfile); + reader.record (name, address, mst_solib_trampoline); } do_cleanups (back_to); @@ -1169,7 +1171,7 @@ function_outside_compilation_unit_complaint (const char *arg1) debugging information is available. */ static void -read_dbx_symtab (struct objfile *objfile) +read_dbx_symtab (minimal_symbol_reader &reader, struct objfile *objfile) { struct gdbarch *gdbarch = get_objfile_arch (objfile); struct external_nlist *bufp = 0; /* =0 avoids gcc -Wall glitch. */ @@ -1325,7 +1327,7 @@ read_dbx_symtab (struct objfile *objfile) record_it: namestring = set_namestring (objfile, &nlist); - record_minimal_symbol (namestring, nlist.n_value, + record_minimal_symbol (reader, namestring, nlist.n_value, nlist.n_type, objfile); /* Always */ continue; |