Re: gdb and dlopen

Andrew Cagney
2001-10-16T20:17:00Z

> Aha! Yes, I was just about to send more info, when I got your
> reply. Our application is multi-threaded (pthreads). We have not
> started any threads when we are loading the dsos - just the main
> thread is active, but I guess that doesn't matter... If you need any
> more info, let me know...

To play the part of Bart Simpons dog: blah blah blah blah blah PTHREADS
blah blah 4.18 blah blah 5.x :-)

> I put a timer in our code, so I start the timer before I call the
> first dlopen, and stop it right after the last one:
>
> no gdb:
> 0.164334 seconds for 54 plugins
>
> with gdb 5.0.90-cvs from 07-Oct-2001, it takes ~ 30 seconds or so to
> enter main, and then:
> 151.355 seconds for 54 plugins, 144.033 to unload
> 73.3301 seconds for 31 plugins, 68.953 to unload
> 50.4318 seconds for 23 plugins, 47.6721 to unload
> 31.2207 seconds for 15 plugins, 29.0286 to unload
> 19.7027 seconds for 10 plugins, 18.4323 to unload
> 9.372 seconds for 5 plugins, 8.70661 to unload
> 1.83179 seconds for 1 plugins, 1.67519 to unload
>
> gdb 5.1-branch snapshot from sources.redhat.com from 16-Oct-2001:
> 151.919 seconds for 54 plugins, 144.9 to unload
>
> so 5.1 appears to be approximately the same as 5. This definitely
> doesn't happen in 4.18, although 4.18 has other, worse problems (like
> about half the time, it isn't useful for debugging - loses the call
> stack or ability to look at variables...) The scary thing is that it
> looks like the numbers are starting to grow non-linearly - it starts
> off at just under 2 seconds per plugin, then grows to almost 3 when we
> get up to 54, but I guess that is just the link map growing, so
> whatever...
>
> I am more than willing to do the leg work / coding on this, just need
> to know what direction to head down...

Thread support was given a serious overhall in 5.0 (it became
maintainable and fixable).

Can you try this with/without the thread library linked in? Everytime
GDB sees a shared library being loaded it goes frobbing around to see if
it contains some thread support code. That could be the problem.

Andrew