Bug 15454 - unusably slow resolving type names in C++ program with multiple namespace / lots of base classes
Summary: unusably slow resolving type names in C++ program with multiple namespace / l...
Status: NEW
Alias: None
Product: gdb
Classification: Unclassified
Component: c++ (show other bugs)
Version: 7.6
: P2 critical
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-05-10 05:08 UTC by Costa Sapuntzakis
Modified: 2014-01-25 21:04 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments
breakpoint trace (103.22 KB, application/x-gzip)
2013-05-10 05:08 UTC, Costa Sapuntzakis
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Costa Sapuntzakis 2013-05-10 05:08:00 UTC
Created attachment 7020 [details]
breakpoint trace

It takes minutes for GDB to find a symbol (vol::content_lh_key in this case) defined in a global namespace unless I prefix the symbol with ::

It seems to search for vol in the namespaces of all classes that the current class inherits from. This is ok, but it seems to repeat the search on the same symbol many times over.

I ran gdb against gdb and capture a bunch of stack traces during the symbol lookup. The file is attached.

break cp_lookup_symbol_in_namespace
silent
bt 4
print "\n\n"
cont
end
Comment 1 Costa Sapuntzakis 2013-05-10 05:49:16 UTC
The following diff works around the problem for me by disabling lookup in base classes:

--- gdb-7.6~20130417/gdb/cp-namespace.c 2013-03-18 02:20:02.000000000 -0700
+++ gdb-7.6-mine/gdb/cp-namespace.c     2013-05-09 22:32:17.907659782 -0700
@@ -808,9 +808,7 @@
        if (sym != NULL)
          return sym;

-       /* If no matching symbols were found, try searching any
-          base classes.  */
-       return find_symbol_in_baseclass (parent_type, nested_name, block);
+        return NULL;
       }

     case TYPE_CODE_FUNC:
Comment 2 Keith Seitz 2013-06-05 20:09:47 UTC
Does this patch help at all?

http://sourceware.org/ml/gdb-patches/2013-05/msg01097.html