mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-21 02:24:17 +08:00
psymtab cleanup patch 3/3
This last patch removes "partial" from the names of expand_partial_symbol_names and map_partial_symbol_filenames. It also renames expand_partial_symbol_names to match the struct quick_symbol_functions "method" that it wraps: expand_symtabs_matching. This patch also adds two parameters to expand_symtabs_matching so that it can fully wrap the underlying quick_symbol_functions method. This makes it usable in more places. I thought of having a cover function that still had the same signature as the old expand_partial_symbol_names function, but I couldn't think of a good name, and it wasn't clear it was worth it anyway. * symfile.h (expand_symtabs_matching): Renamed from expand_partial_symbol_names. Update prototype. (map_symbol_filenames): Renamed from map_partial_symbol_filenames. * symfile.c (expand_symtabs_matching): Renamed from expand_partial_symbol_names. New args file_matcher, kind. Rename arg fun to symbol_matcher. (map_symbol_filenames): Renamed from map_partial_symbol_filenames. * ada-lang.c (ada_complete_symbol_matcher): Renamed from ada_expand_partial_symbol_name. (ada_make_symbol_completion_list): Update to call expand_symtabs_matching. (ada_add_global_exceptions): Call expand_symtabs_matching. * mi/mi-cmd-file.c (mi_cmd_file_list_exec_source_files): Update to call map_symbol_filenames. * symtab.c (sources_info): Update to call map_symbol_filenames. (search_symbols): Call expand_symtabs_matching. (symbol_completion_matcher): Renamed from expand_partial_symbol_name. (default_make_symbol_completion_list_break_on): Update to call expand_symtabs_matching. (make_source_files_completion_list): Update to call map_symbol_filenames.
This commit is contained in:
@ -1,3 +1,27 @@
|
|||||||
|
2014-01-14 Doug Evans <dje@google.com>
|
||||||
|
|
||||||
|
* symfile.h (expand_symtabs_matching): Renamed from
|
||||||
|
expand_partial_symbol_names. Update prototype.
|
||||||
|
(map_symbol_filenames): Renamed from map_partial_symbol_filenames.
|
||||||
|
* symfile.c (expand_symtabs_matching): Renamed from
|
||||||
|
expand_partial_symbol_names. New args file_matcher, kind.
|
||||||
|
Rename arg fun to symbol_matcher.
|
||||||
|
(map_symbol_filenames): Renamed from map_partial_symbol_filenames.
|
||||||
|
* ada-lang.c (ada_complete_symbol_matcher): Renamed from
|
||||||
|
ada_expand_partial_symbol_name.
|
||||||
|
(ada_make_symbol_completion_list): Update to call
|
||||||
|
expand_symtabs_matching.
|
||||||
|
(ada_add_global_exceptions): Call expand_symtabs_matching.
|
||||||
|
* mi/mi-cmd-file.c (mi_cmd_file_list_exec_source_files): Update to
|
||||||
|
call map_symbol_filenames.
|
||||||
|
* symtab.c (sources_info): Update to call map_symbol_filenames.
|
||||||
|
(search_symbols): Call expand_symtabs_matching.
|
||||||
|
(symbol_completion_matcher): Renamed from expand_partial_symbol_name.
|
||||||
|
(default_make_symbol_completion_list_break_on): Update to call
|
||||||
|
expand_symtabs_matching.
|
||||||
|
(make_source_files_completion_list): Update to call
|
||||||
|
map_symbol_filenames.
|
||||||
|
|
||||||
2014-01-14 Doug Evans <dje@google.com>
|
2014-01-14 Doug Evans <dje@google.com>
|
||||||
|
|
||||||
* symfile.h (expand_symtabs_file_matcher_ftype): New typedef.
|
* symfile.h (expand_symtabs_file_matcher_ftype): New typedef.
|
||||||
|
@ -5866,7 +5866,7 @@ symbol_completion_add (VEC(char_ptr) **sv,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* An object of this type is passed as the user_data argument to the
|
/* An object of this type is passed as the user_data argument to the
|
||||||
expand_partial_symbol_names method. */
|
expand_symtabs_matching method. */
|
||||||
struct add_partial_datum
|
struct add_partial_datum
|
||||||
{
|
{
|
||||||
VEC(char_ptr) **completions;
|
VEC(char_ptr) **completions;
|
||||||
@ -5878,9 +5878,10 @@ struct add_partial_datum
|
|||||||
int encoded;
|
int encoded;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* A callback for expand_partial_symbol_names. */
|
/* A callback for expand_symtabs_matching. */
|
||||||
|
|
||||||
static int
|
static int
|
||||||
ada_expand_partial_symbol_name (const char *name, void *user_data)
|
ada_complete_symbol_matcher (const char *name, void *user_data)
|
||||||
{
|
{
|
||||||
struct add_partial_datum *data = user_data;
|
struct add_partial_datum *data = user_data;
|
||||||
|
|
||||||
@ -5946,7 +5947,8 @@ ada_make_symbol_completion_list (const char *text0, const char *word,
|
|||||||
data.word = word;
|
data.word = word;
|
||||||
data.wild_match = wild_match_p;
|
data.wild_match = wild_match_p;
|
||||||
data.encoded = encoded_p;
|
data.encoded = encoded_p;
|
||||||
expand_partial_symbol_names (ada_expand_partial_symbol_name, &data);
|
expand_symtabs_matching (NULL, ada_complete_symbol_matcher, ALL_DOMAIN,
|
||||||
|
&data);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* At this point scan through the misc symbol vectors and add each
|
/* At this point scan through the misc symbol vectors and add each
|
||||||
@ -12513,11 +12515,8 @@ ada_add_global_exceptions (regex_t *preg, VEC(ada_exc_info) **exceptions)
|
|||||||
struct objfile *objfile;
|
struct objfile *objfile;
|
||||||
struct symtab *s;
|
struct symtab *s;
|
||||||
|
|
||||||
ALL_OBJFILES (objfile)
|
expand_symtabs_matching (NULL, ada_exc_search_name_matches,
|
||||||
if (objfile->sf)
|
VARIABLES_DOMAIN, preg);
|
||||||
objfile->sf->qf->expand_symtabs_matching
|
|
||||||
(objfile, NULL, ada_exc_search_name_matches,
|
|
||||||
VARIABLES_DOMAIN, preg);
|
|
||||||
|
|
||||||
ALL_PRIMARY_SYMTABS (objfile, s)
|
ALL_PRIMARY_SYMTABS (objfile, s)
|
||||||
{
|
{
|
||||||
|
@ -100,8 +100,8 @@ mi_cmd_file_list_exec_source_files (char *command, char **argv, int argc)
|
|||||||
ui_out_end (uiout, ui_out_type_tuple);
|
ui_out_end (uiout, ui_out_type_tuple);
|
||||||
}
|
}
|
||||||
|
|
||||||
map_partial_symbol_filenames (print_partial_file_name, NULL,
|
map_symbol_filenames (print_partial_file_name, NULL,
|
||||||
1 /*need_fullname*/);
|
1 /*need_fullname*/);
|
||||||
|
|
||||||
ui_out_end (uiout, ui_out_type_list);
|
ui_out_end (uiout, ui_out_type_list);
|
||||||
}
|
}
|
||||||
|
@ -3843,16 +3843,19 @@ symfile_free_objfile (struct objfile *objfile)
|
|||||||
See quick_symbol_functions.expand_symtabs_matching for details. */
|
See quick_symbol_functions.expand_symtabs_matching for details. */
|
||||||
|
|
||||||
void
|
void
|
||||||
expand_partial_symbol_names (expand_symtabs_symbol_matcher_ftype *fun,
|
expand_symtabs_matching (expand_symtabs_file_matcher_ftype *file_matcher,
|
||||||
void *data)
|
expand_symtabs_symbol_matcher_ftype *symbol_matcher,
|
||||||
|
enum search_domain kind,
|
||||||
|
void *data)
|
||||||
{
|
{
|
||||||
struct objfile *objfile;
|
struct objfile *objfile;
|
||||||
|
|
||||||
ALL_OBJFILES (objfile)
|
ALL_OBJFILES (objfile)
|
||||||
{
|
{
|
||||||
if (objfile->sf)
|
if (objfile->sf)
|
||||||
objfile->sf->qf->expand_symtabs_matching (objfile, NULL, fun,
|
objfile->sf->qf->expand_symtabs_matching (objfile, file_matcher,
|
||||||
ALL_DOMAIN, data);
|
symbol_matcher, kind,
|
||||||
|
data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3861,8 +3864,8 @@ expand_partial_symbol_names (expand_symtabs_symbol_matcher_ftype *fun,
|
|||||||
See quick_symbol_functions.map_symbol_filenames for details. */
|
See quick_symbol_functions.map_symbol_filenames for details. */
|
||||||
|
|
||||||
void
|
void
|
||||||
map_partial_symbol_filenames (symbol_filename_ftype *fun, void *data,
|
map_symbol_filenames (symbol_filename_ftype *fun, void *data,
|
||||||
int need_fullname)
|
int need_fullname)
|
||||||
{
|
{
|
||||||
struct objfile *objfile;
|
struct objfile *objfile;
|
||||||
|
|
||||||
|
@ -566,11 +566,12 @@ void free_symfile_segment_data (struct symfile_segment_data *data);
|
|||||||
|
|
||||||
extern struct cleanup *increment_reading_symtab (void);
|
extern struct cleanup *increment_reading_symtab (void);
|
||||||
|
|
||||||
void expand_partial_symbol_names (int (*fun) (const char *, void *),
|
void expand_symtabs_matching (expand_symtabs_file_matcher_ftype *,
|
||||||
void *data);
|
expand_symtabs_symbol_matcher_ftype *,
|
||||||
|
enum search_domain kind, void *data);
|
||||||
|
|
||||||
void map_partial_symbol_filenames (symbol_filename_ftype *fun, void *data,
|
void map_symbol_filenames (symbol_filename_ftype *fun, void *data,
|
||||||
int need_fullname);
|
int need_fullname);
|
||||||
|
|
||||||
/* From dwarf2read.c */
|
/* From dwarf2read.c */
|
||||||
|
|
||||||
|
33
gdb/symtab.c
33
gdb/symtab.c
@ -3319,8 +3319,8 @@ sources_info (char *ignore, int from_tty)
|
|||||||
|
|
||||||
clear_filename_seen_cache (data.filename_seen_cache);
|
clear_filename_seen_cache (data.filename_seen_cache);
|
||||||
data.first = 1;
|
data.first = 1;
|
||||||
map_partial_symbol_filenames (output_partial_symbol_filename, &data,
|
map_symbol_filenames (output_partial_symbol_filename, &data,
|
||||||
1 /*need_fullname*/);
|
1 /*need_fullname*/);
|
||||||
printf_filtered ("\n");
|
printf_filtered ("\n");
|
||||||
|
|
||||||
do_cleanups (cleanups);
|
do_cleanups (cleanups);
|
||||||
@ -3602,17 +3602,11 @@ search_symbols (char *regexp, enum search_domain kind,
|
|||||||
|
|
||||||
datum.nfiles = nfiles;
|
datum.nfiles = nfiles;
|
||||||
datum.files = files;
|
datum.files = files;
|
||||||
ALL_OBJFILES (objfile)
|
expand_symtabs_matching ((nfiles == 0
|
||||||
{
|
? NULL
|
||||||
if (objfile->sf)
|
: search_symbols_file_matches),
|
||||||
objfile->sf->qf->expand_symtabs_matching (objfile,
|
search_symbols_name_matches,
|
||||||
(nfiles == 0
|
kind, &datum);
|
||||||
? NULL
|
|
||||||
: search_symbols_file_matches),
|
|
||||||
search_symbols_name_matches,
|
|
||||||
kind,
|
|
||||||
&datum);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Here, we search through the minimal symbol tables for functions
|
/* Here, we search through the minimal symbol tables for functions
|
||||||
and variables that match, and force their symbols to be read.
|
and variables that match, and force their symbols to be read.
|
||||||
@ -4253,7 +4247,7 @@ completion_list_add_fields (struct symbol *sym, const char *sym_text,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Type of the user_data argument passed to add_macro_name or
|
/* Type of the user_data argument passed to add_macro_name or
|
||||||
expand_partial_symbol_name. The contents are simply whatever is
|
symbol_completion_matcher. The contents are simply whatever is
|
||||||
needed by completion_list_add_name. */
|
needed by completion_list_add_name. */
|
||||||
struct add_name_data
|
struct add_name_data
|
||||||
{
|
{
|
||||||
@ -4278,10 +4272,10 @@ add_macro_name (const char *name, const struct macro_definition *ignore,
|
|||||||
datum->text, datum->word);
|
datum->text, datum->word);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* A callback for expand_partial_symbol_names. */
|
/* A callback for expand_symtabs_matching. */
|
||||||
|
|
||||||
static int
|
static int
|
||||||
expand_partial_symbol_name (const char *name, void *user_data)
|
symbol_completion_matcher (const char *name, void *user_data)
|
||||||
{
|
{
|
||||||
struct add_name_data *datum = (struct add_name_data *) user_data;
|
struct add_name_data *datum = (struct add_name_data *) user_data;
|
||||||
|
|
||||||
@ -4392,7 +4386,8 @@ default_make_symbol_completion_list_break_on (const char *text,
|
|||||||
/* Look through the partial symtabs for all symbols which begin
|
/* Look through the partial symtabs for all symbols which begin
|
||||||
by matching SYM_TEXT. Expand all CUs that you find to the list.
|
by matching SYM_TEXT. Expand all CUs that you find to the list.
|
||||||
The real names will get added by COMPLETION_LIST_ADD_SYMBOL below. */
|
The real names will get added by COMPLETION_LIST_ADD_SYMBOL below. */
|
||||||
expand_partial_symbol_names (expand_partial_symbol_name, &datum);
|
expand_symtabs_matching (NULL, symbol_completion_matcher, ALL_DOMAIN,
|
||||||
|
&datum);
|
||||||
|
|
||||||
/* At this point scan through the misc symbol vectors and add each
|
/* At this point scan through the misc symbol vectors and add each
|
||||||
symbol you find to the list. Eventually we want to ignore
|
symbol you find to the list. Eventually we want to ignore
|
||||||
@ -4806,8 +4801,8 @@ make_source_files_completion_list (const char *text, const char *word)
|
|||||||
datum.word = word;
|
datum.word = word;
|
||||||
datum.text_len = text_len;
|
datum.text_len = text_len;
|
||||||
datum.list = &list;
|
datum.list = &list;
|
||||||
map_partial_symbol_filenames (maybe_add_partial_symtab_filename, &datum,
|
map_symbol_filenames (maybe_add_partial_symtab_filename, &datum,
|
||||||
0 /*need_fullname*/);
|
0 /*need_fullname*/);
|
||||||
|
|
||||||
do_cleanups (cache_cleanup);
|
do_cleanups (cache_cleanup);
|
||||||
discard_cleanups (back_to);
|
discard_cleanups (back_to);
|
||||||
|
Reference in New Issue
Block a user