Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Paul Pluzhnikov <ppluzhnikov@google.com>
To: gdb-patches@sourceware.org
Cc: Tom Tromey <tromey@redhat.com>
Subject: Re: [patch] Eliminate quadratic slow-down on number of solibs (part  	2).
Date: Wed, 06 May 2009 00:50:00 -0000	[thread overview]
Message-ID: <8ac60eac0905051749p3b5d14d9q8903b9de8e18137f@mail.gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 1029 bytes --]

On Fri, May 1, 2009 at 3:16 PM, Paul Pluzhnikov <ppluzhnikov@google.com> wrote:

> This is the patch to eliminate repeated iteration over the same objfile
> looking for Objective-C methods, as Tom suggested here:
>  http://sourceware.org/ml/gdb-patches/2009-04/msg00551.html

Even after the two patches above, there is still some repeated
and unnecessary setting and resetting of the breakpoints as each
solib is added :-(

Attached is an alternative patch which subsumes the other two,
and kills additional 15% of wasted CPU time.

It feels like a hack, but I don't see how to achieve the same
result in a cleaner way :-(

Timing on my 2780-solib test (just running ldd on that takes 15s):

time gdb -ex 'break main' -ex run -ex kill -ex quit request_test

=== current CVS Head ===
real    11m16.762s
user    11m5.530s
sys     0m9.697s

=== with attached patch ===
real    2m43.595s
user    2m33.350s
sys     0m9.353s

Tested on Linux/x86_64 without regressions.

Comments?
--
Paul Pluzhnikov

[-- Attachment #2: gdb-breakpoint-20090505.txt --]
[-- Type: text/plain, Size: 2309 bytes --]

? foof.12580
Index: breakpoint.c
===================================================================
RCS file: /cvs/src/src/gdb/breakpoint.c,v
retrieving revision 1.393
diff -u -p -u -r1.393 breakpoint.c
--- breakpoint.c	5 May 2009 13:24:48 -0000	1.393
+++ breakpoint.c	6 May 2009 00:46:59 -0000
@@ -72,6 +72,9 @@
 #define CATCH_PERMANENT ((void *) (uintptr_t) 0)
 #define CATCH_TEMPORARY ((void *) (uintptr_t) 1)
 
+/* If non-zero, breakpoin_re_set() is a no-op.  */
+int suppress_breakpoint_reset;
+
 /* Prototypes for local functions. */
 
 static void enable_delete_command (char *, int);
@@ -7723,6 +7726,9 @@ breakpoint_re_set (void)
   enum language save_language;
   int save_input_radix;
 
+  if (suppress_breakpoint_reset)
+    return;
+
   save_language = current_language->la_language;
   save_input_radix = input_radix;
   ALL_BREAKPOINTS_SAFE (b, temp)
Index: breakpoint.h
===================================================================
RCS file: /cvs/src/src/gdb/breakpoint.h,v
retrieving revision 1.90
diff -u -p -u -r1.90 breakpoint.h
--- breakpoint.h	31 Mar 2009 16:44:17 -0000	1.90
+++ breakpoint.h	6 May 2009 00:46:59 -0000
@@ -669,6 +669,8 @@ enum breakpoint_here
     permanent_breakpoint_here
   };
 \f
+/* If non-zero, breakpoin_re_set() is a no-op.  */
+extern int suppress_breakpoint_reset;
 
 /* Prototypes for breakpoint-related functions.  */
 
Index: solib.c
===================================================================
RCS file: /cvs/src/src/gdb/solib.c,v
retrieving revision 1.115
diff -u -p -u -r1.115 solib.c
--- solib.c	9 Mar 2009 22:38:37 -0000	1.115
+++ solib.c	6 May 2009 00:46:59 -0000
@@ -738,6 +738,9 @@ solib_add (char *pattern, int from_tty, 
     int any_matches = 0;
     int loaded_any_symbols = 0;
 
+    /* Delay resetting breakpoints until after we added all solibs.  */
+    suppress_breakpoint_reset += 1;
+
     for (gdb = so_list_head; gdb; gdb = gdb->next)
       if (! pattern || re_exec (gdb->so_name))
 	{
@@ -754,6 +757,10 @@ solib_add (char *pattern, int from_tty, 
 	    loaded_any_symbols = 1;
 	}
 
+    suppress_breakpoint_reset -= 1;
+    if (loaded_any_symbols)
+      breakpoint_re_set ();
+
     if (from_tty && pattern && ! any_matches)
       printf_unfiltered
 	("No loaded shared libraries match the pattern `%s'.\n", pattern);

             reply	other threads:[~2009-05-06  0:50 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-06  0:50 Paul Pluzhnikov [this message]
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
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=8ac60eac0905051749p3b5d14d9q8903b9de8e18137f@mail.gmail.com \
    --to=ppluzhnikov@google.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