aboutsummaryrefslogtreecommitdiff
path: root/gdb/mdebugread.c
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2016-09-22 14:25:08 -0600
committerTom Tromey <tom@tromey.com>2016-10-21 14:17:33 -0600
commit8dddcb8f005e8470312bf33041bb6ddaa5084e32 (patch)
treed88f904c0193031ec5215f25f03201d321a558cc /gdb/mdebugread.c
parentd25e87199327846e42b5a23f4365d75e75517ab3 (diff)
downloadgdb-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/mdebugread.c')
-rw-r--r--gdb/mdebugread.c48
1 files changed, 24 insertions, 24 deletions
diff --git a/gdb/mdebugread.c b/gdb/mdebugread.c
index 1285db4..a149ee9 100644
--- a/gdb/mdebugread.c
+++ b/gdb/mdebugread.c
@@ -222,7 +222,8 @@ static int found_ecoff_debugging_info;
static int upgrade_type (int, struct type **, int, union aux_ext *,
int, char *);
-static void parse_partial_symbols (struct objfile *);
+static void parse_partial_symbols (minimal_symbol_reader &,
+ struct objfile *);
static int has_opaque_xref (FDR *, SYMR *);
@@ -336,7 +337,8 @@ fdr_name (FDR *f)
different sections are relocated via the SECTION_OFFSETS. */
void
-mdebug_build_psymtabs (struct objfile *objfile,
+mdebug_build_psymtabs (minimal_symbol_reader &reader,
+ struct objfile *objfile,
const struct ecoff_debug_swap *swap,
struct ecoff_debug_info *info)
{
@@ -367,7 +369,7 @@ mdebug_build_psymtabs (struct objfile *objfile,
(*swap->swap_fdr_in) (objfile->obfd, fdr_src, fdr_ptr);
}
- parse_partial_symbols (objfile);
+ parse_partial_symbols (reader, objfile);
#if 0
/* Check to make sure file was compiled with -g. If not, warn the
@@ -2260,7 +2262,8 @@ function_outside_compilation_unit_complaint (const char *arg1)
belongs to, and then records this new minimal symbol. */
static void
-record_minimal_symbol (const char *name, const CORE_ADDR address,
+record_minimal_symbol (minimal_symbol_reader &reader,
+ const char *name, const CORE_ADDR address,
enum minimal_symbol_type ms_type, int storage_class,
struct objfile *objfile)
{
@@ -2316,15 +2319,15 @@ record_minimal_symbol (const char *name, const CORE_ADDR address,
section = -1;
}
- prim_record_minimal_symbol_and_info (name, address, ms_type,
- section, objfile);
+ reader.record_with_info (name, address, ms_type, section);
}
/* Master parsing procedure for first-pass reading of file symbols
into a partial_symtab. */
static void
-parse_partial_symbols (struct objfile *objfile)
+parse_partial_symbols (minimal_symbol_reader &reader,
+ struct objfile *objfile)
{
struct gdbarch *gdbarch = get_objfile_arch (objfile);
const bfd_size_type external_sym_size = debug_swap->external_sym_size;
@@ -2624,7 +2627,7 @@ parse_partial_symbols (struct objfile *objfile)
unknown_ext_complaint (name);
}
if (!ECOFF_IN_ELF (cur_bfd))
- record_minimal_symbol (name, svalue, ms_type, ext_in->asym.sc,
+ record_minimal_symbol (reader, name, svalue, ms_type, ext_in->asym.sc,
objfile);
}
@@ -2741,7 +2744,7 @@ parse_partial_symbols (struct objfile *objfile)
if (sh.st == stStaticProc)
{
namestring = debug_info->ss + fh->issBase + sh.iss;
- record_minimal_symbol (namestring, sh.value,
+ record_minimal_symbol (reader, namestring, sh.value,
mst_file_text, sh.sc,
objfile);
}
@@ -2786,7 +2789,7 @@ parse_partial_symbols (struct objfile *objfile)
case scPData:
case scXData:
namestring = debug_info->ss + fh->issBase + sh.iss;
- record_minimal_symbol (namestring, sh.value,
+ record_minimal_symbol (reader, namestring, sh.value,
mst_file_data, sh.sc,
objfile);
sh.value += ANOFFSET (objfile->section_offsets,
@@ -2797,7 +2800,7 @@ parse_partial_symbols (struct objfile *objfile)
/* FIXME! Shouldn't this use cases for bss,
then have the default be abs? */
namestring = debug_info->ss + fh->issBase + sh.iss;
- record_minimal_symbol (namestring, sh.value,
+ record_minimal_symbol (reader, namestring, sh.value,
mst_file_bss, sh.sc,
objfile);
sh.value += ANOFFSET (objfile->section_offsets,
@@ -3467,10 +3470,9 @@ parse_partial_symbols (struct objfile *objfile)
int new_sdx;
case stStaticProc:
- prim_record_minimal_symbol_and_info (name, minsym_value,
- mst_file_text,
- SECT_OFF_TEXT (objfile),
- objfile);
+ reader.record_with_info (name, minsym_value,
+ mst_file_text,
+ SECT_OFF_TEXT (objfile));
/* FALLTHROUGH */
@@ -3553,15 +3555,13 @@ parse_partial_symbols (struct objfile *objfile)
case stStatic: /* Variable */
if (SC_IS_DATA (sh.sc))
- prim_record_minimal_symbol_and_info (name, minsym_value,
- mst_file_data,
- SECT_OFF_DATA (objfile),
- objfile);
+ reader.record_with_info (name, minsym_value,
+ mst_file_data,
+ SECT_OFF_DATA (objfile));
else
- prim_record_minimal_symbol_and_info (name, minsym_value,
- mst_file_bss,
- SECT_OFF_BSS (objfile),
- objfile);
+ reader.record_with_info (name, minsym_value,
+ mst_file_bss,
+ SECT_OFF_BSS (objfile));
theclass = LOC_STATIC;
break;
@@ -4885,7 +4885,7 @@ elfmdebug_build_psymtabs (struct objfile *objfile,
error (_("Error reading ECOFF debugging information: %s"),
bfd_errmsg (bfd_get_error ()));
- mdebug_build_psymtabs (objfile, swap, info);
+ mdebug_build_psymtabs (reader, objfile, swap, info);
reader.install ();
}