This is the mail archive of the mailing list for the GDB project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] [c++/18141] Fix perf issue


The bug report explains the issue hopefully sufficiently:

Basically, gdb is looking up "std" in .gdb_index, the index saying
it's present, gdb expanding the containing CU, but then the final
lookup not finding it.  This leads to expanding one CU in every
objfile that has an entry for "std".

A followup patch will add a complaint for this case.
In this case it's really an internal error, but I'm not sure
it'll always be an internal error, nor whether one can
adequately distinguish them.

Regression tested on amd64-linux.


(gdb) print foo
Command execution time: 297.609072 (cpu), 761.008252 (wall)
Space used: 25874649088 (+20380094464 for this command)
#symtabs: 622313 (+621693), #compunits: 8782 (+8774), #blocks: 4377936 (+4373024)


(gdb) print foo
Command execution time: 0.605912 (cpu), 0.971609 (wall)
Space used: 5538639872 (+42561536 for this command)
#symtabs: 924 (+304), #compunits: 10 (+2), #blocks: 8950 (+4038)

2015-03-18  Doug Evans  <>

	PR c++/18141
	* cp-namespace.c (cp_search_static_and_baseclasses): Always look for
	klass in VAR_DOMAIN.

diff --git a/gdb/cp-namespace.c b/gdb/cp-namespace.c
index 4a00cb6..0feeb35 100644
--- a/gdb/cp-namespace.c
+++ b/gdb/cp-namespace.c
@@ -355,8 +355,11 @@ cp_search_static_and_baseclasses (const char *name,
   make_cleanup (xfree, nested);
   /* Lookup a class named KLASS.  If none is found, there is nothing
-     more that can be done.  */
-  klass_sym = lookup_global_symbol (klass, block, domain);
+     more that can be done.  KLASS could be a namespace, so always look
+     in VAR_DOMAIN.  This works for classes too because of
+     symbol_matches_domain (which should be replaced with something else,
+     but it's what we have today).  */
+  klass_sym = lookup_global_symbol (klass, block, VAR_DOMAIN);
   if (klass_sym == NULL)
       do_cleanups (cleanup);

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]