diff options
Diffstat (limited to 'gdb/psymtab.c')
-rw-r--r-- | gdb/psymtab.c | 105 |
1 files changed, 50 insertions, 55 deletions
diff --git a/gdb/psymtab.c b/gdb/psymtab.c index 986ef44..413212d 100644 --- a/gdb/psymtab.c +++ b/gdb/psymtab.c @@ -228,7 +228,7 @@ find_pc_sect_psymbol (struct objfile *objfile, for (const partial_symbol *p : psymtab->global_psymbols) { if (p->domain == VAR_DOMAIN - && p->aclass == LOC_BLOCK + && p->loc_class == LOC_BLOCK && pc >= p->address (objfile) && (p->address (objfile) > best_pc || (psymtab->text_low (objfile) == 0 @@ -248,7 +248,7 @@ find_pc_sect_psymbol (struct objfile *objfile, for (const partial_symbol *p : psymtab->static_psymbols) { if (p->domain == VAR_DOMAIN - && p->aclass == LOC_BLOCK + && p->loc_class == LOC_BLOCK && pc >= p->address (objfile) && (p->address (objfile) > best_pc || (psymtab->text_low (objfile) == 0 @@ -537,7 +537,7 @@ print_partial_symbols (struct gdbarch *gdbarch, struct objfile *objfile, gdb_puts ("<invalid domain>, ", outfile); break; } - switch (p->aclass) + switch (p->loc_class) { case LOC_UNDEF: gdb_puts ("undefined", outfile); @@ -790,7 +790,7 @@ psymtab_to_fullname (struct partial_symtab *ps) return ps->fullname; } -/* A helper for psym_expand_symtabs_matching that handles searching +/* A helper for psymbol_functions::search that handles searching included psymtabs. This returns true if a symbol is found, and false otherwise. It also updates the 'searched_flag' on the various psymtabs that it searches. */ @@ -800,7 +800,7 @@ recursively_search_psymtabs (partial_symtab *ps, objfile *objfile, block_search_flags search_flags, domain_search_flags domain, const lookup_name_info &lookup_name, - expand_symtabs_symbol_matcher sym_matcher) + search_symtabs_symbol_matcher sym_matcher) { int keep_going = 1; enum psymtab_search_status result = PST_SEARCHED_AND_NOT_FOUND; @@ -885,19 +885,19 @@ recursively_search_psymtabs (partial_symtab *ps, objfile *objfile, return result == PST_SEARCHED_AND_FOUND; } -/* Psymtab version of expand_symtabs_matching. See its definition in +/* Psymtab version of search. See its definition in the definition of quick_symbol_functions in symfile.h. */ bool -psymbol_functions::expand_symtabs_matching +psymbol_functions::search (struct objfile *objfile, - expand_symtabs_file_matcher file_matcher, + search_symtabs_file_matcher file_matcher, const lookup_name_info *lookup_name, - expand_symtabs_symbol_matcher symbol_matcher, - expand_symtabs_expansion_listener expansion_notify, + search_symtabs_symbol_matcher symbol_matcher, + search_symtabs_expansion_listener listener, block_search_flags search_flags, domain_search_flags domain, - expand_symtabs_lang_matcher lang_matcher ATTRIBUTE_UNUSED) + search_symtabs_lang_matcher lang_matcher ATTRIBUTE_UNUSED) { /* Clear the search flags. */ for (partial_symtab *ps : partial_symbols (objfile)) @@ -914,9 +914,6 @@ psymbol_functions::expand_symtabs_matching { QUIT; - if (ps->readin_p (objfile)) - continue; - if (file_matcher) { bool match; @@ -944,8 +941,8 @@ psymbol_functions::expand_symtabs_matching { compunit_symtab *cust = psymtab_to_symtab (objfile, ps); - if (cust != nullptr && expansion_notify != nullptr) - if (!expansion_notify (cust)) + if (cust != nullptr && listener != nullptr) + if (!listener (cust)) return false; } } @@ -1022,12 +1019,12 @@ psymbol_bcache::hash (const void *addr, int length) struct partial_symbol *psymbol = (struct partial_symbol *) addr; unsigned int lang = psymbol->ginfo.language (); unsigned int domain = psymbol->domain; - unsigned int theclass = psymbol->aclass; + unsigned int loc_class = psymbol->loc_class; h = fast_hash (&psymbol->ginfo.m_value, sizeof (psymbol->ginfo.m_value), h); h = fast_hash (&lang, sizeof (unsigned int), h); h = fast_hash (&domain, sizeof (unsigned int), h); - h = fast_hash (&theclass, sizeof (unsigned int), h); + h = fast_hash (&loc_class, sizeof (unsigned int), h); /* Note that psymbol names are interned via compute_and_set_names, so there's no need to hash the contents of the name here. */ h = fast_hash (&psymbol->ginfo.m_name, sizeof (psymbol->ginfo.m_name), h); @@ -1047,7 +1044,7 @@ psymbol_bcache::compare (const void *addr1, const void *addr2, int length) sizeof (sym1->ginfo.m_value)) == 0 && sym1->ginfo.language () == sym2->ginfo.language () && sym1->domain == sym2->domain - && sym1->aclass == sym2->aclass + && sym1->loc_class == sym2->loc_class /* Note that psymbol names are interned via compute_and_set_names, so there's no need to compare the contents of the name here. */ @@ -1085,7 +1082,7 @@ partial_symtab::add_psymbol (const partial_symbol &psymbol, void partial_symtab::add_psymbol (std::string_view name, bool copy_name, domain_enum domain, - enum address_class theclass, + location_class loc_class, int section, psymbol_placement where, unrelocated_addr coreaddr, @@ -1099,7 +1096,7 @@ partial_symtab::add_psymbol (std::string_view name, bool copy_name, psymbol.set_unrelocated_address (coreaddr); psymbol.ginfo.set_section_index (section); psymbol.domain = domain; - psymbol.aclass = theclass; + psymbol.loc_class = loc_class; psymbol.ginfo.set_language (language, partial_symtabs->obstack ()); psymbol.ginfo.compute_and_set_names (name, copy_name, objfile->per_bfd); @@ -1262,7 +1259,7 @@ maintenance_print_psymbols (const char *args, int from_tty) } found = 0; - for (objfile *objfile : current_program_space->objfiles ()) + for (objfile &objfile : current_program_space->objfiles ()) { int printed_objfile_header = 0; int print_for_objfile = 1; @@ -1270,12 +1267,12 @@ maintenance_print_psymbols (const char *args, int from_tty) QUIT; if (objfile_arg != NULL) print_for_objfile - = compare_filenames_for_search (objfile_name (objfile), + = compare_filenames_for_search (objfile_name (&objfile), objfile_arg); if (!print_for_objfile) continue; - for (const auto &iter : objfile->qf) + for (const auto &iter : objfile.qf) { psymbol_functions *psf = dynamic_cast<psymbol_functions *> (iter.get ()); @@ -1289,22 +1286,22 @@ maintenance_print_psymbols (const char *args, int from_tty) /* We don't assume each pc has a unique objfile (this is for debugging). */ struct partial_symtab *ps - = psf->find_pc_sect_psymtab (objfile, pc, section, msymbol); + = psf->find_pc_sect_psymtab (&objfile, pc, section, msymbol); if (ps != NULL) { if (!printed_objfile_header) { outfile->printf ("\nPartial symtabs for objfile %s\n", - objfile_name (objfile)); + objfile_name (&objfile)); printed_objfile_header = 1; } - dump_psymtab (objfile, ps, outfile); + dump_psymtab (&objfile, ps, outfile); found = 1; } } else { - for (partial_symtab *ps : psf->partial_symbols (objfile)) + for (partial_symtab *ps : psf->partial_symbols (&objfile)) { int print_for_source = 0; @@ -1321,10 +1318,10 @@ maintenance_print_psymbols (const char *args, int from_tty) if (!printed_objfile_header) { outfile->printf ("\nPartial symtabs for objfile %s\n", - objfile_name (objfile)); + objfile_name (&objfile)); printed_objfile_header = 1; } - dump_psymtab (objfile, ps, outfile); + dump_psymtab (&objfile, ps, outfile); } } } @@ -1349,21 +1346,21 @@ maintenance_info_psymtabs (const char *regexp, int from_tty) re_comp (regexp); for (struct program_space *pspace : program_spaces) - for (objfile *objfile : pspace->objfiles ()) + for (objfile &objfile : pspace->objfiles ()) { - struct gdbarch *gdbarch = objfile->arch (); + struct gdbarch *gdbarch = objfile.arch (); /* We don't want to print anything for this objfile until we actually find a symtab whose name matches. */ int printed_objfile_start = 0; - for (const auto &iter : objfile->qf) + for (const auto &iter : objfile.qf) { psymbol_functions *psf = dynamic_cast<psymbol_functions *> (iter.get ()); if (psf == nullptr) continue; - for (partial_symtab *psymtab : psf->partial_symbols (objfile)) + for (partial_symtab *psymtab : psf->partial_symbols (&objfile)) { QUIT; @@ -1372,10 +1369,10 @@ maintenance_info_psymtabs (const char *regexp, int from_tty) { if (! printed_objfile_start) { - gdb_printf ("{ objfile %s ", objfile_name (objfile)); + gdb_printf ("{ objfile %s ", objfile_name (&objfile)); gdb_stdout->wrap_here (2); gdb_printf ("((struct objfile *) %s)\n", - host_address_to_string (objfile)); + host_address_to_string (&objfile)); printed_objfile_start = 1; } @@ -1385,16 +1382,16 @@ maintenance_info_psymtabs (const char *regexp, int from_tty) host_address_to_string (psymtab)); gdb_printf (" readin %s\n", - psymtab->readin_p (objfile) ? "yes" : "no"); + psymtab->readin_p (&objfile) ? "yes" : "no"); gdb_printf (" fullname %s\n", psymtab->fullname ? psymtab->fullname : "(null)"); gdb_printf (" text addresses "); gdb_puts (paddress (gdbarch, - psymtab->text_low (objfile))); + psymtab->text_low (&objfile))); gdb_printf (" -- "); gdb_puts (paddress (gdbarch, - psymtab->text_high (objfile))); + psymtab->text_high (&objfile))); gdb_printf ("\n"); gdb_printf (" globals "); if (!psymtab->global_psymbols.empty ()) @@ -1458,33 +1455,33 @@ maintenance_check_psymtabs (const char *ignore, int from_tty) const struct blockvector *bv; const struct block *b; - for (objfile *objfile : current_program_space->objfiles ()) + for (objfile &objfile : current_program_space->objfiles ()) { - for (const auto &iter : objfile->qf) + for (const auto &iter : objfile.qf) { psymbol_functions *psf = dynamic_cast<psymbol_functions *> (iter.get ()); if (psf == nullptr) continue; - for (partial_symtab *ps : psf->partial_symbols (objfile)) + for (partial_symtab *ps : psf->partial_symbols (&objfile)) { - struct gdbarch *gdbarch = objfile->arch (); + struct gdbarch *gdbarch = objfile.arch (); /* We don't call psymtab_to_symtab here because that may cause symtab expansion. When debugging a problem it helps if checkers leave things unchanged. */ - cust = ps->get_compunit_symtab (objfile); + cust = ps->get_compunit_symtab (&objfile); /* First do some checks that don't require the associated symtab. */ - if (ps->text_high (objfile) < ps->text_low (objfile)) + if (ps->text_high (&objfile) < ps->text_low (&objfile)) { gdb_printf ("Psymtab "); gdb_puts (ps->filename); gdb_printf (" covers bad range "); - gdb_puts (paddress (gdbarch, ps->text_low (objfile))); + gdb_puts (paddress (gdbarch, ps->text_low (&objfile))); gdb_printf (" - "); - gdb_puts (paddress (gdbarch, ps->text_high (objfile))); + gdb_puts (paddress (gdbarch, ps->text_high (&objfile))); gdb_printf ("\n"); continue; } @@ -1498,7 +1495,7 @@ maintenance_check_psymtabs (const char *ignore, int from_tty) { /* Skip symbols for inlined functions without address. These may or may not have a match in the full symtab. */ - if (psym->aclass == LOC_BLOCK + if (psym->loc_class == LOC_BLOCK && psym->ginfo.value_address () == 0) continue; @@ -1532,15 +1529,15 @@ maintenance_check_psymtabs (const char *ignore, int from_tty) } } if (ps->unrelocated_text_high () != unrelocated_addr (0) - && (ps->text_low (objfile) < b->start () - || ps->text_high (objfile) > b->end ())) + && (ps->text_low (&objfile) < b->start () + || ps->text_high (&objfile) > b->end ())) { gdb_printf ("Psymtab "); gdb_puts (ps->filename); gdb_printf (" covers "); - gdb_puts (paddress (gdbarch, ps->text_low (objfile))); + gdb_puts (paddress (gdbarch, ps->text_low (&objfile))); gdb_printf (" - "); - gdb_puts (paddress (gdbarch, ps->text_high (objfile))); + gdb_puts (paddress (gdbarch, ps->text_high (&objfile))); gdb_printf (" but symtab covers only "); gdb_puts (paddress (gdbarch, b->start ())); gdb_printf (" - "); @@ -1552,9 +1549,7 @@ maintenance_check_psymtabs (const char *ignore, int from_tty) } } -void _initialize_psymtab (); -void -_initialize_psymtab () +INIT_GDB_FILE (psymtab) { add_cmd ("psymbols", class_maintenance, maintenance_print_psymbols, _("\ Print dump of current partial symbol definitions.\n\ |