static struct symbol *process_xcoff_symbol (struct coff_symbol *,
struct objfile *);
-static void read_xcoff_symtab (struct objfile *, struct partial_symtab *);
+static void read_xcoff_symtab (struct objfile *, legacy_psymtab *);
#if 0
static void add_stab_to_list (char *, struct pending_stabs **);
for (function_count = 0, ii = 0; ii < oldLineTb->nitems; ++ii)
{
+ if (oldLineTb->item[ii].is_stmt == 0)
+ continue;
+
if (oldLineTb->item[ii].line == 0)
{ /* Function entry found. */
if (function_count >= fentry_size)
fentry_size * sizeof (struct linetable_entry));
}
fentry[function_count].line = ii;
+ fentry[function_count].is_stmt = 1;
fentry[function_count].pc = oldLineTb->item[ii].pc;
++function_count;
/* Global variable to pass the psymtab down to all the routines involved
in psymtab to symtab processing. */
-static struct partial_symtab *this_symtab_psymtab;
+static legacy_psymtab *this_symtab_psymtab;
/* Objfile related to this_symtab_psymtab; set at the same time. */
static struct objfile *this_symtab_objfile;
CORE_ADDR endaddr, unsigned *firstLine)
{
struct objfile *objfile = this_symtab_objfile;
- struct gdbarch *gdbarch = get_objfile_arch (objfile);
+ struct gdbarch *gdbarch = objfile->arch ();
unsigned int curoffset;
CORE_ADDR addr;
void *ext_lnno;
addr = (int_lnno.l_lnno
? int_lnno.l_addr.l_paddr
: read_symbol_nvalue (int_lnno.l_addr.l_symndx));
- addr += objfile->section_offsets[SECT_OFF_TEXT (objfile)];
+ addr += objfile->text_section_offset ();
if (addr < startaddr || (endaddr && addr >= endaddr))
return;
/* Read symbols for a given partial symbol table. */
static void
-read_xcoff_symtab (struct objfile *objfile, struct partial_symtab *pst)
+read_xcoff_symtab (struct objfile *objfile, legacy_psymtab *pst)
{
bfd *abfd = objfile->obfd;
char *raw_auxptr; /* Pointer to first raw aux entry for sym. */
}
file_start_addr =
- cs->c_value + objfile->section_offsets[SECT_OFF_TEXT (objfile)];
+ cs->c_value + objfile->text_section_offset ();
file_end_addr = file_start_addr + CSECT_LEN (&main_aux);
if (cs->c_name && (cs->c_name[0] == '.' || cs->c_name[0] == '@'))
case C_FCN:
if (strcmp (cs->c_name, ".bf") == 0)
{
- CORE_ADDR off = objfile->section_offsets[SECT_OFF_TEXT (objfile)];
+ CORE_ADDR off = objfile->text_section_offset ();
bfd_coff_swap_aux_in (abfd, raw_auxptr, cs->c_type, cs->c_sclass,
0, cs->c_naux, &main_aux);
NULL, cstk.start_addr,
(fcn_cs_saved.c_value
+ fcn_aux_saved.x_sym.x_misc.x_fsize
- + objfile->section_offsets[SECT_OFF_TEXT (objfile)]));
+ + objfile->text_section_offset ()));
within_function = 0;
}
break;
depth++;
newobj = push_context (depth,
(cs->c_value
- + objfile->section_offsets[SECT_OFF_TEXT (objfile)]));
+ + objfile->text_section_offset ()));
}
else if (strcmp (cs->c_name, ".eb") == 0)
{
cstk.old_blocks, NULL,
cstk.start_addr,
(cs->c_value
- + objfile->section_offsets[SECT_OFF_TEXT (objfile)]));
+ + objfile->text_section_offset ()));
}
*get_local_symbols () = cstk.locals;
}
}
}
-#define SYMBOL_DUP(SYMBOL1, SYMBOL2) \
- (SYMBOL2) = new (&objfile->objfile_obstack) symbol (); \
- *(SYMBOL2) = *(SYMBOL1);
-
-
#define SYMNAME_ALLOC(NAME, ALLOCED) \
((ALLOCED) ? (NAME) : obstack_strdup (&objfile->objfile_obstack, \
(NAME)))
if (name[0] == '.')
++name;
- initialize_objfile_symbol (sym);
-
/* default assumptions */
SET_SYMBOL_VALUE_ADDRESS (sym, cs->c_value + off);
SYMBOL_DOMAIN (sym) = VAR_DOMAIN;
SYMBOL_TYPE (sym) = objfile_type (objfile)->nodebug_text_symbol;
SYMBOL_ACLASS_INDEX (sym) = LOC_BLOCK;
- SYMBOL_DUP (sym, sym2);
+ sym2 = new (&objfile->objfile_obstack) symbol (*sym);
if (cs->c_sclass == C_EXT || C_WEAKEXT)
add_symbol_to_list (sym2, get_global_symbols ());
}
\f
static void
-xcoff_psymtab_to_symtab_1 (struct objfile *objfile, struct partial_symtab *pst)
+xcoff_expand_psymtab (legacy_psymtab *pst, struct objfile *objfile)
{
- int i;
-
- if (!pst)
- return;
-
- if (pst->readin)
- {
- fprintf_unfiltered
- (gdb_stderr, "Psymtab for %s already read in. Shouldn't happen.\n",
- pst->filename);
- return;
- }
+ gdb_assert (!pst->readin);
/* Read in all partial symtabs on which this one is dependent. */
- for (i = 0; i < pst->number_of_dependencies; i++)
- if (!pst->dependencies[i]->readin)
- {
- /* Inform about additional files that need to be read in. */
- if (info_verbose)
- {
- fputs_filtered (" ", gdb_stdout);
- wrap_here ("");
- fputs_filtered ("and ", gdb_stdout);
- wrap_here ("");
- printf_filtered ("%s...", pst->dependencies[i]->filename);
- wrap_here (""); /* Flush output */
- gdb_flush (gdb_stdout);
- }
- xcoff_psymtab_to_symtab_1 (objfile, pst->dependencies[i]);
- }
+ pst->expand_dependencies (objfile);
if (((struct symloc *) pst->read_symtab_private)->numsyms != 0)
{
read_xcoff_symtab (objfile, pst);
}
- pst->readin = 1;
+ pst->readin = true;
}
/* Read in all of the symbols for a given psymtab for real.
Be verbose about it if the user wants that. SELF is not NULL. */
static void
-xcoff_read_symtab (struct partial_symtab *self, struct objfile *objfile)
+xcoff_read_symtab (legacy_psymtab *self, struct objfile *objfile)
{
- if (self->readin)
- {
- fprintf_unfiltered
- (gdb_stderr, "Psymtab for %s already read in. Shouldn't happen.\n",
- self->filename);
- return;
- }
+ gdb_assert (!self->readin);
if (((struct symloc *) self->read_symtab_private)->numsyms != 0
|| self->number_of_dependencies)
{
- /* Print the message now, before reading the string table,
- to avoid disconcerting pauses. */
- if (info_verbose)
- {
- printf_filtered ("Reading in symbols for %s...", self->filename);
- gdb_flush (gdb_stdout);
- }
-
next_symbol_text_func = xcoff_next_symbol_text;
- xcoff_psymtab_to_symtab_1 (objfile, self);
+ self->expand_psymtab (objfile);
/* Match with global symbols. This only needs to be done once,
after all of the symtabs and dependencies have been read in. */
scan_file_globals (objfile);
-
- /* Finish up the debug error message. */
- if (info_verbose)
- printf_filtered ("done.\n");
}
}
\f
is the address relative to which its symbols are (incremental) or 0
(normal). */
-static struct partial_symtab *
+static legacy_psymtab *
xcoff_start_psymtab (struct objfile *objfile,
const char *filename, int first_symnum)
{
- struct partial_symtab *result =
- start_psymtab_common (objfile,
- filename,
- /* We fill in textlow later. */
- 0);
+ /* We fill in textlow later. */
+ legacy_psymtab *result = new legacy_psymtab (filename, objfile, 0);
result->read_symtab_private =
XOBNEW (&objfile->objfile_obstack, struct symloc);
((struct symloc *) result->read_symtab_private)->first_symnum = first_symnum;
- result->read_symtab = xcoff_read_symtab;
+ result->legacy_read_symtab = xcoff_read_symtab;
+ result->legacy_expand_psymtab = xcoff_expand_psymtab;
/* Deduce the source language from the filename for this psymtab. */
psymtab_language = deduce_language_from_filename (filename);
INCLUDE_LIST, NUM_INCLUDES, DEPENDENCY_LIST, and NUMBER_DEPENDENCIES
are the information for includes and dependencies. */
-static struct partial_symtab *
-xcoff_end_psymtab (struct objfile *objfile, struct partial_symtab *pst,
+static legacy_psymtab *
+xcoff_end_psymtab (struct objfile *objfile, legacy_psymtab *pst,
const char **include_list, int num_includes,
int capping_symbol_number,
- struct partial_symtab **dependency_list,
+ legacy_psymtab **dependency_list,
int number_dependencies, int textlow_not_set)
{
int i;
pst->dependencies
= objfile->partial_symtabs->allocate_dependencies (number_dependencies);
memcpy (pst->dependencies, dependency_list,
- number_dependencies * sizeof (struct partial_symtab *));
+ number_dependencies * sizeof (legacy_psymtab *));
}
else
pst->dependencies = 0;
for (i = 0; i < num_includes; i++)
{
- struct partial_symtab *subpst =
- allocate_psymtab (include_list[i], objfile);
+ legacy_psymtab *subpst =
+ new legacy_psymtab (include_list[i], objfile);
subpst->read_symtab_private = XOBNEW (&objfile->objfile_obstack, symloc);
((struct symloc *) subpst->read_symtab_private)->first_symnum = 0;
subpst->dependencies[0] = pst;
subpst->number_of_dependencies = 1;
- subpst->read_symtab = pst->read_symtab;
+ subpst->legacy_read_symtab = pst->legacy_read_symtab;
+ subpst->legacy_expand_psymtab = pst->legacy_expand_psymtab;
}
if (num_includes == 0
/* Empty psymtabs happen as a result of header files which don't have
any symbols in them. There can be a lot of them. */
- discard_psymtab (objfile, pst);
+ objfile->partial_symtabs->discard_psymtab (pst);
/* Indicate that psymtab was thrown away. */
pst = NULL;
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. */
const char *filestring = NULL;
unsigned int nsyms;
/* Current partial symtab */
- struct partial_symtab *pst;
+ legacy_psymtab *pst;
/* List of current psymtab's include files. */
const char **psymtab_include_list;
int includes_used;
/* Index within current psymtab dependency list. */
- struct partial_symtab **dependency_list;
+ legacy_psymtab **dependency_list;
int dependencies_used, dependencies_allocated;
char *sraw_symbol;
int misc_func_recorded = 0; /* true if any misc. function. */
int textlow_not_set = 1;
- pst = (struct partial_symtab *) 0;
+ pst = (legacy_psymtab *) 0;
includes_allocated = 30;
includes_used = 0;
dependencies_allocated = 30;
dependencies_used = 0;
dependency_list =
- (struct partial_symtab **) alloca (dependencies_allocated *
- sizeof (struct partial_symtab *));
+ (legacy_psymtab **) alloca (dependencies_allocated *
+ sizeof (legacy_psymtab *));
set_last_source_file (NULL);
switch (p[1])
{
case 'S':
- if (gdbarch_static_transform_name_p (gdbarch))
- namestring = gdbarch_static_transform_name
- (gdbarch, namestring);
-
add_psymbol_to_list (gdb::string_view (namestring,
p - namestring),
true, VAR_DOMAIN, LOC_STATIC,