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] Eliminate quadratic slow-down on number of solibs (take 2).

On Wed, Jun 3, 2009 at 2:34 PM, Tom Tromey<> wrote:

> Paul> The problem is that the call chain is deep:
> Yeah, but it can be simplified.

> Paul> ? ? flags=<value optimized out>) at ../../src/gdb/symfile.c:1033
> Paul> #5 ?0x00000000004e3ee5 in symbol_file_add_from_bfd (abfd=0xd57fe0,
> Paul> ? ? from_tty=0, addrs=0x0, mainline=0, flags=<value optimized out>)
> Paul> ? ? at ../../src/gdb/symfile.c:1103
> These are all just forwarding calls, basically overloads.
> You could add a new overload just for this purpose.

But they may call themselves recursively.
I've added a bit to OBJF_* flags instead.

How about attached patch then?

On a 1500+ solib test case I see 20% reduction in CPU, measured as:

  time gdb -ex 'break main' -ex run -ex quit custom_test

Before (best time):

real    1m1.724s
user    0m56.776s
sys     0m4.852s


real    0m51.596s
user    0m46.739s
sys     0m4.820s

Tested on Linux/x86_64, no new failures.

Paul Pluzhnikov

2009-06-08  Paul Pluzhnikov  <>

	* solib.c (symbol_add_stub): Add DEFER_BP_RESET parameter.
	(solib_read_symbols): Add DEFER_BP_RESET parameter.
	(solib_add): Defer breakpoint reset.
	* solib.h (solib_read_symbols): Adjust prototype.
	* symfile.c (new_symfile_objfile): Add FLAGS parameter.
	(symbol_file_add_with_addrs_or_offsets): Adjust call.
	* symfile.h (new_symfile_objfile): Adjust prototype.
	* objfile.h (OBJF_DEFER_BP_RESET): New define.
	* bsd-uthread.c (bsd_uthread_solib_loaded): Adjust call.
	* rs6000-nat.c (objfile_symbol_add): Adjust call.

Attachment: gdb-breakpoint-20090608.txt
Description: Text document

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