Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom Tromey <tom@tromey.com>
To: gdb-patches@sourceware.org
Cc: Tom Tromey <tom@tromey.com>
Subject: [PATCH 2/2] Simplify psymbol_functions::expand_symtabs_matching
Date: Wed, 24 Mar 2021 14:15:10 -0600	[thread overview]
Message-ID: <20210324201510.23655-3-tom@tromey.com> (raw)
In-Reply-To: <20210324201510.23655-1-tom@tromey.com>

I noticed that psymbol_functions::expand_symtabs_matching calls
make_ignore_params once per psymtab that is matched.  This seems
possibly expensive, so this patch hoists the call out of the loop.

gdb/ChangeLog
2021-03-24  Tom Tromey  <tom@tromey.com>

	* psymtab.c (psymbol_functions::expand_symtabs_matching): Only
	call make_ignore_params once.
---
 gdb/ChangeLog | 5 +++++
 gdb/psymtab.c | 6 +++++-
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/gdb/psymtab.c b/gdb/psymtab.c
index 5a64166d983..1ea7376a8c8 100644
--- a/gdb/psymtab.c
+++ b/gdb/psymtab.c
@@ -1306,6 +1306,10 @@ psymbol_functions::expand_symtabs_matching
   for (partial_symtab *ps : require_partial_symbols (objfile))
     ps->searched_flag = PST_NOT_SEARCHED;
 
+  gdb::optional<lookup_name_info> psym_lookup_name;
+  if (lookup_name != nullptr)
+    psym_lookup_name = lookup_name->make_ignore_params ();
+
   for (partial_symtab *ps : m_partial_symtabs->range ())
     {
       QUIT;
@@ -1335,7 +1339,7 @@ psymbol_functions::expand_symtabs_matching
 
       if ((symbol_matcher == NULL && lookup_name == NULL)
 	  || recursively_search_psymtabs (ps, objfile, domain,
-					  lookup_name->make_ignore_params (),
+					  *psym_lookup_name,
 					  symbol_matcher))
 	{
 	  struct compunit_symtab *symtab =
-- 
2.26.2


  parent reply	other threads:[~2021-03-24 20:15 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-24 20:15 [PATCH 0/2] Two minor partial symtab cleanups Tom Tromey
2021-03-24 20:15 ` [PATCH 1/2] Allow expand_symtabs_matching to examine imported psymtabs Tom Tromey
2021-03-25 19:29   ` Simon Marchi via Gdb-patches
2021-03-26 18:17     ` Tom Tromey
2021-03-26 18:27       ` Simon Marchi via Gdb-patches
2021-03-24 20:15 ` Tom Tromey [this message]
2021-03-25 19:31   ` [PATCH 2/2] Simplify psymbol_functions::expand_symtabs_matching Simon Marchi via Gdb-patches

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=20210324201510.23655-3-tom@tromey.com \
    --to=tom@tromey.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