public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] [c++/18141] Fix perf issue
@ 2015-03-18 19:39 Doug Evans
  2015-03-30 23:42 ` Doug Evans
  0 siblings, 1 reply; 2+ messages in thread
From: Doug Evans @ 2015-03-18 19:39 UTC (permalink / raw)
  To: gdb-patches

Hi.

The bug report explains the issue hopefully sufficiently:

https://sourceware.org/bugzilla/show_bug.cgi?id=18141

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.

Before:

(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)

After:

(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  <dje@google.com>

	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);

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

* Re: [PATCH] [c++/18141] Fix perf issue
  2015-03-18 19:39 [PATCH] [c++/18141] Fix perf issue Doug Evans
@ 2015-03-30 23:42 ` Doug Evans
  0 siblings, 0 replies; 2+ messages in thread
From: Doug Evans @ 2015-03-30 23:42 UTC (permalink / raw)
  To: gdb-patches

Doug Evans writes:
 > Hi.
 > 
 > The bug report explains the issue hopefully sufficiently:
 > 
 > https://sourceware.org/bugzilla/show_bug.cgi?id=18141
 > 
 > 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.
 > 
 > Before:
 > 
 > (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)
 > 
 > After:
 > 
 > (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  <dje@google.com>
 > 
 > 	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);

fyi, committed.

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

end of thread, other threads:[~2015-03-30 23:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-18 19:39 [PATCH] [c++/18141] Fix perf issue Doug Evans
2015-03-30 23:42 ` Doug Evans

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).