Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: "Andrew Burgess (Code Review)" <gerrit@gnutoolchain-gerrit.osci.io>
To: gdb-patches@sourceware.org
Cc: Simon Marchi <simon.marchi@polymtl.ca>,
	Joel Brobecker <brobecker@adacore.com>,
	Christian Biesinger <cbiesinger@google.com>,
	Tom Tromey <tromey@sourceware.org>
Subject: [review v4] gdb: Introduce global_symbol_searcher
Date: Fri, 22 Nov 2019 16:52:00 -0000	[thread overview]
Message-ID: <20191122165158.3559F2816F@gnutoolchain-gerrit.osci.io> (raw)
In-Reply-To: <gerrit.1571909344000.I488ab292a892d9e9e84775c632c5f198b6ad3710@gnutoolchain-gerrit.osci.io>

Andrew Burgess has posted comments on this change.

Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/264
......................................................................


Patch Set 4:

(4 comments)

Updated and addressed most of the comments, but I realise I missed one.

| --- gdb/symtab.c
| +++ gdb/symtab.c
| @@ -4355,8 +4342,11 @@ file_matches (const char *file, const char *files[], int nfiles, int basenames)
| -						   ? lbasename (files[i])
| -						   : files[i])))
| -	    return 1;
| -	}
| -    }
| -  else if (nfiles == 0)
| -    return 1;
| -  return 0;
| +/* Compare FILE against all the entries of FILENAMES.  If BASENAMES is
| +   non-zero compare only lbasename of FILENAMES.  */

PS3, Line 4343:

Done.

| +
| +static bool
| +file_matches (const char *file, const std::vector<const char *> &filenames,
| +	      bool basenames)
| +{
| +  if (filenames.empty ())
| +    return true;
| +
| +  for (const char *name : filenames)

 ...

| @@ -4837,17 +4822,16 @@ symtab_symbol_info (bool quiet, bool exclude_minsyms,
|      {"variable", "function", "type", "module"};
|    const char *last_filename = "";
|    int first = 1;
|  
|    gdb_assert (kind != ALL_DOMAIN);
|  
|    if (regexp != nullptr && *regexp == '\0')
|      regexp = nullptr;
|  
|    /* Must make sure that if we're interrupted, symbols gets freed.  */

PS3, Line 4831:

Done.

| -  std::vector<symbol_search> symbols = search_symbols (regexp, kind,
| -						       t_regexp, 0, NULL,
| -						       exclude_minsyms);
| +  global_symbol_searcher spec (kind, regexp, t_regexp, exclude_minsyms);
| +  std::vector<symbol_search> symbols = spec.search ();
|  
|    if (!quiet)
|      {
|        if (regexp != NULL)
| --- gdb/symtab.h
| +++ gdb/symtab.h
| @@ -2088,0 +2080,32 @@ extern std::vector<symbol_search> search_symbols (const char *,
| +/* In order to search for global symbols of a particular kind matching
| +   particular regular expressions, create an instance of this structure and
| +   call the SEARCH member function.  */
| +class global_symbol_searcher
| +{
| +public:
| +
| +  /* Constructor.  */
| +  global_symbol_searcher (enum search_domain kind,
| +			  const char *symbol_regexp = nullptr,
| +			  const char *type_regexp = nullptr,
| +			  bool exclude_minsyms = false,
| +			  std::vector<const char *> filename = {})

PS3, Line 2092:

Done.

| +    : m_kind (kind),
| +      m_symbol_regexp (symbol_regexp),
| +      m_type_regexp (type_regexp),
| +      m_exclude_minsyms (exclude_minsyms)
| +  {
| +    /* The symbol searching is designed to only find one kind of thing.  */
| +    gdb_assert (m_kind != ALL_DOMAIN);
| +  }
| +
| +  /* Search the symbol table for matches as defined by SEARCH_SPEC.

PS3, Line 2102:

Updated.

| +
| +     Within each file the results are sorted locally; each symtab's global
| +     and static blocks are separately alphabetized.  Duplicate entries are
| +     removed.  */
| +  std::vector<symbol_search> search () const;
| +
| +  /* The set of source files to search in for matching symbols.  This is
| +     currently public so that it can be populated after this object has
| +     been constructed.  */

-- 
Gerrit-Project: binutils-gdb
Gerrit-Branch: master
Gerrit-Change-Id: I488ab292a892d9e9e84775c632c5f198b6ad3710
Gerrit-Change-Number: 264
Gerrit-PatchSet: 4
Gerrit-Owner: Andrew Burgess <andrew.burgess@embecosm.com>
Gerrit-Reviewer: Andrew Burgess <andrew.burgess@embecosm.com>
Gerrit-Reviewer: Simon Marchi <simon.marchi@polymtl.ca>
Gerrit-Reviewer: Tom Tromey <tromey@sourceware.org>
Gerrit-CC: Christian Biesinger <cbiesinger@google.com>
Gerrit-CC: Joel Brobecker <brobecker@adacore.com>
Gerrit-Comment-Date: Fri, 22 Nov 2019 16:51:57 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Simon Marchi <simon.marchi@polymtl.ca>
Gerrit-MessageType: comment


  parent reply	other threads:[~2019-11-22 16:52 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <gerrit.1571909344000.I488ab292a892d9e9e84775c632c5f198b6ad3710@gnutoolchain-gerrit.osci.io>
2019-10-30 14:19 ` [review] gdb: Introduce symbol_search_spec Tom Tromey (Code Review)
2019-10-30 14:31 ` Christian Biesinger (Code Review)
2019-11-01  1:28 ` [review v2] " Andrew Burgess (Code Review)
2019-11-01  1:30 ` Andrew Burgess (Code Review)
2019-11-01 13:58 ` Simon Marchi (Code Review)
2019-11-08  0:50 ` [review v3] gdb: Introduce global_symbol_searcher Andrew Burgess (Code Review)
2019-11-21  4:02 ` Simon Marchi (Code Review)
2019-11-22 16:42 ` [review v4] " Andrew Burgess (Code Review)
2019-11-22 16:52 ` Andrew Burgess (Code Review) [this message]
2019-11-22 17:32 ` [review v5] " Andrew Burgess (Code Review)
2019-11-22 17:33 ` Andrew Burgess (Code Review)
2019-11-23 13:17 ` Simon Marchi (Code Review)
2019-11-26 23:26 ` [review v6] " Andrew Burgess (Code Review)
2019-11-26 23:40 ` [review v7] " Andrew Burgess (Code Review)
2019-11-26 23:43 ` Andrew Burgess (Code Review)
2019-11-27  3:59 ` Simon Marchi (Code Review)
2019-11-27 13:03 ` [pushed] " Sourceware to Gerrit sync (Code Review)
2019-11-27 13:03 ` Sourceware to Gerrit sync (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=20191122165158.3559F2816F@gnutoolchain-gerrit.osci.io \
    --to=gerrit@gnutoolchain-gerrit.osci.io \
    --cc=brobecker@adacore.com \
    --cc=cbiesinger@google.com \
    --cc=gdb-patches@sourceware.org \
    --cc=gnutoolchain-gerrit@osci.io \
    --cc=simon.marchi@polymtl.ca \
    --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