/* Read coff symbol tables and convert to internal format, for GDB.
- Copyright (C) 1987-2018 Free Software Foundation, Inc.
+ Copyright (C) 1987-2019 Free Software Foundation, Inc.
Contributed by David D. Johnson, Brown University (ddj@cs.brown.edu).
This file is part of GDB.
#include "coff/internal.h" /* Internal format of COFF symbols in BFD */
#include "libcoff.h" /* FIXME secret internal data from BFD */
#include "objfiles.h"
-#include "buildsym.h"
+#include "buildsym-legacy.h"
#include "gdb-stabs.h"
#include "stabsread.h"
#include "complaints.h"
struct coff_symfile_info *info;
bfd *abfd = objfile->obfd;
coff_data_type *cdata = coff_data (abfd);
- char *name = bfd_get_filename (abfd);
+ char *filename = bfd_get_filename (abfd);
int val;
unsigned int num_symbols;
int symtab_offset;
val = init_lineno (abfd, info->min_lineno_offset,
info->max_lineno_offset - info->min_lineno_offset);
if (val < 0)
- error (_("\"%s\": error reading line numbers."), name);
+ error (_("\"%s\": error reading line numbers."), filename);
}
/* Now read the string table, all at once. */
make_cleanup (free_stringtab_cleanup, 0 /*ignore*/);
val = init_stringtab (abfd, stringtab_offset);
if (val < 0)
- error (_("\"%s\": can't get string table"), name);
+ error (_("\"%s\": can't get string table"), filename);
minimal_symbol_reader reader (objfile);
if (pe_file)
{
- struct minimal_symbol *msym;
-
- ALL_OBJFILE_MSYMBOLS (objfile, msym)
+ for (minimal_symbol *msym : objfile_msymbols (objfile))
{
const char *name = MSYMBOL_LINKAGE_NAME (msym);
{
error (_("The debugging information in `%s' is corrupted.\nThe "
"file has a `.stabs' section, but no `.stabstr' section."),
- name);
+ filename);
}
/* FIXME: dubious. Why can't we use something normal like
if (!debugfile.empty ())
{
- gdb_bfd_ref_ptr abfd (symfile_bfd_open (debugfile.c_str ()));
+ gdb_bfd_ref_ptr debug_bfd (symfile_bfd_open (debugfile.c_str ()));
- symbol_file_add_separate (abfd.get (), debugfile.c_str (),
+ symbol_file_add_separate (debug_bfd.get (), debugfile.c_str (),
symfile_flags, objfile);
}
}
struct objfile *objfile)
{
struct gdbarch *gdbarch = get_objfile_arch (objfile);
- struct context_stack *newobj;
+ struct context_stack *newobj = nullptr;
struct coff_symbol coff_symbol;
struct coff_symbol *cs = &coff_symbol;
static struct internal_syment main_sym;
CORE_ADDR tmpaddr;
struct minimal_symbol *msym;
- buildsym_init ();
scoped_free_pendings free_pending;
/* Work around a stdio bug in SunOS4.1.1 (this makes me nervous....
int section = cs_to_section (cs, objfile);
tmpaddr = cs->c_value;
- record_minimal_symbol (reader, cs, tmpaddr, mst_text,
- section, objfile);
+ /* Don't record unresolved symbols. */
+ if (!(cs->c_secnum <= 0 && cs->c_value == 0))
+ record_minimal_symbol (reader, cs, tmpaddr, mst_text,
+ section, objfile);
fcn_line_ptr = main_aux.x_sym.x_fcnary.x_fcn.x_lnnoptr;
fcn_start_addr = tmpaddr;
/* Patch up any opaque types (references to types that are not defined
in the file where they are referenced, e.g. "struct foo *bar"). */
{
- struct compunit_symtab *cu;
- struct symtab *s;
-
- ALL_OBJFILE_FILETABS (objfile, cu, s)
- patch_opaque_types (s);
+ for (compunit_symtab *cu : objfile_compunits (objfile))
+ {
+ for (symtab *s : compunit_filetabs (cu))
+ patch_opaque_types (s);
+ }
}
coffread_objfile = NULL;