if (pst->user != NULL)
continue;
+ /* Anonymous psymtabs don't have a file name. */
+ if (pst->anonymous)
+ continue;
+
if (FILENAME_CMP (name, pst->filename) == 0
|| (!is_abs && compare_filenames_for_search (pst->filename,
name, name_len)))
warning (_("\
(Internal error: pc %s in read in psymtab, but not in symtab.)\n"),
paddress (get_objfile_arch (ps->objfile), pc));
- return psymtab_to_symtab (ps);
+ psymtab_to_symtab (ps);
+ return ps->symtab;
}
return NULL;
}
{
struct partial_symtab *ps;
const int psymtab_index = (block_index == GLOBAL_BLOCK ? 1 : 0);
+ struct symtab *stab_best = NULL;
ALL_OBJFILE_PSYMTABS_REQUIRED (objfile, ps)
{
}
if (sym && strcmp_iw (SYMBOL_SEARCH_NAME (sym), name) == 0)
- return stab;
+ {
+ if (!TYPE_IS_OPAQUE (SYMBOL_TYPE (sym)))
+ return stab;
+
+ stab_best = stab;
+ }
/* Keep looking through other psymtabs. */
}
}
- return NULL;
+ return stab_best;
}
/* Look in PST for a symbol in DOMAIN whose name matches NAME. Search
fprintf_filtered (outfile, " %s partial symbols:\n", what);
while (count-- > 0)
{
+ QUIT;
fprintf_filtered (outfile, " `%s'", SYMBOL_LINKAGE_NAME (*p));
if (SYMBOL_DEMANGLED_NAME (*p) != NULL)
{
struct gdbarch *gdbarch = get_objfile_arch (objfile);
int i;
- fprintf_filtered (outfile, "\nPartial symtab for source file %s ",
- psymtab->filename);
+ if (psymtab->anonymous)
+ {
+ fprintf_filtered (outfile, "\nAnonymous partial symtab (%s) ",
+ psymtab->filename);
+ }
+ else
+ {
+ fprintf_filtered (outfile, "\nPartial symtab for source file %s ",
+ psymtab->filename);
+ }
fprintf_filtered (outfile, "(object ");
gdb_print_host_address (psymtab, outfile);
fprintf_filtered (outfile, ")\n\n");
ALL_OBJFILE_PSYMTABS_REQUIRED (objfile, p)
{
+ /* Anonymous psymtabs don't have a name of a source file. */
+ if (p->anonymous)
+ continue;
+
if (filename_cmp (filename, p->filename) == 0)
psymtab_to_symtab (p);
}
if (ps->readin)
continue;
+ /* We can skip shared psymtabs here, because any file name will be
+ attached to the unshared psymtab. */
+ if (ps->user != NULL)
+ continue;
+
+ /* Anonymous psymtabs don't have a file name. */
+ if (ps->anonymous)
+ continue;
+
QUIT;
if (need_fullname)
fullname = psymtab_to_fullname (ps);
if (!ps)
return NULL;
+ if (ps->anonymous)
+ return NULL;
/* Use cached copy if we have it.
We rely on forget_cached_source_info being called appropriately
if (ps->user != NULL)
continue;
- if (file_matcher && ! (*file_matcher) (ps->filename, data))
- continue;
+ if (file_matcher)
+ {
+ if (ps->anonymous)
+ continue;
+ if (! (*file_matcher) (ps->filename, data))
+ continue;
+ }
if (recursively_search_psymtabs (ps, objfile, kind, name_matcher, data))
psymtab_to_symtab (ps);
psymtab->next = objfile->psymtabs;
objfile->psymtabs = psymtab;
+ if (symtab_create_debug)
+ {
+ /* Be a bit clever with debugging messages, and don't print objfile
+ every time, only when it changes. */
+ static char *last_objfile_name = NULL;
+
+ if (last_objfile_name == NULL
+ || strcmp (last_objfile_name, objfile->name) != 0)
+ {
+ xfree (last_objfile_name);
+ last_objfile_name = xstrdup (objfile->name);
+ fprintf_unfiltered (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);
+ }
+
return (psymtab);
}
perror_with_name (filename);
make_cleanup_ui_file_delete (outfile);
- immediate_quit++;
ALL_PSYMTABS (objfile, ps)
- if (symname == NULL || filename_cmp (symname, ps->filename) == 0)
- dump_psymtab (objfile, ps, outfile);
- immediate_quit--;
+ {
+ QUIT;
+ if (symname == NULL || filename_cmp (symname, ps->filename) == 0)
+ dump_psymtab (objfile, ps, outfile);
+ }
do_cleanups (cleanups);
}