Re: [rfc][patch] Eliminate quadratic slow-down on number of solibs.

Paul Pluzhnikov
2009-06-22T18:56:41Z

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

On Mon, Jun 22, 2009 at 10:09 AM, Ulrich Weigand<uweigand@de.ibm.com> wrote:

> Paul Pluzhnikov wrote:
>
>> 2009-05-12 Paul Pluzhnikov <ppluzhnikov@google.com>
...
> Maybe I'm missing something here, but this seems to break overlay
> support.

Yes, I believe your analysis is correct.

> If you're going to reset only breakpoints
> from one objfile, maybe you should likewise *delete* only breakpoints
> from that objfile?

That sounds like a good approach :-)

Patch below tested on Linux/x86_64 with no new failures.

Unfortunately I don't have any targets that support overlays, so I can't
test this. Did this fail for you on spu? If so, does it pass with this patch?

Thanks,
--
Paul Pluzhnikov

2009-06-22 Paul Pluzhnikov <ppluzhnikov@google.com>

* breakpoint.c (breakpoint_re_set_one): Add objfile parameter,
delete overlay breakpoint only in the given objfile.
(breakpoint_re_set_objfile): Adjust.

[-- Attachment #2: gdb-overlay-bp-20090622.txt --]
[-- Type: text/plain, Size: 3228 bytes --]

Index: breakpoint.c
===================================================================
RCS file: /cvs/src/src/gdb/breakpoint.c,v
retrieving revision 1.407
diff -u -p -u -r1.407 breakpoint.c
--- breakpoint.c 19 Jun 2009 15:14:11 -0000 1.407
+++ breakpoint.c 22 Jun 2009 18:41:43 -0000
@@ -90,8 +90,6 @@ static void map_breakpoint_numbers (char

static void ignore_command (char *, int);

-static int breakpoint_re_set_one (void *);
-
static void clear_command (char *, int);

static void catch_command (char *, int);
@@ -7607,11 +7605,9 @@ update_breakpoint_locations (struct brea
The value we return ends up being the return value from catch_errors.
Unused in this case. */

-static int
-breakpoint_re_set_one (void *bint)
+static void
+breakpoint_re_set_one (struct breakpoint *b, struct objfile *objfile)
{
- /* get past catch_errs */
- struct breakpoint *b = (struct breakpoint *) bint;
struct value *mark;
int i;
int not_found = 0;
@@ -7628,7 +7624,7 @@ breakpoint_re_set_one (void *bint)
case bp_none:
warning (_("attempted to reset apparently deleted breakpoint #%d?"),
b->number);
- return 0;
+ return;
case bp_breakpoint:
case bp_hardware_breakpoint:
case bp_tracepoint:
@@ -7636,7 +7632,7 @@ breakpoint_re_set_one (void *bint)
{
/* Anything without a string can't be re-set. */
delete_breakpoint (b);
- return 0;
+ return;
}

set_language (b->language);
@@ -7739,12 +7735,17 @@ breakpoint_re_set_one (void *bint)

default:
printf_filtered (_("Deleting unknown breakpoint type %d\n"), b->type);
- /* fall through */
- /* Delete overlay event breakpoints; they will be reset later by
- breakpoint_re_set. */
- case bp_overlay_event:
delete_breakpoint (b);
break;
+ case bp_overlay_event:
+ if (objfile == NULL
+ || lookup_minimal_symbol_text (b->addr_string, objfile))
+ {
+ /* Delete overlay event breakpoints; they will be reset later by
+ breakpoint_re_set. */
+ delete_breakpoint (b);
+ }
+ break;

/* This breakpoint is special, it's set up when the inferior
starts and we really don't want to touch it. */
@@ -7767,8 +7768,6 @@ breakpoint_re_set_one (void *bint)
case bp_longjmp_resume:
break;
}
-
- return 0;
}

/* Re-set all breakpoints after symbols have been re-loaded.
@@ -7787,12 +7786,15 @@ breakpoint_re_set_objfile (struct objfil
save_input_radix = input_radix;
ALL_BREAKPOINTS_SAFE (b, temp)
{
- /* Format possible error msg */
- char *message = xstrprintf ("Error in re-setting breakpoint %d: ",
- b->number);
- struct cleanup *cleanups = make_cleanup (xfree, message);
- catch_errors (breakpoint_re_set_one, b, message, RETURN_MASK_ALL);
- do_cleanups (cleanups);
+ volatile struct gdb_exception ex;
+
+ TRY_CATCH (ex, RETURN_MASK_ALL)
+ {
+ breakpoint_re_set_one (b, objfile);
+ }
+ if (ex.reason < 0)
+ exception_fprintf (gdb_stderr, ex,
+ "Error in re-setting breakpoint %d: ", b->number);
}
set_language (save_language);
input_radix = save_input_radix;