aboutsummaryrefslogtreecommitdiff
path: root/gdb/xcoffread.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/xcoffread.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/xcoffread.c')
-rw-r--r--gdb/xcoffread.c35
1 files changed, 18 insertions, 17 deletions
diff --git a/gdb/xcoffread.c b/gdb/xcoffread.c
index ccd6149..974152f 100644
--- a/gdb/xcoffread.c
+++ b/gdb/xcoffread.c
@@ -197,7 +197,8 @@ eb_complaint (int arg1)
static void xcoff_initial_scan (struct objfile *, int);
-static void scan_xcoff_symtab (struct objfile *);
+static void scan_xcoff_symtab (minimal_symbol_reader &,
+ struct objfile *);
static char *xcoff_next_symbol_text (struct objfile *);
@@ -908,10 +909,10 @@ enter_line_range (struct subfile *subfile, unsigned beginoffset,
This function can read past the end of the symbol table
(into the string table) but this does no harm. */
-/* Create a new minimal symbol (using prim_record_minimal_symbol_and_info).
+/* Create a new minimal symbol (using record_with_info).
Creation of all new minimal symbols should go through this function
- rather than calling the various prim_record_[...] functions in order
+ rather than calling the various record functions in order
to make sure that all symbol addresses get properly relocated.
Arguments are:
@@ -925,18 +926,17 @@ enter_line_range (struct subfile *subfile, unsigned beginoffset,
OBJFILE - the objfile associated with the minimal symbol. */
static void
-record_minimal_symbol (const char *name, CORE_ADDR address,
+record_minimal_symbol (minimal_symbol_reader &reader,
+ const char *name, CORE_ADDR address,
enum minimal_symbol_type ms_type,
int n_scnum,
struct objfile *objfile)
{
-
if (name[0] == '.')
++name;
- prim_record_minimal_symbol_and_info (name, address, ms_type,
- secnum_to_section (n_scnum, objfile),
- objfile);
+ reader.record_with_info (name, address, ms_type,
+ secnum_to_section (n_scnum, objfile));
}
/* xcoff has static blocks marked in `.bs', `.es' pairs. They cannot be
@@ -2178,7 +2178,8 @@ function_outside_compilation_unit_complaint (const char *arg1)
}
static void
-scan_xcoff_symtab (struct objfile *objfile)
+scan_xcoff_symtab (minimal_symbol_reader &reader,
+ struct objfile *objfile)
{
struct gdbarch *gdbarch = get_objfile_arch (objfile);
CORE_ADDR toc_offset = 0; /* toc offset value in data section. */
@@ -2288,7 +2289,7 @@ scan_xcoff_symtab (struct objfile *objfile)
if (!misc_func_recorded)
{
record_minimal_symbol
- (last_csect_name, last_csect_val,
+ (reader, last_csect_name, last_csect_val,
mst_text, last_csect_sec, objfile);
misc_func_recorded = 1;
}
@@ -2343,7 +2344,7 @@ scan_xcoff_symtab (struct objfile *objfile)
table, except for section symbols. */
if (*namestring != '.')
record_minimal_symbol
- (namestring, symbol.n_value,
+ (reader, namestring, symbol.n_value,
sclass == C_HIDEXT ? mst_file_data : mst_data,
symbol.n_scnum, objfile);
break;
@@ -2381,7 +2382,7 @@ scan_xcoff_symtab (struct objfile *objfile)
main_aux[0].x_sym.x_fcnary.x_fcn.x_lnnoptr;
record_minimal_symbol
- (namestring, symbol.n_value,
+ (reader, namestring, symbol.n_value,
sclass == C_HIDEXT ? mst_file_text : mst_text,
symbol.n_scnum, objfile);
misc_func_recorded = 1;
@@ -2396,7 +2397,7 @@ scan_xcoff_symtab (struct objfile *objfile)
symbols, we will choose mst_text over
mst_solib_trampoline. */
record_minimal_symbol
- (namestring, symbol.n_value,
+ (reader, namestring, symbol.n_value,
mst_solib_trampoline, symbol.n_scnum, objfile);
misc_func_recorded = 1;
break;
@@ -2418,7 +2419,7 @@ scan_xcoff_symtab (struct objfile *objfile)
XMC_BS might be possible too. */
if (*namestring != '.')
record_minimal_symbol
- (namestring, symbol.n_value,
+ (reader, namestring, symbol.n_value,
sclass == C_HIDEXT ? mst_file_data : mst_data,
symbol.n_scnum, objfile);
break;
@@ -2434,7 +2435,7 @@ scan_xcoff_symtab (struct objfile *objfile)
table, except for section symbols. */
if (*namestring != '.')
record_minimal_symbol
- (namestring, symbol.n_value,
+ (reader, namestring, symbol.n_value,
sclass == C_HIDEXT ? mst_file_bss : mst_bss,
symbol.n_scnum, objfile);
break;
@@ -2462,7 +2463,7 @@ scan_xcoff_symtab (struct objfile *objfile)
it as a function. This will take care of functions like
strcmp() compiled by xlc. */
- record_minimal_symbol (last_csect_name, last_csect_val,
+ record_minimal_symbol (reader, last_csect_name, last_csect_val,
mst_text, last_csect_sec, objfile);
misc_func_recorded = 1;
}
@@ -3011,7 +3012,7 @@ xcoff_initial_scan (struct objfile *objfile, int symfile_flags)
/* Now that the symbol table data of the executable file are all in core,
process them and define symbols accordingly. */
- scan_xcoff_symtab (objfile);
+ scan_xcoff_symtab (reader, objfile);
/* Install any minimal symbols that have been collected as the current
minimal symbols for this objfile. */