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

Paul Pluzhnikov
2009-06-22T22:04:51Z

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

On Mon, Jun 22, 2009 at 1:06 PM, Ulrich Weigand<uweigand@de.ibm.com> wrote:

>> Perhaps a better alternative is to restore the overlay-bp-reset behavior to
>> "before 2009-05-12" commit: now that this change is in:

Here is the patch to do that.

Tested on Linux/x86_64.

I also verified that create_overlay_event_breakpoint is not called for
each solib (though it is called 7 times, which seems like 6 too many).

Thanks,
--
Paul Pluzhnikov

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

Revert 2009-05-14 breakpoint commit (no longer needed).
* breakpoint.h (breakpoint_re_set_objfile): Remove
* breakpoint.c (breakpoint_re_set_objfile): Likewise
(create_overlay_event_breakpoint_1): Resurrect.
(create_overlay_event_breakpoint): Likewise.
* objfiles.c (objfile_relocate): Update.
* symfile.c (new_symfile_objfile): Likewise.

[-- Attachment #2: gdb-overlay-bp-20090622-2.txt --]
[-- Type: text/plain, Size: 4282 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 21:38:14 -0000
@@ -1476,7 +1476,7 @@ create_internal_breakpoint (CORE_ADDR ad
}

static void
-create_overlay_event_breakpoint (char *func_name, struct objfile *objfile)
+create_overlay_event_breakpoint_1 (char *func_name, struct objfile *objfile)
{
struct breakpoint *b;
struct minimal_symbol *m;
@@ -1502,13 +1502,20 @@ create_overlay_event_breakpoint (char *f
update_global_location_list (1);
}

+static void
+create_overlay_event_breakpoint (char *func_name)
+{
+ struct objfile *objfile;
+ ALL_OBJFILES (objfile)
+ create_overlay_event_breakpoint_1 (func_name, objfile);
+}
+
void
update_breakpoints_after_exec (void)
{
struct breakpoint *b;
struct breakpoint *temp;
struct bp_location *bploc;
- struct objfile *objfile;

/* We're about to delete breakpoints from GDB's lists. If the
INSERTED flag is true, GDB will try to lift the breakpoints by
@@ -1603,8 +1610,7 @@ update_breakpoints_after_exec (void)
}
}
/* FIXME what about longjmp breakpoints? Re-create them here? */
- ALL_OBJFILES (objfile)
- create_overlay_event_breakpoint ("_ovly_debug_event", objfile);
+ create_overlay_event_breakpoint ("_ovly_debug_event");
}

int
@@ -7771,13 +7777,9 @@ breakpoint_re_set_one (void *bint)
return 0;
}

-/* Re-set all breakpoints after symbols have been re-loaded.
-
- If OBJFILE is non-null, create overlay break point only in OBJFILE
- (speed optimization). Otherwise rescan all loaded objfiles. */
-
+/* Re-set all breakpoints after symbols have been re-loaded. */
void
-breakpoint_re_set_objfile (struct objfile *objfile)
+breakpoint_re_set (void)
{
struct breakpoint *b, *temp;
enum language save_language;
@@ -7797,19 +7799,7 @@ breakpoint_re_set_objfile (struct objfil
set_language (save_language);
input_radix = save_input_radix;

- if (objfile == NULL)
- ALL_OBJFILES (objfile)
- create_overlay_event_breakpoint ("_ovly_debug_event", objfile);
- else
- create_overlay_event_breakpoint ("_ovly_debug_event", objfile);
-}
-
-/* Re-set all breakpoints after symbols have been re-loaded. */
-
-void
-breakpoint_re_set (void)
-{
- breakpoint_re_set_objfile (NULL);
+ create_overlay_event_breakpoint ("_ovly_debug_event");
}
\f
/* Reset the thread number of this breakpoint:
Index: breakpoint.h
===================================================================
RCS file: /cvs/src/src/gdb/breakpoint.h,v
retrieving revision 1.92
diff -u -p -u -r1.92 breakpoint.h
--- breakpoint.h 24 May 2009 18:00:08 -0000 1.92
+++ breakpoint.h 22 Jun 2009 21:38:14 -0000
@@ -687,7 +687,7 @@ extern int breakpoint_thread_match (CORE
extern void until_break_command (char *, int, int);

extern void breakpoint_re_set (void);
-extern void breakpoint_re_set_objfile (struct objfile *);
+
extern void breakpoint_re_set_thread (struct breakpoint *);

extern struct breakpoint *set_momentary_breakpoint
Index: objfiles.c
===================================================================
RCS file: /cvs/src/src/gdb/objfiles.c,v
retrieving revision 1.83
diff -u -p -u -r1.83 objfiles.c
--- objfiles.c 14 May 2009 23:33:08 -0000 1.83
+++ objfiles.c 22 Jun 2009 21:38:14 -0000
@@ -674,7 +674,7 @@ objfile_relocate (struct objfile *objfil
}

/* Relocate breakpoints as necessary, after things are relocated. */
- breakpoint_re_set_objfile (objfile);
+ breakpoint_re_set ();
}
\f
/* Many places in gdb want to test just to see if we have any partial
Index: symfile.c
===================================================================
RCS file: /cvs/src/src/gdb/symfile.c,v
retrieving revision 1.232
diff -u -p -u -r1.232 symfile.c
--- symfile.c 17 Jun 2009 18:34:34 -0000 1.232
+++ symfile.c 22 Jun 2009 21:38:15 -0000
@@ -919,7 +919,7 @@ new_symfile_objfile (struct objfile *obj
}
else if ((add_flags & SYMFILE_DEFER_BP_RESET) == 0)
{
- breakpoint_re_set_objfile (objfile);
+ breakpoint_re_set ();
}

/* We're done reading the symbol file; finish off complaints. */