aboutsummaryrefslogtreecommitdiff
path: root/gdb/symtab.h
diff options
context:
space:
mode:
authorKeith Seitz <keiths@redhat.com>2018-08-29 15:12:23 -0700
committerKeith Seitz <keiths@redhat.com>2018-08-29 15:12:23 -0700
commitfcaad03cc027ec2cdf7f2cff70d792867d43c57f (patch)
tree3e83fdb3af1743ba9b29fac1c0618aef012c3856 /gdb/symtab.h
parent7e41c8db84bc6f74843dda40ae443d41977c0d20 (diff)
downloadgdb-fcaad03cc027ec2cdf7f2cff70d792867d43c57f.zip
gdb-fcaad03cc027ec2cdf7f2cff70d792867d43c57f.tar.gz
gdb-fcaad03cc027ec2cdf7f2cff70d792867d43c57f.tar.bz2
Add new search_symbols_multiple API
This patch adds a new symbol searching API based on linespec.c's parser implementation. This allows users to find "all* matching symbols instead of the first found match (a la lookup_symbol). gdb/ChangeLog: * linespec.c (collect_info::add_symbol): Make virtual. (struct symbol_searcher_collect_info): New struct. (symbol_searcher::find_all_symbols): New method. * symtab.h (class symbol_searcher): New class.
Diffstat (limited to 'gdb/symtab.h')
-rw-r--r--gdb/symtab.h43
1 files changed, 43 insertions, 0 deletions
diff --git a/gdb/symtab.h b/gdb/symtab.h
index 1dc9a09..e0fe17a 100644
--- a/gdb/symtab.h
+++ b/gdb/symtab.h
@@ -2185,4 +2185,47 @@ void completion_list_add_name (completion_tracker &tracker,
const lookup_name_info &lookup_name,
const char *text, const char *word);
+/* A simple symbol searching class. */
+
+class symbol_searcher
+{
+public:
+ /* Returns the symbols found for the search. */
+ const std::vector<block_symbol> &
+ matching_symbols () const
+ {
+ return m_symbols;
+ }
+
+ /* Returns the minimal symbols found for the search. */
+ const std::vector<bound_minimal_symbol> &
+ matching_msymbols () const
+ {
+ return m_minimal_symbols;
+ }
+
+ /* Search for all symbols named NAME in LANGUAGE with DOMAIN, restricting
+ search to FILE_SYMTABS and SEARCH_PSPACE, both of which may be NULL
+ to search all symtabs and program spaces. */
+ void find_all_symbols (const std::string &name,
+ const struct language_defn *language,
+ enum search_domain search_domain,
+ std::vector<symtab *> *search_symtabs,
+ struct program_space *search_pspace);
+
+ /* Reset this object to perform another search. */
+ void reset ()
+ {
+ m_symbols.clear ();
+ m_minimal_symbols.clear ();
+ }
+
+private:
+ /* Matching debug symbols. */
+ std::vector<block_symbol> m_symbols;
+
+ /* Matching non-debug symbols. */
+ std::vector<bound_minimal_symbol> m_minimal_symbols;
+};
+
#endif /* !defined(SYMTAB_H) */