From: Jan Kratochvil <jan.kratochvil@redhat.com>
To: gdb-patches@sourceware.org
Subject: Re: [RFA] Improve performance with lots of shared libraries
Date: Fri, 09 Sep 2011 14:53:00 -0000 [thread overview]
Message-ID: <20110909145110.GB12299@host1.jankratochvil.net> (raw)
In-Reply-To: <20110909123156.GA1503@redhat.com>
On Fri, 09 Sep 2011 14:31:56 +0200, Gary Benson wrote:
> There are two things I'm not sure about with it as it stands. One is
> to do with program spaces: I noticed that breakpoints have a program
> space, but breakpoint locations also have a program space. Is the way
> I have used these correct?
Tom is working on removing the program space from the breakpoint itself. Or
at least Tom was discussing its removal.
> --- /dev/null
> +++ b/gdb/solib-bp-disable.c
[...]
> +/* Nonzero if multi-threaded inferior support is present. */
> +
> +static int
> +multi_thread_support_availabie (void)
This should be in target.c (and probably renamed).
[...]
> +/* Enable or disable a single solib event breakpoint as appropriate. */
> +
> +static int
> +update_solib_breakpoint (struct breakpoint *b, void *arg)
> +{
> + int enable = *(int *) arg;
> + struct bp_location *loc;
> +
> + if (b->pspace != current_program_space)
> + return 0;
> +
> + if (b->type != bp_shlib_event)
> + return 0;
> +
> + for (loc = b->loc; loc; loc = loc->next)
> + if (loc->pspace == current_program_space)
> + {
> + if (enable && b->enable_state == bp_disabled)
> + b->enable_state = bp_enabled;
> + else if (!enable && b->enable_state == bp_enabled)
> + b->enable_state = bp_disabled;
> + }
After modifying any ENABLE_STATE you have to always call
update_global_location_list. For some events it is already done, it should be
probably per-event (sometimes still duplicating the call but that is probably
OK).
> +
> + return 0;
> +}
> +
> +/* Enable or disable solib event breakpoints as appropriate. */
> +
> +void
> +update_solib_breakpoints ()
> +{
> + int enable = stop_on_solib_events
> + || !multi_thread_support_availabie ()
> + || pending_breakpoints_exist ();
This formatting is not compliant with Emacs-driven GNU Coding Style, it should
be AFAIK:
int enable = (stop_on_solib_events || !multi_thread_support_availabie ()
|| pending_breakpoints_exist ());
[...]
> +void
> +_initialize_solib_bp_disable (void)
> +{
> + /* Observe breakpoint operations so we can enable the shared
> + library event breakpoint if there are breakpoints pending
> + on shared library loads. */
> + observer_attach_breakpoint_created (breakpoint_event);
> + observer_attach_breakpoint_modified (breakpoint_event);
> + observer_attach_breakpoint_deleted (breakpoint_event);
> +
> + /* We also need to watch for inferior creation, because the
> + creation of the shared library event breakpoint does not
> + cause a breakpoint_created notification so inferior_created
> + is the next best thing. */
Isn't more bug the missing notification?
> + observer_attach_inferior_created (inferior_event);
> +
> + /* Observe shared libraries being loaded and unloaded so we
> + can disable the shared library event breakpoint once a
> + thread debugging library has been loaded. */
> + observer_attach_solib_loaded (solib_event);
> + observer_attach_solib_unloaded (solib_event);
> +}
There is open the problem of ambiguous breakpoints but otherwise it looks
great to me, thanks.
Jan
next prev parent reply other threads:[~2011-09-09 14:51 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-09-09 14:25 Gary Benson
2011-09-09 14:35 ` Daniel Jacobowitz
2011-09-09 14:51 ` Jan Kratochvil
2011-09-09 15:04 ` Pedro Alves
2011-09-09 19:41 ` Jan Kratochvil
2011-09-12 12:44 ` Pedro Alves
2011-09-12 16:44 ` Jan Kratochvil
2011-09-14 9:28 ` Gary Benson
2011-10-04 19:46 ` Tom Tromey
2011-09-09 15:11 ` Pedro Alves
2011-09-09 14:53 ` Jan Kratochvil [this message]
2011-10-04 20:03 ` Tom Tromey
-- strict thread matches above, loose matches on Subject: below --
2011-09-22 17:35 Gary Benson
2011-07-01 16:51 Gary Benson
2011-07-01 17:19 ` Tom Tromey
2011-07-04 14:10 ` Gary Benson
2011-07-01 17:32 ` Joel Brobecker
2011-07-04 14:21 ` Gary Benson
2011-07-01 17:45 ` Pedro Alves
2011-07-01 17:57 ` Pedro Alves
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=20110909145110.GB12299@host1.jankratochvil.net \
--to=jan.kratochvil@redhat.com \
--cc=gdb-patches@sourceware.org \
/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