+2012-11-28 Tom Tromey <tromey@redhat.com>
+
+ * dbxread.c (read_dbx_symtab): Update.
+ (end_psymtab, dbx_psymtab_to_symtab_1, dbx_psymtab_to_symtab)
+ (read_ofile_symtab): Add 'objfile' argument.
+ * dwarf2read.c (process_psymtab_comp_unit_reader)
+ (build_type_psymtabs_reader): Update.
+ (dwarf2_psymtab_to_symtab): Add 'objfile' argument.
+ * mdebugread.c (mdebug_psymtab_to_symtab): Add 'objfile'
+ argument.
+ (parse_procedure, parse_partial_symbols): Update.
+ (psymtab_to_symtab_1): Add 'objfile' argument.
+ * psympriv.h (struct partial_symtab) <objfile>: Remove.
+ <read_symtab>: Add 'objfile' argument.
+ (sort_pst_symbols, discard_psymtab): Update.
+ * psymtab.c (partial_map_expand_apply): Update.
+ (find_pc_sect_psymtab_closer): Add 'objfile' argument.
+ (find_pc_sect_psymtab, find_pc_sect_symtab_from_partial): Update.
+ (find_pc_sect_psymbol): Add 'objfile' argument.
+ (lookup_symbol_aux_psymtabs): Update.
+ (match_partial_symbol, lookup_partial_symbol, psymtab_to_symtab):
+ Add 'objfile' argument.
+ (find_last_source_symtab_from_partial, dump_psymtab)
+ (dump_psymtabs_for_objfile, read_symtabs_for_function)
+ (expand_partial_symbol_tables, read_psymtabs_with_filename)
+ (find_symbol_file_from_partial, map_matching_symbols_psymtab)
+ (expand_symtabs_matching_via_partial): Update.
+ (sort_pst_symbols): Add 'objfile' argument.
+ (allocate_psymtab): Update.
+ (discard_psymtab): Add 'objfile' argument.
+ (maintenance_info_psymtabs, maintenance_check_symtabs): Update.
+ * stabsread.h (end_psymtab): Update.
+ * xcoffread.c (this_symtab_objfile): New global.
+ (process_linenos, enter_line_range, xcoff_next_symbol_text):
+ Update.
+ (read_xcoff_symtab): Add 'objfile' argument.
+ (read_symbol, read_symbol_lineno): Update.
+ (xcoff_psymtab_to_symtab_1, xcoff_psymtab_to_symtab)
+ (xcoff_end_psymtab): Add 'objfile' argument.
+ (scan_xcoff_symtab): Update.
+
2012-12-12 Paul Koning <paul_koning@dell.com>
Add support for Python 3.
extern void _initialize_dbxread (void);
-static void read_ofile_symtab (struct partial_symtab *);
+static void read_ofile_symtab (struct objfile *, struct partial_symtab *);
-static void dbx_psymtab_to_symtab (struct partial_symtab *);
+static void dbx_psymtab_to_symtab (struct objfile *, struct partial_symtab *);
-static void dbx_psymtab_to_symtab_1 (struct partial_symtab *);
+static void dbx_psymtab_to_symtab_1 (struct objfile *, struct partial_symtab *);
static void read_dbx_dynamic_symtab (struct objfile *objfile);
which are not the address. */
&& nlist.n_value >= pst->textlow)
{
- end_psymtab (pst, psymtab_include_list, includes_used,
- symnum * symbol_size,
+ end_psymtab (objfile, pst, psymtab_include_list,
+ includes_used, symnum * symbol_size,
nlist.n_value > pst->texthigh
? nlist.n_value : pst->texthigh,
dependency_list, dependencies_used,
if (pst)
{
- end_psymtab (pst, psymtab_include_list, includes_used,
- symnum * symbol_size,
+ end_psymtab (objfile, pst, psymtab_include_list,
+ includes_used, symnum * symbol_size,
valu > pst->texthigh ? valu : pst->texthigh,
dependency_list, dependencies_used,
prev_textlow_not_set);
follows this module. */
if (pst && gdbarch_sofun_address_maybe_missing (gdbarch))
{
- end_psymtab (pst, psymtab_include_list, includes_used,
+ end_psymtab (objfile, pst, psymtab_include_list, includes_used,
symnum * symbol_size,
(CORE_ADDR) 0, dependency_list,
dependencies_used, textlow_not_set);
: lowest_text_address)
+ text_size;
- end_psymtab (pst, psymtab_include_list, includes_used,
+ end_psymtab (objfile, pst, psymtab_include_list, includes_used,
symnum * symbol_size,
text_end > pst->texthigh ? text_end : pst->texthigh,
dependency_list, dependencies_used, textlow_not_set);
FIXME: List variables and peculiarities of same. */
struct partial_symtab *
-end_psymtab (struct partial_symtab *pst,
+end_psymtab (struct objfile *objfile, struct partial_symtab *pst,
const char **include_list, int num_includes,
int capping_symbol_offset, CORE_ADDR capping_text,
struct partial_symtab **dependency_list, int number_dependencies,
int textlow_not_set)
{
int i;
- struct objfile *objfile = pst->objfile;
struct gdbarch *gdbarch = get_objfile_arch (objfile);
if (capping_symbol_offset != -1)
subpst->read_symtab = pst->read_symtab;
}
- sort_pst_symbols (pst);
+ sort_pst_symbols (objfile, pst);
if (num_includes == 0
&& number_dependencies == 0
is not empty, but we don't realize that. Fixing that without slowing
things down might be tricky. */
- discard_psymtab (pst);
+ discard_psymtab (objfile, pst);
/* Indicate that psymtab was thrown away. */
pst = (struct partial_symtab *) NULL;
}
\f
static void
-dbx_psymtab_to_symtab_1 (struct partial_symtab *pst)
+dbx_psymtab_to_symtab_1 (struct objfile *objfile, struct partial_symtab *pst)
{
struct cleanup *old_chain;
int i;
wrap_here (""); /* Flush output. */
gdb_flush (gdb_stdout);
}
- dbx_psymtab_to_symtab_1 (pst->dependencies[i]);
+ dbx_psymtab_to_symtab_1 (objfile, pst->dependencies[i]);
}
if (LDSYMLEN (pst)) /* Otherwise it's a dummy. */
symbol_size = SYMBOL_SIZE (pst);
/* Read in this file's symbols. */
- bfd_seek (pst->objfile->obfd, SYMBOL_OFFSET (pst), SEEK_SET);
- read_ofile_symtab (pst);
+ bfd_seek (objfile->obfd, SYMBOL_OFFSET (pst), SEEK_SET);
+ read_ofile_symtab (objfile, pst);
do_cleanups (old_chain);
}
Be verbose about it if the user wants that. */
static void
-dbx_psymtab_to_symtab (struct partial_symtab *pst)
+dbx_psymtab_to_symtab (struct objfile *objfile, struct partial_symtab *pst)
{
bfd *sym_bfd;
struct cleanup *back_to = NULL;
gdb_flush (gdb_stdout);
}
- sym_bfd = pst->objfile->obfd;
+ sym_bfd = objfile->obfd;
next_symbol_text_func = dbx_next_symbol_text;
- if (DBX_STAB_SECTION (pst->objfile))
+ if (DBX_STAB_SECTION (objfile))
{
stabs_data
- = symfile_relocate_debug_section (pst->objfile,
- DBX_STAB_SECTION (pst->objfile),
+ = symfile_relocate_debug_section (objfile,
+ DBX_STAB_SECTION (objfile),
NULL);
if (stabs_data)
(void *) &stabs_data);
}
- dbx_psymtab_to_symtab_1 (pst);
+ dbx_psymtab_to_symtab_1 (objfile, pst);
if (back_to)
do_cleanups (back_to);
/* 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 (pst->objfile);
+ scan_file_globals (objfile);
/* Finish up the debug error message. */
if (info_verbose)
/* Read in a defined section of a specific object file's symbols. */
static void
-read_ofile_symtab (struct partial_symtab *pst)
+read_ofile_symtab (struct objfile *objfile, struct partial_symtab *pst)
{
char *namestring;
struct external_nlist *bufp;
unsigned char type;
unsigned max_symnum;
bfd *abfd;
- struct objfile *objfile;
int sym_offset; /* Offset to start of symbols to read */
int sym_size; /* Size of symbols to read */
CORE_ADDR text_offset; /* Start of text segment for symbols */
int text_size; /* Size of text segment for symbols */
struct section_offsets *section_offsets;
- objfile = pst->objfile;
sym_offset = LDSYMOFF (pst);
sym_size = LDSYMLEN (pst);
text_offset = pst->textlow;
CORE_ADDR *lowpc, CORE_ADDR *highpc,
int need_pc, struct dwarf2_cu *cu);
-static void dwarf2_psymtab_to_symtab (struct partial_symtab *);
+static void dwarf2_psymtab_to_symtab (struct objfile *,
+ struct partial_symtab *);
static void psymtab_to_symtab_1 (struct partial_symtab *);
(objfile->global_psymbols.list + pst->globals_offset);
pst->n_static_syms = objfile->static_psymbols.next -
(objfile->static_psymbols.list + pst->statics_offset);
- sort_pst_symbols (pst);
+ sort_pst_symbols (objfile, pst);
if (!VEC_empty (dwarf2_per_cu_ptr, cu->per_cu->s.imported_symtabs))
{
(objfile->global_psymbols.list + pst->globals_offset);
pst->n_static_syms = objfile->static_psymbols.next -
(objfile->static_psymbols.list + pst->statics_offset);
- sort_pst_symbols (pst);
+ sort_pst_symbols (objfile, pst);
}
/* Traversal function for build_type_psymtabs. */
/* Expand this partial symbol table into a full symbol table. */
static void
-dwarf2_psymtab_to_symtab (struct partial_symtab *pst)
+dwarf2_psymtab_to_symtab (struct objfile *objfile, struct partial_symtab *pst)
{
if (pst != NULL)
{
}
/* Restore our global data. */
- dwarf2_per_objfile = objfile_data (pst->objfile,
- dwarf2_objfile_data_key);
+ dwarf2_per_objfile = objfile_data (objfile, dwarf2_objfile_data_key);
/* If this psymtab is constructed from a debug-only objfile, the
has_section_at_zero flag will not necessarily be correct. We
can get the correct value for this flag by looking at the data
associated with the (presumably stripped) associated objfile. */
- if (pst->objfile->separate_debug_objfile_backlink)
+ if (objfile->separate_debug_objfile_backlink)
{
struct dwarf2_per_objfile *dpo_backlink
- = objfile_data (pst->objfile->separate_debug_objfile_backlink,
+ = objfile_data (objfile->separate_debug_objfile_backlink,
dwarf2_objfile_data_key);
dwarf2_per_objfile->has_section_at_zero
static struct partial_symtab *new_psymtab (char *, struct objfile *);
-static void psymtab_to_symtab_1 (struct partial_symtab *, const char *);
+static void psymtab_to_symtab_1 (struct objfile *objfile,
+ struct partial_symtab *, const char *);
static void add_block (struct block *, struct symtab *);
and reorders the symtab list at the end. */
static void
-mdebug_psymtab_to_symtab (struct partial_symtab *pst)
+mdebug_psymtab_to_symtab (struct objfile *objfile, struct partial_symtab *pst)
{
if (!pst)
return;
next_symbol_text_func = mdebug_next_symbol_text;
- psymtab_to_symtab_1 (pst, pst->filename);
+ psymtab_to_symtab_1 (objfile, pst, pst->filename);
/* 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 (pst->objfile);
+ scan_file_globals (objfile);
if (info_verbose)
printf_filtered (_("done.\n"));
if (processing_gcc_compilation == 0
&& found_ecoff_debugging_info == 0
&& TYPE_CODE (TYPE_TARGET_TYPE (SYMBOL_TYPE (s))) == TYPE_CODE_VOID)
- SYMBOL_TYPE (s) = objfile_type (pst->objfile)->nodebug_text_symbol;
+ SYMBOL_TYPE (s) = objfile_type (mdebugread_objfile)->nodebug_text_symbol;
}
/* Parse the external symbol ES. Just call parse_symbol() after
/* Link pst to FDR. end_psymtab returns NULL if the psymtab was
empty and put on the free list. */
- fdr_to_pst[f_idx].pst = end_psymtab (save_pst,
+ fdr_to_pst[f_idx].pst = end_psymtab (objfile, save_pst,
psymtab_include_list, includes_used,
-1, save_pst->texthigh,
dependency_list, dependencies_used, textlow_not_set);
The flow of control and even the memory allocation differs. FIXME. */
static void
-psymtab_to_symtab_1 (struct partial_symtab *pst, const char *filename)
+psymtab_to_symtab_1 (struct objfile *objfile,
+ struct partial_symtab *pst, const char *filename)
{
bfd_size_type external_sym_size;
bfd_size_type external_pdr_size;
gdb_flush (gdb_stdout);
}
/* We only pass the filename for debug purposes. */
- psymtab_to_symtab_1 (pst->dependencies[i],
+ psymtab_to_symtab_1 (objfile, pst->dependencies[i],
pst->dependencies[i]->filename);
}
external_pdr_size = debug_swap->external_pdr_size;
swap_sym_in = debug_swap->swap_sym_in;
swap_pdr_in = debug_swap->swap_pdr_in;
- mdebugread_objfile = pst->objfile;
+ mdebugread_objfile = objfile;
cur_fd = FDR_IDX (pst);
fh = ((cur_fd == -1)
? (FDR *) NULL
if (processing_gcc_compilation != 0)
{
- struct gdbarch *gdbarch = get_objfile_arch (pst->objfile);
+ struct gdbarch *gdbarch = get_objfile_arch (objfile);
/* This symbol table contains stabs-in-ecoff entries. */
&& *name == '\000')
{
valu += ANOFFSET (pst->section_offsets,
- SECT_OFF_TEXT (pst->objfile));
+ SECT_OFF_TEXT (objfile));
previous_stab_code = N_SO;
- st = end_symtab (valu, pst->objfile,
- SECT_OFF_TEXT (pst->objfile));
+ st = end_symtab (valu, objfile,
+ SECT_OFF_TEXT (objfile));
end_stabs ();
last_symtab_ended = 1;
}
{
last_symtab_ended = 0;
process_one_symbol (type_code, 0, valu, name,
- pst->section_offsets, pst->objfile);
+ pst->section_offsets, objfile);
}
}
/* Similarly a hack. */
else if (name[0] == '#')
{
process_one_symbol (N_SLINE, 0, valu, name,
- pst->section_offsets, pst->objfile);
+ pst->section_offsets, objfile);
}
if (type_code == N_FUN)
{
memset (e, 0, sizeof (struct mdebug_extra_func_info));
SYMBOL_DOMAIN (s) = LABEL_DOMAIN;
SYMBOL_CLASS (s) = LOC_CONST;
- SYMBOL_TYPE (s) = objfile_type (pst->objfile)->builtin_void;
+ SYMBOL_TYPE (s) = objfile_type (objfile)->builtin_void;
SYMBOL_VALUE_BYTES (s) = (gdb_byte *) e;
e->pdr.framereg = -1;
add_symbol_to_list (s, &local_symbols);
{
/* Handle encoded stab line number. */
valu += ANOFFSET (pst->section_offsets,
- SECT_OFF_TEXT (pst->objfile));
+ SECT_OFF_TEXT (objfile));
record_line (current_subfile, sh.index,
gdbarch_addr_bits_remove (gdbarch, valu));
}
if (! last_symtab_ended)
{
- st = end_symtab (pst->texthigh, pst->objfile,
- SECT_OFF_TEXT (pst->objfile));
+ st = end_symtab (pst->texthigh, objfile,
+ SECT_OFF_TEXT (objfile));
end_stabs ();
}
if (fh == 0)
{
maxlines = 0;
- st = new_symtab ("unknown", 0, pst->objfile);
+ st = new_symtab ("unknown", 0, objfile);
}
else
{
maxlines = 2 * fh->cline;
- st = new_symtab (pst->filename, maxlines, pst->objfile);
+ st = new_symtab (pst->filename, maxlines, objfile);
/* The proper language was already determined when building
the psymtab, use it. */
c = parse_symbol (&sh,
debug_info->external_aux + fh->iauxBase,
sym_ptr, fh->fBigendian,
- pst->section_offsets, pst->objfile);
+ pst->section_offsets, objfile);
sym_ptr += c * external_sym_size;
}
ext_ptr = PST_PRIVATE (pst)->extern_tab;
for (i = PST_PRIVATE (pst)->extern_count; --i >= 0; ext_ptr++)
parse_external (ext_ptr, fh->fBigendian,
- pst->section_offsets, pst->objfile);
+ pst->section_offsets, objfile);
/* If there are undefined symbols, tell the user.
The alpha has an undefined symbol for every symbol that is
const char *dirname;
- /* Information about the object file from which symbols should be read. */
-
- struct objfile *objfile;
-
/* Set of relocation offsets to apply to each section. */
struct section_offsets *section_offsets;
/* Pointer to function which will read in the symtab corresponding to
this psymtab. */
- void (*read_symtab) (struct partial_symtab *);
+ void (*read_symtab) (struct objfile *, struct partial_symtab *);
/* Information that lets read_symtab() locate the part of the symbol table
that this psymtab corresponds to. This information is private to the
void *read_symtab_private;
};
-extern void sort_pst_symbols (struct partial_symtab *);
+extern void sort_pst_symbols (struct objfile *, struct partial_symtab *);
/* Add any kind of symbol to a psymbol_allocation_list. */
extern struct partial_symtab *allocate_psymtab (const char *,
struct objfile *);
-extern void discard_psymtab (struct partial_symtab *);
+extern void discard_psymtab (struct objfile *, struct partial_symtab *);
/* Traverse all psymtabs in one objfile. */
struct bcache *bcache;
};
-static struct partial_symbol *match_partial_symbol (struct partial_symtab *,
+static struct partial_symbol *match_partial_symbol (struct objfile *,
+ struct partial_symtab *,
int,
const char *, domain_enum,
symbol_compare_ftype *,
symbol_compare_ftype *);
-static struct partial_symbol *lookup_partial_symbol (struct partial_symtab *,
+static struct partial_symbol *lookup_partial_symbol (struct objfile *,
+ struct partial_symtab *,
const char *, int,
domain_enum);
static char *psymtab_to_fullname (struct partial_symtab *ps);
-static struct partial_symbol *find_pc_sect_psymbol (struct partial_symtab *,
+static struct partial_symbol *find_pc_sect_psymbol (struct objfile *,
+ struct partial_symtab *,
CORE_ADDR,
struct obj_section *);
*psym,
struct objfile *objfile);
-static struct symtab *psymtab_to_symtab (struct partial_symtab *pst);
+static struct symtab *psymtab_to_symtab (struct objfile *objfile,
+ struct partial_symtab *pst);
/* Ensure that the partial symbols for OBJFILE have been loaded. This
function always returns its argument, as a convenience. */
/* This may expand more than one symtab, and we want to iterate over
all of them. */
- psymtab_to_symtab (pst);
+ psymtab_to_symtab (objfile, pst);
return iterate_over_some_symtabs (name, full_path, real_path, callback, data,
objfile->symtabs, last_made);
We may find a different psymtab than PST. See FIND_PC_SECT_PSYMTAB. */
static struct partial_symtab *
-find_pc_sect_psymtab_closer (CORE_ADDR pc, struct obj_section *section,
+find_pc_sect_psymtab_closer (struct objfile *objfile,
+ CORE_ADDR pc, struct obj_section *section,
struct partial_symtab *pst,
struct minimal_symbol *msymbol)
{
- struct objfile *objfile = pst->objfile;
struct partial_symtab *tpst;
struct partial_symtab *best_pst = pst;
CORE_ADDR best_addr = pst->textlow;
corresponding msymbol, which is not necessarily
true; the debug info might be much richer than the
object's symbol table. */
- p = find_pc_sect_psymbol (tpst, pc, section);
+ p = find_pc_sect_psymbol (objfile, tpst, pc, section);
if (p != NULL
&& SYMBOL_VALUE_ADDRESS (p)
== SYMBOL_VALUE_ADDRESS (msymbol))
corresponding msymbol, which is not necessarily
true; the debug info might be much richer than the
object's symbol table. */
- p = find_pc_sect_psymbol (pst, pc, section);
+ p = find_pc_sect_psymbol (objfile, pst, pc, section);
if (!p
|| SYMBOL_VALUE_ADDRESS (p)
!= SYMBOL_VALUE_ADDRESS (msymbol))
{
struct partial_symtab *best_pst;
- best_pst = find_pc_sect_psymtab_closer (pc, section, pst, msymbol);
+ best_pst = find_pc_sect_psymtab_closer (objfile, pc, section, pst,
+ msymbol);
if (best_pst != NULL)
return best_pst;
}
continue, so let's not. */
warning (_("\
(Internal error: pc %s in read in psymtab, but not in symtab.)\n"),
- paddress (get_objfile_arch (ps->objfile), pc));
- psymtab_to_symtab (ps);
+ paddress (get_objfile_arch (objfile), pc));
+ psymtab_to_symtab (objfile, ps);
return ps->symtab;
}
return NULL;
Return 0 if none. */
static struct partial_symbol *
-find_pc_sect_psymbol (struct partial_symtab *psymtab, CORE_ADDR pc,
+find_pc_sect_psymbol (struct objfile *objfile,
+ struct partial_symtab *psymtab, CORE_ADDR pc,
struct obj_section *section)
{
struct partial_symbol *best = NULL, *p, **pp;
/* Search the global symbols as well as the static symbols, so that
find_pc_partial_function doesn't use a minimal symbol and thus
cache a bad endaddr. */
- for (pp = psymtab->objfile->global_psymbols.list + psymtab->globals_offset;
- (pp - (psymtab->objfile->global_psymbols.list + psymtab->globals_offset)
+ for (pp = objfile->global_psymbols.list + psymtab->globals_offset;
+ (pp - (objfile->global_psymbols.list + psymtab->globals_offset)
< psymtab->n_global_syms);
pp++)
{
{
if (section) /* Match on a specific section. */
{
- fixup_psymbol_section (p, psymtab->objfile);
+ fixup_psymbol_section (p, objfile);
if (!matching_obj_sections (SYMBOL_OBJ_SECTION (p), section))
continue;
}
}
}
- for (pp = psymtab->objfile->static_psymbols.list + psymtab->statics_offset;
- (pp - (psymtab->objfile->static_psymbols.list + psymtab->statics_offset)
+ for (pp = objfile->static_psymbols.list + psymtab->statics_offset;
+ (pp - (objfile->static_psymbols.list + psymtab->statics_offset)
< psymtab->n_static_syms);
pp++)
{
{
if (section) /* Match on a specific section. */
{
- fixup_psymbol_section (p, psymtab->objfile);
+ fixup_psymbol_section (p, objfile);
if (!matching_obj_sections (SYMBOL_OBJ_SECTION (p), section))
continue;
}
ALL_OBJFILE_PSYMTABS_REQUIRED (objfile, ps)
{
- if (!ps->readin && lookup_partial_symbol (ps, name, psymtab_index, domain))
+ if (!ps->readin && lookup_partial_symbol (objfile, ps, name,
+ psymtab_index, domain))
{
struct symbol *sym = NULL;
- struct symtab *stab = psymtab_to_symtab (ps);
+ struct symtab *stab = psymtab_to_symtab (objfile, ps);
/* Some caution must be observed with overloaded functions
and methods, since the psymtab will not contain any overload
with MATCH. Returns the symbol, if found, and otherwise NULL. */
static struct partial_symbol *
-match_partial_symbol (struct partial_symtab *pst, int global,
+match_partial_symbol (struct objfile *objfile,
+ struct partial_symtab *pst, int global,
const char *name, domain_enum domain,
symbol_compare_ftype *match,
symbol_compare_ftype *ordered_compare)
if (length == 0)
return NULL;
start = (global ?
- pst->objfile->global_psymbols.list + pst->globals_offset :
- pst->objfile->static_psymbols.list + pst->statics_offset);
+ objfile->global_psymbols.list + pst->globals_offset :
+ objfile->static_psymbols.list + pst->statics_offset);
if (global && ordered_compare) /* Can use a binary search. */
{
Check the global symbols if GLOBAL, the static symbols if not. */
static struct partial_symbol *
-lookup_partial_symbol (struct partial_symtab *pst, const char *name,
+lookup_partial_symbol (struct objfile *objfile,
+ struct partial_symtab *pst, const char *name,
int global, domain_enum domain)
{
struct partial_symbol **start, **psym;
search_name = psymtab_search_name (name);
cleanup = make_cleanup (xfree, search_name);
start = (global ?
- pst->objfile->global_psymbols.list + pst->globals_offset :
- pst->objfile->static_psymbols.list + pst->statics_offset);
+ objfile->global_psymbols.list + pst->globals_offset :
+ objfile->static_psymbols.list + pst->statics_offset);
if (global) /* This means we can use a binary search. */
{
This is fast after the first time you do it. */
static struct symtab *
-psymtab_to_symtab (struct partial_symtab *pst)
+psymtab_to_symtab (struct objfile *objfile, struct partial_symtab *pst)
{
/* If it is a shared psymtab, find an unshared psymtab that includes
it. Any such psymtab will do. */
{
struct cleanup *back_to = increment_reading_symtab ();
- (*pst->read_symtab) (pst);
+ (*pst->read_symtab) (objfile, pst);
do_cleanups (back_to);
}
"readin pst found and no symtabs."));
}
else
- return psymtab_to_symtab (cs_pst);
+ return psymtab_to_symtab (ofp, cs_pst);
}
return NULL;
}
}
fprintf_filtered (outfile, " Relocate symbols by ");
- for (i = 0; i < psymtab->objfile->num_sections; ++i)
+ for (i = 0; i < objfile->num_sections; ++i)
{
if (i != 0)
fprintf_filtered (outfile, ", ");
psymtab->filename);
gdb_print_host_address (psymtab, gdb_stdout);
printf_filtered (", ");
- if (psymtab->objfile != objfile)
- {
- printf_filtered ("NOT ON CHAIN! ");
- }
wrap_here (" ");
}
printf_filtered ("\n\n");
if (ps->readin)
continue;
- if ((lookup_partial_symbol (ps, func_name, 1, VAR_DOMAIN)
+ if ((lookup_partial_symbol (objfile, ps, func_name, 1, VAR_DOMAIN)
!= NULL)
- || (lookup_partial_symbol (ps, func_name, 0, VAR_DOMAIN)
+ || (lookup_partial_symbol (objfile, ps, func_name, 0, VAR_DOMAIN)
!= NULL))
- psymtab_to_symtab (ps);
+ psymtab_to_symtab (objfile, ps);
}
}
ALL_OBJFILE_PSYMTABS_REQUIRED (objfile, psymtab)
{
- psymtab_to_symtab (psymtab);
+ psymtab_to_symtab (objfile, psymtab);
}
}
continue;
if (filename_cmp (filename, p->filename) == 0)
- psymtab_to_symtab (p);
+ psymtab_to_symtab (objfile, p);
}
}
ALL_OBJFILE_PSYMTABS_REQUIRED (objfile, pst)
{
- if (lookup_partial_symbol (pst, name, 1, VAR_DOMAIN))
+ if (lookup_partial_symbol (objfile, pst, name, 1, VAR_DOMAIN))
return pst->filename;
}
return NULL;
{
QUIT;
if (ps->readin
- || match_partial_symbol (ps, global, name, namespace, match,
+ || match_partial_symbol (objfile, ps, global, name, namespace, match,
ordered_compare))
{
- struct symtab *s = psymtab_to_symtab (ps);
+ struct symtab *s = psymtab_to_symtab (objfile, ps);
struct block *block;
if (s == NULL || !s->primary)
}
if (recursively_search_psymtabs (ps, objfile, kind, name_matcher, data))
- psymtab_to_symtab (ps);
+ psymtab_to_symtab (objfile, ps);
}
}
}
void
-sort_pst_symbols (struct partial_symtab *pst)
+sort_pst_symbols (struct objfile *objfile, struct partial_symtab *pst)
{
/* Sort the global list; don't sort the static list. */
- qsort (pst->objfile->global_psymbols.list + pst->globals_offset,
+ qsort (objfile->global_psymbols.list + pst->globals_offset,
pst->n_global_syms, sizeof (struct partial_symbol *),
compare_psymbols);
}
Psymtabs are searched in most recent inserted -> least recent
inserted order. */
- psymtab->objfile = objfile;
psymtab->next = objfile->psymtabs;
objfile->psymtabs = psymtab;
}
void
-discard_psymtab (struct partial_symtab *pst)
+discard_psymtab (struct objfile *objfile, struct partial_symtab *pst)
{
struct partial_symtab **prev_pst;
/* First, snip it out of the psymtab chain. */
- prev_pst = &(pst->objfile->psymtabs);
+ prev_pst = &(objfile->psymtabs);
while ((*prev_pst) != pst)
prev_pst = &((*prev_pst)->next);
(*prev_pst) = pst->next;
/* Next, put it on a free list for recycling. */
- pst->next = pst->objfile->free_psymtabs;
- pst->objfile->free_psymtabs = pst;
+ pst->next = objfile->free_psymtabs;
+ objfile->free_psymtabs = pst;
}
\f
if (psymtab->n_global_syms)
{
printf_filtered ("(* (struct partial_symbol **) %s @ %d)\n",
- host_address_to_string (psymtab->objfile->global_psymbols.list
+ host_address_to_string (objfile->global_psymbols.list
+ psymtab->globals_offset),
psymtab->n_global_syms);
}
if (psymtab->n_static_syms)
{
printf_filtered ("(* (struct partial_symbol **) %s @ %d)\n",
- host_address_to_string (psymtab->objfile->static_psymbols.list
+ host_address_to_string (objfile->static_psymbols.list
+ psymtab->statics_offset),
psymtab->n_static_syms);
}
{
struct gdbarch *gdbarch = get_objfile_arch (objfile);
- s = psymtab_to_symtab (ps);
+ s = psymtab_to_symtab (objfile, ps);
if (s == NULL)
continue;
bv = BLOCKVECTOR (s);
b = BLOCKVECTOR_BLOCK (bv, STATIC_BLOCK);
- psym = ps->objfile->static_psymbols.list + ps->statics_offset;
+ psym = objfile->static_psymbols.list + ps->statics_offset;
length = ps->n_static_syms;
while (length--)
{
psym++;
}
b = BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK);
- psym = ps->objfile->global_psymbols.list + ps->globals_offset;
+ psym = objfile->global_psymbols.list + ps->globals_offset;
length = ps->n_global_syms;
while (length--)
{
/* Functions exported by dbxread.c. These are not in stabsread.c because
they are only used by some stabs readers. */
-extern struct partial_symtab *end_psymtab (struct partial_symtab *pst,
+extern struct partial_symtab *end_psymtab (struct objfile *objfile,
+ struct partial_symtab *pst,
const char **include_list,
int num_includes,
int capping_symbol_offset,
static struct symbol *process_xcoff_symbol (struct coff_symbol *,
struct objfile *);
-static void read_xcoff_symtab (struct partial_symtab *);
+static void read_xcoff_symtab (struct objfile *, struct partial_symtab *);
#if 0
static void add_stab_to_list (char *, struct pending_stabs **);
in psymtab to symtab processing. */
static struct partial_symtab *this_symtab_psymtab;
+/* Objfile related to this_symtab_psymtab; set at the same time. */
+static struct objfile *this_symtab_objfile;
+
/* given the start and end addresses of a compilation unit (or a csect,
at times) process its lines and create appropriate line vectors. */
{
int offset, ii;
file_ptr max_offset
- = XCOFF_DATA (this_symtab_psymtab->objfile)->max_lineno_offset;
+ = XCOFF_DATA (this_symtab_objfile)->max_lineno_offset;
/* subfile structure for the main compilation unit. */
struct subfile main_subfile;
/* There was source with line numbers in include files. */
int linesz =
- coff_data (this_symtab_psymtab->objfile->obfd)->local_linesz;
+ coff_data (this_symtab_objfile->obfd)->local_linesz;
main_source_baseline = 0;
for (ii = 0; ii < inclIndx; ++ii)
CORE_ADDR startaddr, /* offsets to line table */
CORE_ADDR endaddr, unsigned *firstLine)
{
- struct objfile *objfile = this_symtab_psymtab->objfile;
+ struct objfile *objfile = this_symtab_objfile;
struct gdbarch *gdbarch = get_objfile_arch (objfile);
unsigned int curoffset;
CORE_ADDR addr;
char *retval;
/* FIXME: is this the same as the passed arg? */
- if (this_symtab_psymtab)
- objfile = this_symtab_psymtab->objfile;
+ if (this_symtab_objfile)
+ objfile = this_symtab_objfile;
bfd_coff_swap_sym_in (objfile->obfd, raw_symbol, &symbol);
if (symbol.n_zeroes)
/* Read symbols for a given partial symbol table. */
static void
-read_xcoff_symtab (struct partial_symtab *pst)
+read_xcoff_symtab (struct objfile *objfile, struct partial_symtab *pst)
{
- struct objfile *objfile = pst->objfile;
bfd *abfd = objfile->obfd;
char *raw_auxptr; /* Pointer to first raw aux entry for sym. */
struct coff_symfile_info *xcoff = XCOFF_DATA (objfile);
const char *last_csect_name; /* Last seen csect's name. */
this_symtab_psymtab = pst;
+ this_symtab_objfile = objfile;
/* Get the appropriate COFF "constants" related to the file we're
handling. */
static void
read_symbol (struct internal_syment *symbol, int symno)
{
- struct coff_symfile_info *xcoff = XCOFF_DATA (this_symtab_psymtab->objfile);
+ struct coff_symfile_info *xcoff = XCOFF_DATA (this_symtab_objfile);
int nsyms = xcoff->symtbl_num_syms;
char *stbl = xcoff->symtbl;
symbol->n_scnum = -1;
return;
}
- bfd_coff_swap_sym_in (this_symtab_psymtab->objfile->obfd,
+ bfd_coff_swap_sym_in (this_symtab_objfile->obfd,
stbl + (symno * local_symesz),
symbol);
}
static int
read_symbol_lineno (int symno)
{
- struct objfile *objfile = this_symtab_psymtab->objfile;
+ struct objfile *objfile = this_symtab_objfile;
int xcoff64 = bfd_xcoff_is_xcoff64 (objfile->obfd);
struct coff_symfile_info *info = XCOFF_DATA (objfile);
info->max_lineno_offset = maxoff;
}
\f
-static void xcoff_psymtab_to_symtab_1 (struct partial_symtab *);
-
static void
-xcoff_psymtab_to_symtab_1 (struct partial_symtab *pst)
+xcoff_psymtab_to_symtab_1 (struct objfile *objfile, struct partial_symtab *pst)
{
struct cleanup *old_chain;
int i;
wrap_here (""); /* Flush output */
gdb_flush (gdb_stdout);
}
- xcoff_psymtab_to_symtab_1 (pst->dependencies[i]);
+ xcoff_psymtab_to_symtab_1 (objfile, pst->dependencies[i]);
}
if (((struct symloc *) pst->read_symtab_private)->numsyms != 0)
buildsym_init ();
old_chain = make_cleanup (really_free_pendings, 0);
- read_xcoff_symtab (pst);
+ read_xcoff_symtab (objfile, pst);
do_cleanups (old_chain);
}
pst->readin = 1;
}
-static void xcoff_psymtab_to_symtab (struct partial_symtab *);
-
/* Read in all of the symbols for a given psymtab for real.
Be verbose about it if the user wants that. */
static void
-xcoff_psymtab_to_symtab (struct partial_symtab *pst)
+xcoff_psymtab_to_symtab (struct objfile *objfile, struct partial_symtab *pst)
{
- bfd *sym_bfd;
-
if (!pst)
return;
gdb_flush (gdb_stdout);
}
- sym_bfd = pst->objfile->obfd;
-
next_symbol_text_func = xcoff_next_symbol_text;
- xcoff_psymtab_to_symtab_1 (pst);
+ xcoff_psymtab_to_symtab_1 (objfile, pst);
/* 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 (pst->objfile);
+ scan_file_globals (objfile);
/* Finish up the debug error message. */
if (info_verbose)
are the information for includes and dependencies. */
static struct partial_symtab *
-xcoff_end_psymtab (struct partial_symtab *pst, const char **include_list,
- int num_includes, int capping_symbol_number,
+xcoff_end_psymtab (struct objfile *objfile, struct partial_symtab *pst,
+ const char **include_list, int num_includes,
+ int capping_symbol_number,
struct partial_symtab **dependency_list,
int number_dependencies, int textlow_not_set)
{
int i;
- struct objfile *objfile = pst->objfile;
if (capping_symbol_number != -1)
((struct symloc *) pst->read_symtab_private)->numsyms =
subpst->read_symtab = pst->read_symtab;
}
- sort_pst_symbols (pst);
+ sort_pst_symbols (objfile, pst);
if (num_includes == 0
&& number_dependencies == 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 (pst);
+ discard_psymtab (objfile, pst);
/* Indicate that psymtab was thrown away. */
pst = (struct partial_symtab *) NULL;
each program csect, because their text
sections need not be adjacent. */
xcoff_end_psymtab
- (pst, psymtab_include_list, includes_used,
- symnum_before, dependency_list,
+ (objfile, pst, psymtab_include_list,
+ includes_used, symnum_before, dependency_list,
dependencies_used, textlow_not_set);
includes_used = 0;
dependencies_used = 0;
if (pst)
{
- xcoff_end_psymtab (pst, psymtab_include_list, includes_used,
- symnum_before, dependency_list,
- dependencies_used, textlow_not_set);
+ xcoff_end_psymtab (objfile, pst, psymtab_include_list,
+ includes_used, symnum_before,
+ dependency_list, dependencies_used,
+ textlow_not_set);
includes_used = 0;
dependencies_used = 0;
}
if (pst)
{
- xcoff_end_psymtab (pst, psymtab_include_list, includes_used,
+ xcoff_end_psymtab (objfile, pst, psymtab_include_list, includes_used,
ssymnum, dependency_list,
dependencies_used, textlow_not_set);
}