public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Dmitry Neverov <dmitry.neverov@jetbrains.com>
To: gdb-patches@sourceware.org
Cc: dmitry.neverov@jetbrains.com
Subject: [PATCH v3][PR symtab/30520 4/4] gdb/symtab: use symbol name matcher for all segments in a qualified name
Date: Mon,  6 May 2024 17:09:20 +0200	[thread overview]
Message-ID: <20240506150920.1220092-4-dmitry.neverov@jetbrains.com> (raw)
In-Reply-To: <20240506150920.1220092-1-dmitry.neverov@jetbrains.com>

---
 gdb/dwarf2/read.c | 35 +++++++++++++++++++++++++----------
 1 file changed, 25 insertions(+), 10 deletions(-)

diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
index f2842f0f581..e8416905163 100644
--- a/gdb/dwarf2/read.c
+++ b/gdb/dwarf2/read.c
@@ -16644,12 +16644,16 @@ cooked_index_functions::expand_symtabs_matching
     {
       std::vector<std::string_view> name_vec
 	= lookup_name_without_params.split_name (lang);
-      std::string last_name (name_vec.back ());
-
-      lookup_name_info last_segment_lookup_name (
-	last_name, symbol_name_match_type::FULL, completing, true);
+      std::vector<std::string> name_str_vec (name_vec.begin (), name_vec.end ());
+      std::vector<lookup_name_info> segment_lookup_names;
+      segment_lookup_names.reserve (name_vec.size ());
+      for (auto &segment_name : name_str_vec)
+	{
+	  segment_lookup_names.emplace_back (segment_name,
+	    symbol_name_match_type::FULL, completing, true);
+	}
 
-      for (const cooked_index_entry *entry : table->find (last_name,
+      for (const cooked_index_entry *entry : table->find (name_str_vec.back (),
 							  completing))
 	{
 	  QUIT;
@@ -16678,13 +16682,24 @@ cooked_index_functions::expand_symtabs_matching
 	    {
 	      /* If we ran out of entries, or if this segment doesn't
 		 match, this did not match.  */
-	      if (parent == nullptr
-		  || strncmp (parent->name, name_vec[i - 1].data (),
-			      name_vec[i - 1].length ()) != 0)
+	      if (parent == nullptr)
 		{
 		  found = false;
 		  break;
 		}
+	      if (parent->lang != language_unknown)
+		{
+		  const language_defn *lang_def = language_def (parent->lang);
+		  symbol_name_matcher_ftype *name_matcher
+		    = lang_def->get_symbol_name_matcher
+		      (segment_lookup_names[i-1]);
+		  if (!name_matcher (parent->canonical,
+				     segment_lookup_names[i-1], nullptr))
+		    {
+		      found = false;
+		      break;
+		    }
+		}
 
 	      parent = parent->get_parent ();
 	    }
@@ -16708,9 +16723,9 @@ cooked_index_functions::expand_symtabs_matching
 		      const language_defn *lang_def = language_def (entry->lang);
 		      symbol_name_matcher_ftype *name_matcher
 			= lang_def->get_symbol_name_matcher
-			  (last_segment_lookup_name);
+			  (segment_lookup_names.back ());
 		      if (!name_matcher (entry->canonical,
-					 last_segment_lookup_name, nullptr))
+					 segment_lookup_names.back (), nullptr))
 			continue;
 		    }
 	      }
-- 
2.34.1


  parent reply	other threads:[~2024-05-06 15:09 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-06 15:09 [PATCH v3][PR symtab/30520 1/4] gdb/symtab: check name matches before expanding a CU Dmitry Neverov
2024-05-06 15:09 ` [PATCH v3][PR symtab/30520 2/4] gdb/symtab: reuse last segment lookup name info by creating it outside the loop Dmitry Neverov
2024-05-07 17:09   ` Tom Tromey
2024-05-06 15:09 ` [PATCH v3][PR symtab/30520 3/4] gdb/symtab: compute match_type " Dmitry Neverov
2024-05-07 17:10   ` Tom Tromey
2024-05-06 15:09 ` Dmitry Neverov [this message]
2024-05-06 15:23   ` [PATCH v3][PR symtab/30520 4/4] gdb/symtab: use symbol name matcher for all segments in a qualified name Dmitry Neverov
2024-05-07 17:26   ` Tom Tromey
2024-05-07 17:03 ` [PATCH v3][PR symtab/30520 1/4] gdb/symtab: check name matches before expanding a CU Tom Tromey
2024-05-08 11:32   ` Dmitry.Neverov
2024-05-08 15:48     ` Tom Tromey
2024-05-09  5:55       ` Dmitry.Neverov

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=20240506150920.1220092-4-dmitry.neverov@jetbrains.com \
    --to=dmitry.neverov@jetbrains.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).