/* Read dbx symbol tables and convert to internal format, for GDB.
- Copyright (C) 1986-2015 Free Software Foundation, Inc.
+ Copyright (C) 1986-2016 Free Software Foundation, Inc.
This file is part of GDB.
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 *);
static void dbx_new_init (struct objfile *);
-static void dbx_symfile_read (struct objfile *, int);
+static void dbx_symfile_read (struct objfile *, symfile_add_flags);
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);
#endif
\f
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;
&& 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);
}
\f
/* Scan and build partial symbols for a symbol file.
hung off the objfile structure. */
static void
-dbx_symfile_read (struct objfile *objfile, int symfile_flags)
+dbx_symfile_read (struct objfile *objfile, symfile_add_flags symfile_flags)
{
bfd *sym_bfd;
int val;
free_pending_blocks ();
back_to = make_cleanup (really_free_pendings, 0);
- init_minimal_symbol_collection ();
- make_cleanup_discard_minimal_symbols ();
+ minimal_symbol_reader reader (objfile);
/* 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. */
- install_minimal_symbols (objfile);
+ reader.install ();
do_cleanups (back_to);
}
static void
dbx_free_symfile_info (struct objfile *objfile, void *arg)
{
- struct dbx_symfile_info *dbx = arg;
+ struct dbx_symfile_info *dbx = (struct dbx_symfile_info *) arg;
if (dbx->header_files != NULL)
{
static void
do_free_bincl_list_cleanup (void *objfile)
{
- free_bincl_list (objfile);
+ free_bincl_list ((struct objfile *) objfile);
}
static struct cleanup *
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;
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);
}
}
}
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);
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. */
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;
static void
dbx_read_symtab (struct partial_symtab *self, struct objfile *objfile)
{
- bfd *sym_bfd;
-
if (self->readin)
{
fprintf_unfiltered (gdb_stderr, "Psymtab for %s already read in. "
gdb_flush (gdb_stdout);
}
- sym_bfd = objfile->obfd;
-
next_symbol_text_func = dbx_next_symbol_text;
back_to = make_cleanup (null_cleanup, NULL);
source file. Used to detect the SunPRO solaris compiler. */
static int n_opt_found;
- /* The stab type used for the definition of the last function.
- N_STSYM or N_GSYM for SunOS4 acc; N_FUN for other compilers. */
- static int function_stab_type = 0;
-
if (!block_address_function_relative)
{
/* N_LBRAC, N_RBRAC and N_SLINE entries are not relative to the
{
case 'f':
case 'F':
- function_stab_type = type;
-
/* Deal with the SunPRO 3.0 compiler which omits the
address from N_FUN symbols. */
if (type == N_FUN
int val;
bfd *sym_bfd = objfile->obfd;
char *name = bfd_get_filename (sym_bfd);
- struct dbx_symfile_info *info;
unsigned int stabsize;
- /* There is already a dbx_symfile_info allocated by our caller.
- It might even contain some info from the coff symtab to help us. */
- info = DBX_SYMFILE_INFO (objfile);
-
DBX_TEXT_ADDR (objfile) = textaddr;
DBX_TEXT_SIZE (objfile) = textsize;
int val;
bfd *sym_bfd = objfile->obfd;
char *name = bfd_get_filename (sym_bfd);
- struct dbx_symfile_info *info;
struct cleanup *back_to = make_cleanup (null_cleanup, NULL);
- /* There is already a dbx_symfile_info allocated by our caller.
- It might even contain some info from the ELF symtab to help us. */
- info = DBX_SYMFILE_INFO (objfile);
-
/* Find the first and last text address. dbx_symfile_read seems to
want this. */
find_text_range (sym_bfd, objfile);