Change map_matching_symbols to take a lookup_name_info
This patch further simplifies the map_matching_symbols callback, by having it take a lookup_name_info rather than a plain string. gdb/ChangeLog 2019-09-10 Tom Tromey <tromey@adacore.com> * ada-lang.c (add_nonlocal_symbols): Combine calls to map_matching_symbols. Update. * dwarf2read.c (dw2_map_matching_symbols): Update. * psymtab.c (match_partial_symbol): Change type; update. (psym_map_matching_symbols): Likewise. * symfile-debug.c (debug_qf_map_matching_symbols): Change type; update. * symfile.h (struct quick_symbol_functions) <map_matching_symbols>: Change "name" to be a lookup_name_info. Remove "match".
This commit is contained in:
parent
6a3dbf1bc6
commit
b054970d54
|
@ -1,3 +1,16 @@
|
||||||
|
2019-09-10 Tom Tromey <tromey@adacore.com>
|
||||||
|
|
||||||
|
* ada-lang.c (add_nonlocal_symbols): Combine calls to
|
||||||
|
map_matching_symbols. Update.
|
||||||
|
* dwarf2read.c (dw2_map_matching_symbols): Update.
|
||||||
|
* psymtab.c (match_partial_symbol): Change type; update.
|
||||||
|
(psym_map_matching_symbols): Likewise.
|
||||||
|
* symfile-debug.c (debug_qf_map_matching_symbols): Change
|
||||||
|
type; update.
|
||||||
|
* symfile.h (struct quick_symbol_functions)
|
||||||
|
<map_matching_symbols>: Change "name" to be a lookup_name_info.
|
||||||
|
Remove "match".
|
||||||
|
|
||||||
2019-09-10 Tom Tromey <tromey@adacore.com>
|
2019-09-10 Tom Tromey <tromey@adacore.com>
|
||||||
|
|
||||||
* psymtab.c (map_block): Remove.
|
* psymtab.c (map_block): Remove.
|
||||||
|
|
|
@ -5550,16 +5550,10 @@ add_nonlocal_symbols (struct obstack *obstackp,
|
||||||
{
|
{
|
||||||
data.objfile = objfile;
|
data.objfile = objfile;
|
||||||
|
|
||||||
if (is_wild_match)
|
objfile->sf->qf->map_matching_symbols (objfile, lookup_name,
|
||||||
objfile->sf->qf->map_matching_symbols (objfile, lookup_name.name ().c_str (),
|
domain, global, callback,
|
||||||
domain, global, callback,
|
(is_wild_match
|
||||||
symbol_name_match_type::WILD,
|
? NULL : compare_names));
|
||||||
NULL);
|
|
||||||
else
|
|
||||||
objfile->sf->qf->map_matching_symbols (objfile, lookup_name.name ().c_str (),
|
|
||||||
domain, global, callback,
|
|
||||||
symbol_name_match_type::FULL,
|
|
||||||
compare_names);
|
|
||||||
|
|
||||||
for (compunit_symtab *cu : objfile->compunits ())
|
for (compunit_symtab *cu : objfile->compunits ())
|
||||||
{
|
{
|
||||||
|
@ -5575,14 +5569,14 @@ add_nonlocal_symbols (struct obstack *obstackp,
|
||||||
if (num_defns_collected (obstackp) == 0 && global && !is_wild_match)
|
if (num_defns_collected (obstackp) == 0 && global && !is_wild_match)
|
||||||
{
|
{
|
||||||
const char *name = ada_lookup_name (lookup_name);
|
const char *name = ada_lookup_name (lookup_name);
|
||||||
std::string name1 = std::string ("<_ada_") + name + '>';
|
lookup_name_info name1 (std::string ("<_ada_") + name + '>',
|
||||||
|
symbol_name_match_type::FULL);
|
||||||
|
|
||||||
for (objfile *objfile : current_program_space->objfiles ())
|
for (objfile *objfile : current_program_space->objfiles ())
|
||||||
{
|
{
|
||||||
data.objfile = objfile;
|
data.objfile = objfile;
|
||||||
objfile->sf->qf->map_matching_symbols (objfile, name1.c_str (),
|
objfile->sf->qf->map_matching_symbols (objfile, name1,
|
||||||
domain, global, callback,
|
domain, global, callback,
|
||||||
symbol_name_match_type::FULL,
|
|
||||||
compare_names);
|
compare_names);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4186,10 +4186,9 @@ dw2_expand_symtabs_with_fullname (struct objfile *objfile,
|
||||||
static void
|
static void
|
||||||
dw2_map_matching_symbols
|
dw2_map_matching_symbols
|
||||||
(struct objfile *objfile,
|
(struct objfile *objfile,
|
||||||
const char * name, domain_enum domain,
|
const lookup_name_info &name, domain_enum domain,
|
||||||
int global,
|
int global,
|
||||||
gdb::function_view<symbol_found_callback_ftype> callback,
|
gdb::function_view<symbol_found_callback_ftype> callback,
|
||||||
symbol_name_match_type match,
|
|
||||||
symbol_compare_ftype *ordered_compare)
|
symbol_compare_ftype *ordered_compare)
|
||||||
{
|
{
|
||||||
/* Currently unimplemented; used for Ada. The function can be called if the
|
/* Currently unimplemented; used for Ada. The function can be called if the
|
||||||
|
|
|
@ -37,13 +37,6 @@
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <set>
|
#include <set>
|
||||||
|
|
||||||
static struct partial_symbol *match_partial_symbol (struct objfile *,
|
|
||||||
struct partial_symtab *,
|
|
||||||
int,
|
|
||||||
const char *, domain_enum,
|
|
||||||
symbol_name_match_type,
|
|
||||||
symbol_compare_ftype *);
|
|
||||||
|
|
||||||
static struct partial_symbol *lookup_partial_symbol (struct objfile *,
|
static struct partial_symbol *lookup_partial_symbol (struct objfile *,
|
||||||
struct partial_symtab *,
|
struct partial_symtab *,
|
||||||
const char *, int,
|
const char *, int,
|
||||||
|
@ -545,8 +538,7 @@ psymbol_name_matches (partial_symbol *psym,
|
||||||
static struct partial_symbol *
|
static struct partial_symbol *
|
||||||
match_partial_symbol (struct objfile *objfile,
|
match_partial_symbol (struct objfile *objfile,
|
||||||
struct partial_symtab *pst, int global,
|
struct partial_symtab *pst, int global,
|
||||||
const char *name, domain_enum domain,
|
const lookup_name_info &name, domain_enum domain,
|
||||||
symbol_name_match_type match_type,
|
|
||||||
symbol_compare_ftype *ordered_compare)
|
symbol_compare_ftype *ordered_compare)
|
||||||
{
|
{
|
||||||
struct partial_symbol **start, **psym;
|
struct partial_symbol **start, **psym;
|
||||||
|
@ -557,8 +549,6 @@ match_partial_symbol (struct objfile *objfile,
|
||||||
if (length == 0)
|
if (length == 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
lookup_name_info lookup_name (name, match_type);
|
|
||||||
|
|
||||||
start = (global ?
|
start = (global ?
|
||||||
&objfile->partial_symtabs->global_psymbols[pst->globals_offset] :
|
&objfile->partial_symtabs->global_psymbols[pst->globals_offset] :
|
||||||
&objfile->partial_symtabs->static_psymbols[pst->statics_offset]);
|
&objfile->partial_symtabs->static_psymbols[pst->statics_offset]);
|
||||||
|
@ -583,7 +573,7 @@ match_partial_symbol (struct objfile *objfile,
|
||||||
|
|
||||||
enum language lang = (*center)->ginfo.language;
|
enum language lang = (*center)->ginfo.language;
|
||||||
const char *lang_ln
|
const char *lang_ln
|
||||||
= lookup_name.language_lookup_name (lang).c_str ();
|
= name.language_lookup_name (lang).c_str ();
|
||||||
|
|
||||||
if (ordered_compare (symbol_search_name (&(*center)->ginfo),
|
if (ordered_compare (symbol_search_name (&(*center)->ginfo),
|
||||||
lang_ln) >= 0)
|
lang_ln) >= 0)
|
||||||
|
@ -594,7 +584,7 @@ match_partial_symbol (struct objfile *objfile,
|
||||||
gdb_assert (top == bottom);
|
gdb_assert (top == bottom);
|
||||||
|
|
||||||
while (top <= real_top
|
while (top <= real_top
|
||||||
&& psymbol_name_matches (*top, lookup_name))
|
&& psymbol_name_matches (*top, name))
|
||||||
{
|
{
|
||||||
if (symbol_matches_domain ((*top)->ginfo.language,
|
if (symbol_matches_domain ((*top)->ginfo.language,
|
||||||
(*top)->domain, domain))
|
(*top)->domain, domain))
|
||||||
|
@ -612,7 +602,7 @@ match_partial_symbol (struct objfile *objfile,
|
||||||
{
|
{
|
||||||
if (symbol_matches_domain ((*psym)->ginfo.language,
|
if (symbol_matches_domain ((*psym)->ginfo.language,
|
||||||
(*psym)->domain, domain)
|
(*psym)->domain, domain)
|
||||||
&& psymbol_name_matches (*psym, lookup_name))
|
&& psymbol_name_matches (*psym, name))
|
||||||
return *psym;
|
return *psym;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1174,21 +1164,18 @@ psymtab_to_fullname (struct partial_symtab *ps)
|
||||||
static void
|
static void
|
||||||
psym_map_matching_symbols
|
psym_map_matching_symbols
|
||||||
(struct objfile *objfile,
|
(struct objfile *objfile,
|
||||||
const char *name, domain_enum domain,
|
const lookup_name_info &name, domain_enum domain,
|
||||||
int global,
|
int global,
|
||||||
gdb::function_view<symbol_found_callback_ftype> callback,
|
gdb::function_view<symbol_found_callback_ftype> callback,
|
||||||
symbol_name_match_type match,
|
|
||||||
symbol_compare_ftype *ordered_compare)
|
symbol_compare_ftype *ordered_compare)
|
||||||
{
|
{
|
||||||
const int block_kind = global ? GLOBAL_BLOCK : STATIC_BLOCK;
|
const int block_kind = global ? GLOBAL_BLOCK : STATIC_BLOCK;
|
||||||
|
|
||||||
lookup_name_info lookup_name (name, match);
|
|
||||||
|
|
||||||
for (partial_symtab *ps : require_partial_symbols (objfile, 1))
|
for (partial_symtab *ps : require_partial_symbols (objfile, 1))
|
||||||
{
|
{
|
||||||
QUIT;
|
QUIT;
|
||||||
if (ps->readin
|
if (ps->readin
|
||||||
|| match_partial_symbol (objfile, ps, global, name, domain, match,
|
|| match_partial_symbol (objfile, ps, global, name, domain,
|
||||||
ordered_compare))
|
ordered_compare))
|
||||||
{
|
{
|
||||||
struct compunit_symtab *cust = psymtab_to_symtab (objfile, ps);
|
struct compunit_symtab *cust = psymtab_to_symtab (objfile, ps);
|
||||||
|
@ -1197,7 +1184,7 @@ psym_map_matching_symbols
|
||||||
if (cust == NULL)
|
if (cust == NULL)
|
||||||
continue;
|
continue;
|
||||||
block = BLOCKVECTOR_BLOCK (COMPUNIT_BLOCKVECTOR (cust), block_kind);
|
block = BLOCKVECTOR_BLOCK (COMPUNIT_BLOCKVECTOR (cust), block_kind);
|
||||||
if (!iterate_over_symbols_terminated (block, lookup_name,
|
if (!iterate_over_symbols_terminated (block, name,
|
||||||
domain, callback))
|
domain, callback))
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -230,26 +230,23 @@ debug_qf_expand_symtabs_with_fullname (struct objfile *objfile,
|
||||||
static void
|
static void
|
||||||
debug_qf_map_matching_symbols
|
debug_qf_map_matching_symbols
|
||||||
(struct objfile *objfile,
|
(struct objfile *objfile,
|
||||||
const char *name, domain_enum domain,
|
const lookup_name_info &name, domain_enum domain,
|
||||||
int global,
|
int global,
|
||||||
gdb::function_view<symbol_found_callback_ftype> callback,
|
gdb::function_view<symbol_found_callback_ftype> callback,
|
||||||
symbol_name_match_type match,
|
|
||||||
symbol_compare_ftype *ordered_compare)
|
symbol_compare_ftype *ordered_compare)
|
||||||
{
|
{
|
||||||
const struct debug_sym_fns_data *debug_data
|
const struct debug_sym_fns_data *debug_data
|
||||||
= symfile_debug_objfile_data_key.get (objfile);
|
= symfile_debug_objfile_data_key.get (objfile);
|
||||||
|
|
||||||
fprintf_filtered (gdb_stdlog,
|
fprintf_filtered (gdb_stdlog,
|
||||||
"qf->map_matching_symbols (%s, \"%s\", %s, %d, %s, %s)\n",
|
"qf->map_matching_symbols (%s, %s, %d, %s)\n",
|
||||||
objfile_debug_name (objfile), name,
|
objfile_debug_name (objfile),
|
||||||
domain_name (domain), global,
|
domain_name (domain), global,
|
||||||
plongest ((LONGEST) match),
|
|
||||||
host_address_to_string (ordered_compare));
|
host_address_to_string (ordered_compare));
|
||||||
|
|
||||||
debug_data->real_sf->qf->map_matching_symbols (objfile, name,
|
debug_data->real_sf->qf->map_matching_symbols (objfile, name,
|
||||||
domain, global,
|
domain, global,
|
||||||
callback,
|
callback,
|
||||||
match,
|
|
||||||
ordered_compare);
|
ordered_compare);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -227,10 +227,10 @@ struct quick_symbol_functions
|
||||||
|
|
||||||
void (*map_matching_symbols)
|
void (*map_matching_symbols)
|
||||||
(struct objfile *,
|
(struct objfile *,
|
||||||
const char *name, domain_enum domain,
|
const lookup_name_info &lookup_name,
|
||||||
|
domain_enum domain,
|
||||||
int global,
|
int global,
|
||||||
gdb::function_view<symbol_found_callback_ftype> callback,
|
gdb::function_view<symbol_found_callback_ftype> callback,
|
||||||
symbol_name_match_type match,
|
|
||||||
symbol_compare_ftype *ordered_compare);
|
symbol_compare_ftype *ordered_compare);
|
||||||
|
|
||||||
/* Expand all symbol tables in OBJFILE matching some criteria.
|
/* Expand all symbol tables in OBJFILE matching some criteria.
|
||||||
|
|
Loading…
Reference in New Issue