CORE_ADDR,
struct obj_section *);
-static void fixup_psymbol_section (struct partial_symbol *psym,
- struct objfile *objfile);
-
static struct compunit_symtab *psymtab_to_symtab (struct objfile *objfile,
struct partial_symtab *pst);
if (objfile->sf->sym_read_psymbols)
{
if (verbose)
- {
- printf_unfiltered (_("Reading symbols from %s..."),
- objfile_name (objfile));
- gdb_flush (gdb_stdout);
- }
+ printf_filtered (_("Reading symbols from %s...\n"),
+ objfile_name (objfile));
(*objfile->sf->sym_read_psymbols) (objfile);
/* Partial symbols list are not expected to changed after this
objfile->global_psymbols.shrink_to_fit ();
objfile->static_psymbols.shrink_to_fit ();
- if (verbose)
- {
- if (!objfile_has_symbols (objfile))
- {
- wrap_here ("");
- printf_unfiltered (_("(no debugging symbols found)..."));
- wrap_here ("");
- }
-
- printf_unfiltered (_("done.\n"));
- }
+ if (verbose && !objfile_has_symbols (objfile))
+ printf_filtered (_("(No debugging symbols found in %s)\n"),
+ objfile_name (objfile));
}
}
{
struct partial_symtab *tpst;
struct partial_symtab *best_pst = pst;
- CORE_ADDR best_addr = pst->textlow;
+ CORE_ADDR best_addr = pst->text_low (objfile);
gdb_assert (!pst->psymtabs_addrmap_supported);
that is closest and still less than the given PC. */
for (tpst = pst; tpst != NULL; tpst = tpst->next)
{
- if (pc >= tpst->textlow && pc < tpst->texthigh)
+ if (pc >= tpst->text_low (objfile) && pc < tpst->text_high (objfile))
{
struct partial_symbol *p;
CORE_ADDR this_addr;
if (p != NULL)
this_addr = p->address (objfile);
else
- this_addr = tpst->textlow;
+ this_addr = tpst->text_low (objfile);
/* Check whether it is closer than our current
BEST_ADDR. Since this symbol address is
struct bound_minimal_symbol msymbol)
{
struct partial_symtab *pst;
+ CORE_ADDR baseaddr = ANOFFSET (objfile->section_offsets,
+ SECT_OFF_TEXT (objfile));
/* Try just the PSYMTABS_ADDRMAP mapping first as it has better granularity
than the later used TEXTLOW/TEXTHIGH one. */
if (objfile->psymtabs_addrmap != NULL)
{
pst = ((struct partial_symtab *)
- addrmap_find (objfile->psymtabs_addrmap, pc));
+ addrmap_find (objfile->psymtabs_addrmap, pc - baseaddr));
if (pst != NULL)
{
/* FIXME: addrmaps currently do not handle overlayed sections,
ALL_OBJFILE_PSYMTABS_REQUIRED (objfile, pst)
if (!pst->psymtabs_addrmap_supported
- && pc >= pst->textlow && pc < pst->texthigh)
+ && pc >= pst->text_low (objfile) && pc < pst->text_high (objfile))
{
struct partial_symtab *best_pst;
{
struct partial_symbol *best = NULL;
CORE_ADDR best_pc;
+ const CORE_ADDR textlow = psymtab->text_low (objfile);
gdb_assert (psymtab != NULL);
/* Cope with programs that start at address 0. */
- best_pc = (psymtab->textlow != 0) ? psymtab->textlow - 1 : 0;
+ best_pc = (textlow != 0) ? textlow - 1 : 0;
/* Search the global symbols as well as the static symbols, so that
find_pc_partial_function doesn't use a minimal symbol and thus
&& p->aclass == LOC_BLOCK
&& pc >= p->address (objfile)
&& (p->address (objfile) > best_pc
- || (psymtab->textlow == 0
+ || (psymtab->text_low (objfile) == 0
&& best_pc == 0 && p->address (objfile) == 0)))
{
if (section != NULL) /* Match on a specific section. */
{
- fixup_psymbol_section (p, objfile);
if (!matching_obj_sections (p->obj_section (objfile),
section))
continue;
&& p->aclass == LOC_BLOCK
&& pc >= p->address (objfile)
&& (p->address (objfile) > best_pc
- || (psymtab->textlow == 0
+ || (psymtab->text_low (objfile) == 0
&& best_pc == 0 && p->address (objfile) == 0)))
{
if (section != NULL) /* Match on a specific section. */
{
- fixup_psymbol_section (p, objfile);
if (!matching_obj_sections (p->obj_section (objfile),
section))
continue;
return best;
}
-static void
-fixup_psymbol_section (struct partial_symbol *psym, struct objfile *objfile)
-{
- CORE_ADDR addr;
-
- if (psym == NULL)
- return;
-
- if (psym->section >= 0)
- return;
-
- gdb_assert (objfile);
-
- switch (psym->aclass)
- {
- case LOC_STATIC:
- case LOC_LABEL:
- case LOC_BLOCK:
- addr = psym->address (objfile);
- break;
- default:
- /* Nothing else will be listed in the minsyms -- no use looking
- it up. */
- return;
- }
-
- fixup_section (psym, addr, objfile);
-}
-
/* Psymtab version of lookup_symbol. See its definition in
the definition of quick_symbol_functions in symfile.h. */
return pst->compunit_symtab;
}
-/* Psymtab version of relocate. See its definition in
- the definition of quick_symbol_functions in symfile.h. */
-
-static void
-psym_relocate (struct objfile *objfile,
- const struct section_offsets *new_offsets,
- const struct section_offsets *delta)
-{
- struct partial_symtab *p;
-
- ALL_OBJFILE_PSYMTABS_REQUIRED (objfile, p)
- {
- p->textlow += ANOFFSET (delta, SECT_OFF_TEXT (objfile));
- p->texthigh += ANOFFSET (delta, SECT_OFF_TEXT (objfile));
- }
-
- for (partial_symbol *psym : objfile->global_psymbols)
- {
- fixup_psymbol_section (psym, objfile);
- if (psym->section >= 0)
- psym->set_address (psym->unrelocated_address ()
- + ANOFFSET (delta, psym->section));
- }
- for (partial_symbol *psym : objfile->static_psymbols)
- {
- fixup_psymbol_section (psym, objfile);
- if (psym->section >= 0)
- psym->set_address (psym->unrelocated_address ()
- + ANOFFSET (delta, psym->section));
- }
-
- objfile->psymbol_map.clear ();
-}
-
/* Psymtab version of find_last_source_symtab. See its definition in
the definition of quick_symbol_functions in symfile.h. */
fprintf_filtered (outfile, "(object ");
gdb_print_host_address (psymtab, outfile);
fprintf_filtered (outfile, ")\n\n");
- fprintf_unfiltered (outfile, " Read from object file %s (",
- objfile_name (objfile));
+ fprintf_filtered (outfile, " Read from object file %s (",
+ objfile_name (objfile));
gdb_print_host_address (objfile, outfile);
- fprintf_unfiltered (outfile, ")\n");
+ fprintf_filtered (outfile, ")\n");
if (psymtab->readin)
{
}
fprintf_filtered (outfile, " Symbols cover text addresses ");
- fputs_filtered (paddress (gdbarch, psymtab->textlow), outfile);
+ fputs_filtered (paddress (gdbarch, psymtab->text_low (objfile)), outfile);
fprintf_filtered (outfile, "-");
- fputs_filtered (paddress (gdbarch, psymtab->texthigh), outfile);
+ fputs_filtered (paddress (gdbarch, psymtab->text_high (objfile)), outfile);
fprintf_filtered (outfile, "\n");
fprintf_filtered (outfile, " Address map supported - %s.\n",
psymtab->psymtabs_addrmap_supported ? "yes" : "no");
if (ps->fullname == NULL)
{
gdb::unique_xmalloc_ptr<char> fullname;
- int fd = find_and_open_source (ps->filename, ps->dirname, &fullname);
+ scoped_fd fd = find_and_open_source (ps->filename, ps->dirname,
+ &fullname);
ps->fullname = fullname.release ();
- if (fd >= 0)
- close (fd);
- else
+ if (fd.get () < 0)
{
/* rewrite_source_path would be applied by find_and_open_source, we
should report the pathname where GDB tried to find the file. */
static bool
recursively_search_psymtabs
- (struct partial_symtab *ps, struct objfile *objfile, enum search_domain domain,
+ (struct partial_symtab *ps,
+ struct objfile *objfile,
+ enum search_domain domain,
const lookup_name_info &lookup_name,
gdb::function_view<expand_symtabs_symbol_matcher_ftype> sym_matcher)
{
psym_lookup_symbol,
psym_print_stats,
psym_dump,
- psym_relocate,
psym_expand_symtabs_for_function,
psym_expand_all_symtabs,
psym_expand_symtabs_with_fullname,
struct partial_symtab *psymtab;
psymtab = allocate_psymtab (filename, objfile);
- psymtab->textlow = textlow;
- psymtab->texthigh = psymtab->textlow; /* default */
+ psymtab->set_text_low (textlow);
+ psymtab->set_text_high (psymtab->raw_text_low ()); /* default */
psymtab->globals_offset = global_psymbols.size ();
psymtab->statics_offset = static_psymbols.size ();
return psymtab;
add_psymbol_to_bcache (const char *name, int namelength, int copy_name,
domain_enum domain,
enum address_class theclass,
+ short section,
CORE_ADDR coreaddr,
enum language language, struct objfile *objfile,
int *added)
{
struct partial_symbol psymbol;
- psymbol.set_address (coreaddr);
- psymbol.section = -1;
+ psymbol.set_unrelocated_address (coreaddr);
+ psymbol.section = section;
psymbol.domain = domain;
psymbol.aclass = theclass;
add_psymbol_to_list (const char *name, int namelength, int copy_name,
domain_enum domain,
enum address_class theclass,
+ short section,
std::vector<partial_symbol *> *list,
CORE_ADDR coreaddr,
enum language language, struct objfile *objfile)
/* Stash the partial symbol away in the cache. */
psym = add_psymbol_to_bcache (name, namelength, copy_name, domain, theclass,
- coreaddr, language, objfile, &added);
+ section, coreaddr, language, objfile, &added);
/* Do not duplicate global partial symbols. */
if (list == &objfile->global_psymbols
{
xfree (last_objfile_name);
last_objfile_name = xstrdup (objfile_name (objfile));
- fprintf_unfiltered (gdb_stdlog,
- "Creating one or more psymtabs for objfile %s ...\n",
- last_objfile_name);
+ fprintf_filtered (gdb_stdlog,
+ "Creating one or more psymtabs for objfile %s ...\n",
+ last_objfile_name);
}
- fprintf_unfiltered (gdb_stdlog,
- "Created psymtab %s for module %s.\n",
- host_address_to_string (psymtab), filename);
+ fprintf_filtered (gdb_stdlog,
+ "Created psymtab %s for module %s.\n",
+ host_address_to_string (psymtab), filename);
}
return psymtab;
psymtab->fullname
? psymtab->fullname : "(null)");
printf_filtered (" text addresses ");
- fputs_filtered (paddress (gdbarch, psymtab->textlow),
+ fputs_filtered (paddress (gdbarch, psymtab->text_low (objfile)),
gdb_stdout);
printf_filtered (" -- ");
- fputs_filtered (paddress (gdbarch, psymtab->texthigh),
+ fputs_filtered (paddress (gdbarch, psymtab->text_high (objfile)),
gdb_stdout);
printf_filtered ("\n");
printf_filtered (" psymtabs_addrmap_supported %s\n",
cust = ps->compunit_symtab;
/* First do some checks that don't require the associated symtab. */
- if (ps->texthigh < ps->textlow)
+ if (ps->text_high (objfile) < ps->text_low (objfile))
{
printf_filtered ("Psymtab ");
puts_filtered (ps->filename);
printf_filtered (" covers bad range ");
- fputs_filtered (paddress (gdbarch, ps->textlow), gdb_stdout);
+ fputs_filtered (paddress (gdbarch, ps->text_low (objfile)),
+ gdb_stdout);
printf_filtered (" - ");
- fputs_filtered (paddress (gdbarch, ps->texthigh), gdb_stdout);
+ fputs_filtered (paddress (gdbarch, ps->text_high (objfile)),
+ gdb_stdout);
printf_filtered ("\n");
continue;
}
}
psym++;
}
- if (ps->texthigh != 0
- && (ps->textlow < BLOCK_START (b) || ps->texthigh > BLOCK_END (b)))
+ if (ps->raw_text_high () != 0
+ && (ps->text_low (objfile) < BLOCK_START (b)
+ || ps->text_high (objfile) > BLOCK_END (b)))
{
printf_filtered ("Psymtab ");
puts_filtered (ps->filename);
printf_filtered (" covers ");
- fputs_filtered (paddress (gdbarch, ps->textlow), gdb_stdout);
+ fputs_filtered (paddress (gdbarch, ps->text_low (objfile)),
+ gdb_stdout);
printf_filtered (" - ");
- fputs_filtered (paddress (gdbarch, ps->texthigh), gdb_stdout);
+ fputs_filtered (paddress (gdbarch, ps->text_high (objfile)),
+ gdb_stdout);
printf_filtered (" but symtab covers only ");
fputs_filtered (paddress (gdbarch, BLOCK_START (b)), gdb_stdout);
printf_filtered (" - ");