Re: [patch] Do not add partial_symbol again and again to the list

Aleksandar Ristovski
2008-02-14T01:31:50Z

Aleksandar Ristovski wrote:
>
> The patch:
>
> This revised patch adds global symbols only once to first partial symbol table
> where the symbol was encountered, but only for namespace,
> class_type, interface_type, union_type, enumeration_type and enumerator partial
> symbol types (for the last two, only for java and cplus).
>

Here are some timings with a real-life binary. The time to load symbols for
unpatched (gdb from current HEAD) is around 70 seconds, while the patched gdb
needed less than 40 seconds. Almost 50% less for this particular binary which is
built from c++ source using stl heavily.

I have run tests (make check) and saw no regression; I also did other testing
(many debugging sessions) and haven't seen anything broken, but if you can come
up with a test case that breaks after the patch, I would be very interested to see.

Note that the patch does not change anything about static partial symbols, only
global psyms.

$ cat ../nopatch.log
GNU gdb 6.7.50.20080214-cvs
Copyright (C) 2008 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "i686-pc-linux-gnu".
Command execution time: 0.000000
Space used: 135168 (+0 for this command)
+sym /tmp/at/libalib.so
Command execution time: 69.076317
Space used: 36360192 (+36225024 for this command)
+quit

$ cat ../withpatch.log
GNU gdb 6.7.50.20080213-cvs
Copyright (C) 2008 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "i686-pc-linux-gnu".
Command execution time: 0.000000
Space used: 135168 (+0 for this command)
+sym /tmp/at/libalib.so
Command execution time: 32.830052
Space used: 36319232 (+36184064 for this command)
+quit