Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [RFC v2][PR symtab/30520 1/4] gdb/symtab: check name matches before expanding a CU
@ 2024-01-23 17:03 Dmitry Neverov
  2024-01-23 17:03 ` [RFC v2][PR symtab/30520 2/4] gdb/symtab: reuse last segment lookup name info Dmitry Neverov
                   ` (3 more replies)
  0 siblings, 4 replies; 14+ messages in thread
From: Dmitry Neverov @ 2024-01-23 17:03 UTC (permalink / raw)
  To: gdb-patches; +Cc: dmitry.neverov

From: "Dmitry.Neverov" <dmitry.neverov@jetbrains.com>

The added check fixes the case when an unqualified lookup
name without template arguments causes expansion of many CUs
which contain the name with template arguments.

This is similar to what dw2_expand_symtabs_matching_symbol does
before expanding the CU.

In the referenced issue the lookup name was wxObjectDataPtr and many
CUs had names like wxObjectDataPtr<wxBitmapBundleImpl>. This caused
their expansion and the lookup took around a minute. The added check
helps to avoid the expansion and makes the symbol lookup to return in
a second or so.

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30520
---
 gdb/dwarf2/read.c | 22 +++++++++++++++++++---
 1 file changed, 19 insertions(+), 3 deletions(-)

diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
index bdfda31dc16..b125b2e69f0 100644
--- a/gdb/dwarf2/read.c
+++ b/gdb/dwarf2/read.c
@@ -16690,9 +16690,25 @@ cooked_index_functions::expand_symtabs_matching
 		= lookup_name_without_params.match_type ();
 	      if ((match_type == symbol_name_match_type::FULL
 		   || (lang != language_ada
-		       && match_type == symbol_name_match_type::EXPRESSION))
-		  && parent != nullptr)
-		continue;
+		       && match_type == symbol_name_match_type::EXPRESSION)))
+		{
+		  if (parent != nullptr)
+		    continue;
+
+		  if (entry->lang != language_unknown)
+		    {
+		      const language_defn *lang_def = language_def (entry->lang);
+		      lookup_name_info last_segment_lookup_name (
+			last_name.data (), symbol_name_match_type::FULL,
+			false, true);
+		      symbol_name_matcher_ftype *name_matcher
+			= lang_def->get_symbol_name_matcher
+			  (last_segment_lookup_name);
+		      if (!name_matcher (entry->canonical,
+					 last_segment_lookup_name, nullptr))
+			continue;
+		    }
+	      }
 	    }
 	  else
 	    {
-- 
2.39.2


^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2024-05-06 14:32 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-23 17:03 [RFC v2][PR symtab/30520 1/4] gdb/symtab: check name matches before expanding a CU Dmitry Neverov
2024-01-23 17:03 ` [RFC v2][PR symtab/30520 2/4] gdb/symtab: reuse last segment lookup name info Dmitry Neverov
2024-01-23 17:03 ` [RFC v2][PR symtab/30520 3/4] gdb/symtab: compute match_type outside the loop Dmitry Neverov
2024-01-23 17:03 ` [RFC v2][PR symtab/30520 4/4] gdb/symtab: use symbol name matcher for all segments in a qualified name Dmitry Neverov
2024-01-25  8:44 ` [RFC v2][PR symtab/30520] gdb/symtab: fix the gdb.cp/anon-struct test Dmitry Neverov
2024-02-07 20:25   ` Tom Tromey
2024-02-09 16:32     ` Dmitry Neverov
2024-02-09 19:38       ` Tom Tromey
2024-03-18 16:35         ` Dmitry Neverov
2024-03-18 17:58           ` Tom Tromey
2024-03-19 12:16             ` Dmitry Neverov
2024-03-22 17:29               ` Tom Tromey
2024-05-04  1:20                 ` Joel Brobecker
2024-05-06 14:32                   ` Dmitry Neverov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox