From: Gary Benson <gbenson@redhat.com>
To: gdb-patches@sourceware.org
Subject: [PATCH 1/2] Add expansion_notify callback to expand_symtabs_matching
Date: Wed, 12 Feb 2014 11:56:00 -0000 [thread overview]
Message-ID: <20140212115641.GB2866@blade.nx> (raw)
In-Reply-To: <20140212115548.GA2866@blade.nx>
This patch adds a new callback parameter, "expansion_notify", to the
top-level expand_symtabs_matching function and to all the vectorized
functions it defers to. If expansion_notify is non-NULL, it will be
called every time a psymtab is expanded to a symtab.
gdb/
2014-02-12 Gary Benson <gbenson@redhat.com>
* symfile.h (struct partial_symtab): New forward declaration.
(expand_symtabs_exp_notify_ftype): New typedef.
(struct quick_symbol_functions) <expand_symtabs_matching>: New
parameter "expansion_notify". All uses updated.
(expand_symtabs_matching): Likewise.
* psymtab.c (expand_symtabs_matching_via_partial): New
parameter "expansion_notify". If non-NULL, call it prior
to calling psymtab_to_symtab.
diff --git a/gdb/symfile.h b/gdb/symfile.h
index 17599be..3f7283b 100644
--- a/gdb/symfile.h
+++ b/gdb/symfile.h
@@ -35,6 +35,7 @@ struct value;
struct frame_info;
struct agent_expr;
struct axs_value;
+struct partial_symtab;
/* Comparison function for symbol look ups. */
@@ -137,6 +138,13 @@ typedef int (expand_symtabs_file_matcher_ftype) (const char *filename,
typedef int (expand_symtabs_symbol_matcher_ftype) (const char *name,
void *data);
+/* Callback for quick_symbol_functions->expand_symtabs_matching
+ to be notified when a psymtab is expanded. */
+
+typedef void (expand_symtabs_exp_notify_ftype) (struct objfile *objfile,
+ struct partial_symtab *pst,
+ void *data);
+
/* The "quick" symbol functions exist so that symbol readers can
avoiding an initial read of all the symbols. For example, symbol
readers might choose to use the "partial symbol table" utilities,
@@ -282,6 +290,7 @@ struct quick_symbol_functions
(struct objfile *objfile,
expand_symtabs_file_matcher_ftype *file_matcher,
expand_symtabs_symbol_matcher_ftype *symbol_matcher,
+ expand_symtabs_exp_notify_ftype *expansion_notify,
enum search_domain kind,
void *data);
@@ -568,6 +577,7 @@ extern struct cleanup *increment_reading_symtab (void);
void expand_symtabs_matching (expand_symtabs_file_matcher_ftype *,
expand_symtabs_symbol_matcher_ftype *,
+ expand_symtabs_exp_notify_ftype *,
enum search_domain kind, void *data);
void map_symbol_filenames (symbol_filename_ftype *fun, void *data,
diff --git a/gdb/symfile.c b/gdb/symfile.c
index 06d2119..760693f 100644
--- a/gdb/symfile.c
+++ b/gdb/symfile.c
@@ -3870,6 +3870,7 @@ symfile_free_objfile (struct objfile *objfile)
void
expand_symtabs_matching (expand_symtabs_file_matcher_ftype *file_matcher,
expand_symtabs_symbol_matcher_ftype *symbol_matcher,
+ expand_symtabs_exp_notify_ftype *expansion_notify,
enum search_domain kind,
void *data)
{
@@ -3879,7 +3880,8 @@ expand_symtabs_matching (expand_symtabs_file_matcher_ftype *file_matcher,
{
if (objfile->sf)
objfile->sf->qf->expand_symtabs_matching (objfile, file_matcher,
- symbol_matcher, kind,
+ symbol_matcher,
+ expansion_notify, kind,
data);
}
}
diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index a10d800..62b9206 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -6170,8 +6170,8 @@ ada_make_symbol_completion_list (const char *text0, const char *word,
data.word = word;
data.wild_match = wild_match_p;
data.encoded = encoded_p;
- expand_symtabs_matching (NULL, ada_complete_symbol_matcher, ALL_DOMAIN,
- &data);
+ expand_symtabs_matching (NULL, ada_complete_symbol_matcher, NULL,
+ ALL_DOMAIN, &data);
}
/* At this point scan through the misc symbol vectors and add each
@@ -12751,7 +12751,7 @@ ada_add_global_exceptions (regex_t *preg, VEC(ada_exc_info) **exceptions)
struct objfile *objfile;
struct symtab *s;
- expand_symtabs_matching (NULL, ada_exc_search_name_matches,
+ expand_symtabs_matching (NULL, ada_exc_search_name_matches, NULL,
VARIABLES_DOMAIN, preg);
ALL_PRIMARY_SYMTABS (objfile, s)
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index 54c538a..f9da5db 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -3773,6 +3773,7 @@ dw2_expand_symtabs_matching
(struct objfile *objfile,
expand_symtabs_file_matcher_ftype *file_matcher,
expand_symtabs_symbol_matcher_ftype *symbol_matcher,
+ expand_symtabs_exp_notify_ftype *expansion_notify,
enum search_domain kind,
void *data)
{
diff --git a/gdb/linespec.c b/gdb/linespec.c
index 4b596fc..726d081 100644
--- a/gdb/linespec.c
+++ b/gdb/linespec.c
@@ -1029,7 +1029,7 @@ iterate_over_all_matching_symtabs (struct linespec_state *state,
if (objfile->sf)
objfile->sf->qf->expand_symtabs_matching (objfile, NULL,
iterate_name_matcher,
- ALL_DOMAIN,
+ NULL, ALL_DOMAIN,
&matcher_data);
ALL_OBJFILE_PRIMARY_SYMTABS (objfile, symtab)
diff --git a/gdb/symfile-debug.c b/gdb/symfile-debug.c
index c247bd7..9671ea1 100644
--- a/gdb/symfile-debug.c
+++ b/gdb/symfile-debug.c
@@ -287,22 +287,25 @@ debug_qf_expand_symtabs_matching
(struct objfile *objfile,
expand_symtabs_file_matcher_ftype *file_matcher,
expand_symtabs_symbol_matcher_ftype *symbol_matcher,
+ expand_symtabs_exp_notify_ftype *expansion_notify,
enum search_domain kind, void *data)
{
const struct debug_sym_fns_data *debug_data =
objfile_data (objfile, symfile_debug_objfile_data_key);
fprintf_filtered (gdb_stdlog,
- "qf->expand_symtabs_matching (%s, %s, %s, %s, %s)\n",
+ "qf->expand_symtabs_matching (%s, %s, %s, %s, %s, %s)\n",
debug_objfile_name (objfile),
host_address_to_string (file_matcher),
host_address_to_string (symbol_matcher),
+ host_address_to_string (expansion_notify),
search_domain_name (kind),
host_address_to_string (data));
debug_data->real_sf->qf->expand_symtabs_matching (objfile,
file_matcher,
symbol_matcher,
+ expansion_notify,
kind, data);
}
diff --git a/gdb/symmisc.c b/gdb/symmisc.c
index 4064e06..2bd7bc0 100644
--- a/gdb/symmisc.c
+++ b/gdb/symmisc.c
@@ -897,7 +897,7 @@ maintenance_expand_symtabs (char *args, int from_tty)
{
objfile->sf->qf->expand_symtabs_matching
(objfile, maintenance_expand_file_matcher,
- maintenance_expand_name_matcher, ALL_DOMAIN, regexp);
+ maintenance_expand_name_matcher, NULL, ALL_DOMAIN, regexp);
}
}
diff --git a/gdb/symtab.c b/gdb/symtab.c
index 50c09c1..6b94713 100644
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -3625,7 +3625,7 @@ search_symbols (char *regexp, enum search_domain kind,
? NULL
: search_symbols_file_matches),
search_symbols_name_matches,
- kind, &datum);
+ NULL, kind, &datum);
/* Here, we search through the minimal symbol tables for functions
and variables that match, and force their symbols to be read.
@@ -4405,8 +4405,8 @@ default_make_symbol_completion_list_break_on (const char *text,
/* Look through the partial symtabs for all symbols which begin
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. */
- expand_symtabs_matching (NULL, symbol_completion_matcher, ALL_DOMAIN,
- &datum);
+ expand_symtabs_matching (NULL, symbol_completion_matcher, NULL,
+ ALL_DOMAIN, &datum);
/* At this point scan through the misc symbol vectors and add each
symbol you find to the list. Eventually we want to ignore
diff --git a/gdb/psymtab.c b/gdb/psymtab.c
index 457b91a..e742e87 100644
--- a/gdb/psymtab.c
+++ b/gdb/psymtab.c
@@ -1365,6 +1365,7 @@ expand_symtabs_matching_via_partial
(struct objfile *objfile,
expand_symtabs_file_matcher_ftype *file_matcher,
expand_symtabs_symbol_matcher_ftype *symbol_matcher,
+ expand_symtabs_exp_notify_ftype *expansion_notify,
enum search_domain kind,
void *data)
{
@@ -1407,7 +1408,12 @@ expand_symtabs_matching_via_partial
}
if (recursively_search_psymtabs (ps, objfile, kind, symbol_matcher, data))
- psymtab_to_symtab (objfile, ps);
+ {
+ if (expansion_notify != NULL)
+ expansion_notify (objfile, ps, data);
+
+ psymtab_to_symtab (objfile, ps);
+ }
}
}
next prev parent reply other threads:[~2014-02-12 11:56 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-12 11:55 [PATCH 0/2] Limit tab-completion result when list is large Gary Benson
2014-02-12 11:56 ` Gary Benson [this message]
2014-02-12 20:10 ` [PATCH 1/2] Add expansion_notify callback to expand_symtabs_matching Tom Tromey
2014-02-12 11:58 ` [PATCH 2/2] Implement completion limiting Gary Benson
2014-02-12 16:27 ` Eli Zaretskii
2014-02-12 16:41 ` Pedro Alves
2014-02-12 20:53 ` Gary Benson
2014-02-12 21:41 ` Pedro Alves
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20140212115641.GB2866@blade.nx \
--to=gbenson@redhat.com \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox