Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Paul Pluzhnikov <ppluzhnikov@google.com>
To: Joel Brobecker <brobecker@adacore.com>
Cc: gdb-patches@sourceware.org, Tom Tromey <tromey@redhat.com>
Subject: Re: [patch] Eliminate quadratic slow-down on number of solibs (part  	2).
Date: Thu, 14 May 2009 17:45:00 -0000	[thread overview]
Message-ID: <8ac60eac0905141045q93bfc3fo2b22981f3b1d4db1@mail.gmail.com> (raw)
In-Reply-To: <20090514081402.GF7292@adacore.com>

On Thu, May 14, 2009 at 1:14 AM, Joel Brobecker <brobecker@adacore.com> wrote:

>> 3. The "don't reset all breakpoints over and over when adding
>>    multiple solibs" patch here:

> I completely misunderstood this change you proposed! I see now what
> you are doing. This wouldn't help on systems such as Windows where
> DLLs are "discovered" through special events while waiting for inferior
> events.  So shared libraries are never loaded at once, neither during
> startup or attaching.

Right. So Windows behaves as a program that dlopen()s all of
its DLLs in sequence.

> But on GNU/Linux, however, you're right, there
> is something to do in that case.
>
> I'd like to think about it, for a while... I wonder if we could use
> an observer to notify clients that symbols have been loaded, rather
> than calling breakpoint_re_set directly.

This (I think) would effectively achieve the same result as patch#2,
calling breakpoint_re_set only for individual solib.

[BTW, is it ok to commit patch#2 ?]

The problem is that breakpoint_re_set does a bunch of unnecessary
work, even when it knows which solib it should be dealing with.
In particular, for each breakpoint, it re-parses its addr_string,
selects correct address (possibly skipping function prolog, etc.).

When 'break main' is in effect, this one breakpoint's addr_string
is parsed N times, main is looked up N times, main's prolog is
skipped N times, etc. etc. This isn't quadratic, but accounts for
~15% of startup time, and adds up to minutes or large N.

I see that my comment about patch#3 transforming O(N*N) into O(N)
is correct only if patches #1 and #2 aren't applied. If they are
applied, then (I believe) patch#3 transforms O(N*M) into O(M), where
N is the number of solibs added "at once" and M is the number of
current breakpoints.

Thanks,
-- 
Paul Pluzhnikov


  reply	other threads:[~2009-05-14 17:45 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-06  0:50 Paul Pluzhnikov
2009-05-12  8:25 ` Joel Brobecker
2009-05-12 20:53   ` Paul Pluzhnikov
2009-05-13  9:27     ` Joel Brobecker
2009-05-13 18:11       ` Paul Pluzhnikov
2009-05-14  8:14         ` Joel Brobecker
2009-05-14 17:45           ` Paul Pluzhnikov [this message]
2009-05-14 19:23             ` Joel Brobecker
2009-05-14 23:35               ` Paul Pluzhnikov
     [not found]             ` <20090521151540.GH16152@adacore.com>
2009-05-21 16:17               ` Paul Pluzhnikov
2009-05-21 16:40                 ` Joel Brobecker
2009-05-30  2:08             ` Tom Tromey
2009-05-30  1:59 ` Tom Tromey
2009-06-03 19:46   ` Paul Pluzhnikov
2009-06-03 21:36     ` Tom Tromey
2009-05-12 19:43 Paul Pluzhnikov
2009-05-13  9:25 ` Joel Brobecker

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8ac60eac0905141045q93bfc3fo2b22981f3b1d4db1@mail.gmail.com \
    --to=ppluzhnikov@google.com \
    --cc=brobecker@adacore.com \
    --cc=gdb-patches@sourceware.org \
    --cc=tromey@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox