From: "Simon Marchi (Code Review)" <gerrit@gnutoolchain-gerrit.osci.io>
To: Andrew Burgess <andrew.burgess@embecosm.com>, gdb-patches@sourceware.org
Cc: Joel Brobecker <brobecker@adacore.com>,
Christian Biesinger <cbiesinger@google.com>,
Tom Tromey <tromey@sourceware.org>
Subject: [review v3] gdb: Introduce global_symbol_searcher
Date: Thu, 21 Nov 2019 03:32:00 -0000 [thread overview]
Message-ID: <20191121033156.44A4C2816F@gnutoolchain-gerrit.osci.io> (raw)
In-Reply-To: <gerrit.1571909344000.I488ab292a892d9e9e84775c632c5f198b6ad3710@gnutoolchain-gerrit.osci.io>
Simon Marchi has posted comments on this change.
Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/264
......................................................................
Patch Set 3:
(3 comments)
Just marking the comments as resolved, as they have been addressed in patchset 3.
| --- gdb/symtab.c
| +++ gdb/symtab.c
| @@ -4369,3 +4352,17 @@ file_matches (const char *file, const char *files[], int nfiles, int basenames)
| - }
| - else if (nfiles == 0)
| +/* Compare FILE against all the entries of FILENAMES. If BASENAMES is
| + non-zero compare only lbasename of FILENAMES. */
| +
| +static bool
| +file_matches (const char *file, const std::vector<const char *> &filenames,
| + bool basenames)
| +{
| + if (filenames.size () == 0)
PS1, Line 4359:
> filenames.empty()?
Done.
| return 1;
| +
| + for (const char *name : filenames)
| + {
| + name = (basenames ? lbasename (name) : name);
| + if (compare_filenames_for_search (file, name))
| + return 1;
| + }
| +
...
| @@ -4466,15 +4446,20 @@ /* Search the symbol table for matches to the regular expression REGEXP,
| - otherwise they are excluded. */
| +/* See symtab.h. */
|
| std::vector<symbol_search>
| -search_symbols (const char *regexp, enum search_domain kind,
| - const char *t_regexp,
| - int nfiles, const char *files[],
| - bool exclude_minsyms)
| -{
| +search_symbols (const search_symbols_spec &search_spec)
| +{
| + /* Unpack the search spec. */
| + const char *regexp = search_spec.symbol_regexp;
| + enum search_domain kind = search_spec.kind;
| + const char *t_regexp = search_spec.type_regexp;
| + int nfiles = search_spec.filenames.size ();
| + bool exclude_minsyms = search_spec.exclude_minsyms;
PS1, Line 4456:
> Did you consider making search_symbols a method of
search_symbols_spec? Then this unpacking wouldn't be
needed.
Done.
| +
| + /* The search. */
| const struct blockvector *bv;
| const struct block *b;
| int i = 0;
| struct block_iterator iter;
| struct symbol *sym;
| int found_misc = 0;
| static const enum minimal_symbol_type types[]
| --- gdb/symtab.h
| +++ gdb/symtab.h
| @@ -2073,0 +2085,27 @@ struct search_symbols_spec
| +
| + /* When this flag is false then minsyms that match SYMBOL_REGEXP will be
| + included in the results, otherwise they are excluded. */
| + bool exclude_minsyms = false;
| +
| + /* The set of source files to search in for matching symbols. */
| + std::vector<const char *> filenames;
| +
| + /* Constructor. */
| + search_symbols_spec (enum search_domain kind,
| + const char *symbol_regexp = nullptr,
| + const char *type_regexp = nullptr,
| + bool exclude_minsyms = false)
| + : kind (kind),
| + symbol_regexp (symbol_regexp),
| + type_regexp (type_regexp),
| + exclude_minsyms (exclude_minsyms)
| + { /* Nothing. */ }
PS1, Line 2102:
> This could gdb_assert (kind != ALL_DOMAIN)
Done.
| +};
| +
| +/* Search the symbol table for matches as defined by SEARCH_SPEC.
| +
| + Within each file the results are sorted locally; each symtab's global
| + and static blocks are separately alphabetized. Duplicate entries are
| + removed. */
| +
| +extern std::vector<symbol_search> search_symbols
--
Gerrit-Project: binutils-gdb
Gerrit-Branch: master
Gerrit-Change-Id: I488ab292a892d9e9e84775c632c5f198b6ad3710
Gerrit-Change-Number: 264
Gerrit-PatchSet: 3
Gerrit-Owner: Andrew Burgess <andrew.burgess@embecosm.com>
Gerrit-Reviewer: Andrew Burgess <andrew.burgess@embecosm.com>
Gerrit-Reviewer: Tom Tromey <tromey@sourceware.org>
Gerrit-CC: Christian Biesinger <cbiesinger@google.com>
Gerrit-CC: Joel Brobecker <brobecker@adacore.com>
Gerrit-CC: Simon Marchi <simon.marchi@polymtl.ca>
Gerrit-Comment-Date: Thu, 21 Nov 2019 03:31:55 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Andrew Burgess <andrew.burgess@embecosm.com>
Comment-In-Reply-To: Christian Biesinger <cbiesinger@google.com>
Comment-In-Reply-To: Tom Tromey <tromey@sourceware.org>
Comment-In-Reply-To: Simon Marchi <simon.marchi@polymtl.ca>
Gerrit-MessageType: comment
next prev parent reply other threads:[~2019-11-21 3:32 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <gerrit.1571909344000.I488ab292a892d9e9e84775c632c5f198b6ad3710@gnutoolchain-gerrit.osci.io>
2019-11-08 0:50 ` Andrew Burgess (Code Review)
2019-11-21 3:32 ` Simon Marchi (Code Review) [this message]
2019-11-21 4:02 ` Simon Marchi (Code Review)
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=20191121033156.44A4C2816F@gnutoolchain-gerrit.osci.io \
--to=gerrit@gnutoolchain-gerrit.osci.io \
--cc=andrew.burgess@embecosm.com \
--cc=brobecker@adacore.com \
--cc=cbiesinger@google.com \
--cc=gdb-patches@sourceware.org \
--cc=gnutoolchain-gerrit@osci.io \
--cc=tromey@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