/* Read AIX xcoff symbol tables and convert to internal format, for GDB.
- Copyright (C) 1986-2017 Free Software Foundation, Inc.
+ Copyright (C) 1986-2018 Free Software Foundation, Inc.
Derived from coffread.c, dbxread.c, and a lot of hacking.
Contributed by IBM Corporation.
{ ".dwframe", NULL },
{ NULL, NULL }, /* eh_frame */
{ NULL, NULL }, /* gdb_index */
+ { NULL, NULL }, /* debug_names */
+ { NULL, NULL }, /* debug_aranges */
23
};
static void
bf_notfound_complaint (void)
{
- complaint (&symfile_complaints,
- _("line numbers off, `.bf' symbol not found"));
+ complaint (_("line numbers off, `.bf' symbol not found"));
}
static void
ef_complaint (int arg1)
{
- complaint (&symfile_complaints,
- _("Mismatched .ef symbol ignored starting at symnum %d"), arg1);
+ complaint (_("Mismatched .ef symbol ignored starting at symnum %d"), arg1);
}
static void
eb_complaint (int arg1)
{
- complaint (&symfile_complaints,
- _("Mismatched .eb symbol ignored starting at symnum %d"), arg1);
+ complaint (_("Mismatched .eb symbol ignored starting at symnum %d"), arg1);
}
static void xcoff_initial_scan (struct objfile *, symfile_add_flags);
/* This can happen with old versions of GCC.
GCC 2.3.3-930426 does not exhibit this on a test case which
a user said produced the message for him. */
- complaint (&symfile_complaints, _("Nested C_BINCL symbols"));
+ complaint (_("Nested C_BINCL symbols"));
}
++inclDepth;
if (inclDepth == 0)
{
- complaint (&symfile_complaints, _("Mismatched C_BINCL/C_EINCL pair"));
+ complaint (_("Mismatched C_BINCL/C_EINCL pair"));
}
allocate_include_entry ();
{
if (endoffset >= limit_offset)
{
- complaint (&symfile_complaints,
- _("Bad line table offset in C_EINCL directive"));
+ complaint (_("Bad line table offset in C_EINCL directive"));
return;
}
limit_offset = endoffset;
bfd_coff_swap_sym_in (objfile->obfd, raw_symbol, &symbol);
if (symbol.n_zeroes)
{
- complaint (&symfile_complaints, _("Unexpected symbol continuation"));
+ complaint (_("Unexpected symbol continuation"));
/* Return something which points to '\0' and hope the symbol reading
code does something reasonable. */
}
else
{
- complaint (&symfile_complaints, _("Unexpected symbol continuation"));
+ complaint (_("Unexpected symbol continuation"));
/* Return something which points to '\0' and hope the symbol reading
code does something reasonable. */
last_csect_name = 0;
start_stabs ();
- start_symtab (objfile, filestring, (char *) NULL, file_start_addr);
+ start_symtab (objfile, filestring, (char *) NULL, file_start_addr,
+ language_unknown);
record_debugformat (debugfmt);
symnum = ((struct symloc *) pst->read_symtab_private)->first_symnum;
max_symnum =
}
start_stabs ();
- start_symtab (objfile, "_globals_", (char *) NULL, (CORE_ADDR) 0);
+ start_symtab (objfile, "_globals_", (char *) NULL, (CORE_ADDR) 0,
+ language_unknown);
record_debugformat (debugfmt);
cur_src_end_addr = first_object_file_end;
/* Done with all files, everything from here on is globals. */
/* Give all csects for this source file the same
name. */
start_symtab (objfile, filestring, NULL,
- (CORE_ADDR) 0);
+ (CORE_ADDR) 0, language_unknown);
record_debugformat (debugfmt);
}
filestring = cs->c_name;
start_stabs ();
- start_symtab (objfile, filestring, (char *) NULL, (CORE_ADDR) 0);
+ start_symtab (objfile, filestring, (char *) NULL, (CORE_ADDR) 0,
+ language_unknown);
record_debugformat (debugfmt);
last_csect_name = 0;
case C_UNTAG:
case C_ENTAG:
{
- complaint (&symfile_complaints,
- _("Unrecognized storage class %d."),
+ complaint (_("Unrecognized storage class %d."),
cs->c_sclass);
}
break;
break;
default:
- complaint (&symfile_complaints, _("Unexpected storage class: %d"),
+ complaint (_("Unexpected storage class: %d"),
cs->c_sclass);
/* FALLTHROUGH */
if (symno < 0 || symno >= nsyms)
{
- complaint (&symfile_complaints, _("Invalid symbol offset"));
+ complaint (_("Invalid symbol offset"));
symbol->n_value = 0;
symbol->n_scnum = -1;
return;
static void
xcoff_psymtab_to_symtab_1 (struct objfile *objfile, struct partial_symtab *pst)
{
- struct cleanup *old_chain;
int i;
if (!pst)
/* Init stuff necessary for reading in symbols. */
stabsread_init ();
buildsym_init ();
- old_chain = make_cleanup (really_free_pendings, 0);
+ scoped_free_pendings free_pending;
read_xcoff_symtab (objfile, pst);
-
- do_cleanups (old_chain);
}
pst->readin = 1;
inclTable = NULL;
}
inclIndx = inclLength = inclDepth = 0;
-
- dwarf2_free_objfile (objfile);
}
static struct partial_symtab *
xcoff_start_psymtab (struct objfile *objfile,
const char *filename, int first_symnum,
- struct partial_symbol **global_syms,
- struct partial_symbol **static_syms)
+ std::vector<partial_symbol *> &global_psymbols,
+ std::vector<partial_symbol *> &static_psymbols)
{
struct partial_symtab *result =
start_psymtab_common (objfile,
filename,
/* We fill in textlow later. */
0,
- global_syms, static_syms);
+ global_psymbols, static_psymbols);
result->read_symtab_private =
XOBNEW (&objfile->objfile_obstack, struct symloc);
struct partial_symtab *subpst =
allocate_psymtab (include_list[i], objfile);
- subpst->read_symtab_private = obstack_alloc (&objfile->objfile_obstack,
- sizeof (struct symloc));
+ subpst->read_symtab_private = XOBNEW (&objfile->objfile_obstack, symloc);
((struct symloc *) subpst->read_symtab_private)->first_symnum = 0;
((struct symloc *) subpst->read_symtab_private)->numsyms = 0;
subpst->textlow = 0;
static void
function_outside_compilation_unit_complaint (const char *arg1)
{
- complaint (&symfile_complaints,
- _("function `%s' appears to be defined "
+ complaint (_("function `%s' appears to be defined "
"outside of all compilation units"),
arg1);
}
(objfile,
filestring,
symnum_before,
- objfile->global_psymbols.next,
- objfile->static_psymbols.next);
+ objfile->global_psymbols,
+ objfile->static_psymbols);
}
}
/* Activate the misc_func_recorded mechanism for
pst = xcoff_start_psymtab (objfile,
filestring,
symnum_before,
- objfile->global_psymbols.next,
- objfile->static_psymbols.next);
+ objfile->global_psymbols,
+ objfile->static_psymbols);
last_csect_name = NULL;
}
break;
default:
{
- complaint (&symfile_complaints,
- _("Storage class %d not recognized during scan"),
+ complaint (_("Storage class %d not recognized during scan"),
sclass);
}
/* FALLTHROUGH */
+ case C_FCN:
/* C_FCN is .bf and .ef symbols. I think it is sufficient
to handle only the C_FUN and C_EXT. */
- case C_FCN:
case C_BSTAT:
case C_ESTAT:
the end of every string looking for a
backslash. */
- complaint (&symfile_complaints,
- _("unknown symbol descriptor `%c'"), p[1]);
+ complaint (_("unknown symbol descriptor `%c'"), p[1]);
/* Ignore it; perhaps it is an extension that we don't
know about. */
{
bfd *abfd;
int val;
- struct cleanup *back_to;
int num_symbols; /* # of symbols */
file_ptr symtab_offset; /* symbol table and */
file_ptr stringtab_offset; /* string table file offsets */
/* Read the string table. */
init_stringtab (abfd, stringtab_offset, objfile);
- /* Read the .debug section, if present. */
- {
- struct bfd_section *secp;
- bfd_size_type length;
- bfd_byte *debugsec = NULL;
+ /* Read the .debug section, if present and if we're not ignoring
+ it. */
+ if (!(objfile->flags & OBJF_READNEVER))
+ {
+ struct bfd_section *secp;
+ bfd_size_type length;
+ bfd_byte *debugsec = NULL;
- secp = bfd_get_section_by_name (abfd, ".debug");
- if (secp)
- {
- length = bfd_section_size (abfd, secp);
- if (length)
- {
- debugsec
- = (bfd_byte *) obstack_alloc (&objfile->objfile_obstack,
- length);
+ secp = bfd_get_section_by_name (abfd, ".debug");
+ if (secp)
+ {
+ length = bfd_section_size (abfd, secp);
+ if (length)
+ {
+ debugsec
+ = (bfd_byte *) obstack_alloc (&objfile->objfile_obstack,
+ length);
- if (!bfd_get_full_section_contents (abfd, secp, &debugsec))
- {
- error (_("Error reading .debug section of `%s': %s"),
- name, bfd_errmsg (bfd_get_error ()));
- }
- }
- }
- info->debugsec = (char *) debugsec;
- }
+ if (!bfd_get_full_section_contents (abfd, secp, &debugsec))
+ {
+ error (_("Error reading .debug section of `%s': %s"),
+ name, bfd_errmsg (bfd_get_error ()));
+ }
+ }
+ }
+ info->debugsec = (char *) debugsec;
+ }
}
/* Read the symbols. We keep them in core because we will want to
perror_with_name (_("reading symbol table"));
/* If we are reinitializing, or if we have never loaded syms yet, init. */
- if (objfile->global_psymbols.size == 0 && objfile->static_psymbols.size == 0)
+ if (objfile->global_psymbols.capacity () == 0
+ && objfile->static_psymbols.capacity () == 0)
/* I'm not sure how how good num_symbols is; the rule of thumb in
init_psymbol_list was developed for a.out. On the one hand,
num_symbols includes auxents. On the other hand, it doesn't
init_psymbol_list (objfile, num_symbols);
free_pending_blocks ();
- back_to = make_cleanup (really_free_pendings, 0);
+ scoped_free_pendings free_pending;
minimal_symbol_reader reader (objfile);
/* Now that the symbol table data of the executable file are all in core,
dwarf2_build_psymtabs (objfile);
dwarf2_build_frame_info (objfile);
-
- do_cleanups (back_to);
}
\f
static void
xcoff_symfile_offsets (struct objfile *objfile,
- const struct section_addr_info *addrs)
+ const section_addr_info &addrs)
{
const char *first_section_name;
xfree (arg);
}
-/* Provide a prototype to silence -Wmissing-prototypes. */
-extern initialize_file_ftype _initialize_xcoffread;
-
void
_initialize_xcoffread (void)
{