* [rfc][patch] Eliminate quadratic slow-down on number of solibs.
@ 2009-04-20 23:29 Paul Pluzhnikov
2009-04-21 1:06 ` Tom Tromey
0 siblings, 1 reply; 17+ messages in thread
From: Paul Pluzhnikov @ 2009-04-20 23:29 UTC (permalink / raw)
To: gdb-patches
Greetings,
We have a test case which uses ~2800 shared libraries.
Running this test with '--version' (i.e. run to main and exit) takes about
40 seconds.
Running it under GDB (CVS Head) with a breakpoint set on main takes 15
minutes, with significant CPU usage by GDB itself. Profiling GDB, I see
that the 2 top contributors are:
time seconds seconds calls s/call s/call name
61.66 728.26 728.26 2794 0.26 0.26 find_methods
24.21 1014.18 285.91 3904625 0.00 0.00 lookup_minimal_symbol_text
The former call comes from breakpoin_re_set(), as GDB scans all libraries
loaded so far, looking to see if any of them define Objective-C methods
which match "main" as a selector.
The latter call comes from repeaded calls to create_overlay_event_breakpoint,
which again scans all libraries loaded so far for "_ovly_debug_event".
AFAICT, both of the above scans are quadratic in number of solibs; and we
don't use either overlays or Objective-C, so this is "pure waste" for us.
To address the repeated scanning for objective-c, I propose adding
n_objc_syms to the struct objstats, initializing that field to ~0,
and counting them in find_methods the first time we encounter a given
objfile. If we see that objfile again, and n_objc_syms == 0, find_methods
could return immediately.
To address the overlay_event_breakpoint, I propose attached patch.
[Tested on Linux/x86_64 with no regressions.]
Comments?
Thanks,
--
Paul Pluzhnikov
ChangeLog:
2009-04-20 Paul Pluzhnikov <ppluzhnikov@google.com>
* breakpoint.h: Add breakpoint_re_set_objfile prototype.
* breakpoint.c (breakpoint_re_set_objfile): Don't rescan
all objfiles unnecessarily.
(breakpoint_re_set): New function.
* symfile.c (new_symfile_objfile): Call breakpoint_re_set_objfile
instead of breakpoint_re_set.
* objfiles.c (objfile_relocate): Likewise.
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 20 Apr 2009 23:02:11 -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: breakpoint.c
===================================================================
RCS file: /cvs/src/src/gdb/breakpoint.c,v
retrieving revision 1.390
diff -u -p -u -r1.390 breakpoint.c
--- breakpoint.c 31 Mar 2009 16:44:17 -0000 1.390
+++ breakpoint.c 20 Apr 2009 23:02:11 -0000
@@ -7711,7 +7711,7 @@ breakpoint_re_set_one (void *bint)
/* Re-set all breakpoints after symbols have been re-loaded. */
void
-breakpoint_re_set (void)
+breakpoint_re_set_objfile (struct objfile *objfile)
{
struct breakpoint *b, *temp;
enum language save_language;
@@ -7730,8 +7730,17 @@ breakpoint_re_set (void)
}
set_language (save_language);
input_radix = save_input_radix;
-
- create_overlay_event_breakpoint ("_ovly_debug_event");
+
+ if (objfile != NULL)
+ create_overlay_event_breakpoint_1 ("_ovly_debug_event", objfile);
+ else
+ create_overlay_event_breakpoint ("_ovly_debug_event");
+}
+
+void
+breakpoint_re_set (void)
+{
+ breakpoint_re_set_objfile (NULL);
}
\f
/* Reset the thread number of this breakpoint:
Index: symfile.c
===================================================================
RCS file: /cvs/src/src/gdb/symfile.c,v
retrieving revision 1.224
diff -u -p -u -r1.224 symfile.c
--- symfile.c 7 Apr 2009 20:43:51 -0000 1.224
+++ symfile.c 20 Apr 2009 23:02:11 -0000
@@ -922,7 +922,7 @@ new_symfile_objfile (struct objfile *obj
}
else
{
- breakpoint_re_set ();
+ breakpoint_re_set_objfile (objfile);
}
/* We're done reading the symbol file; finish off complaints. */
Index: objfiles.c
===================================================================
RCS file: /cvs/src/src/gdb/objfiles.c,v
retrieving revision 1.82
diff -u -p -u -r1.82 objfiles.c
--- objfiles.c 11 Mar 2009 20:26:02 -0000 1.82
+++ objfiles.c 20 Apr 2009 23:02:11 -0000
@@ -674,7 +674,7 @@ objfile_relocate (struct objfile *objfil
}
/* Relocate breakpoints as necessary, after things are relocated. */
- breakpoint_re_set ();
+ breakpoint_re_set_objfile (objfile);
}
\f
/* Many places in gdb want to test just to see if we have any partial
^ permalink raw reply [flat|nested] 17+ messages in thread* Re: [rfc][patch] Eliminate quadratic slow-down on number of solibs. 2009-04-20 23:29 [rfc][patch] Eliminate quadratic slow-down on number of solibs Paul Pluzhnikov @ 2009-04-21 1:06 ` Tom Tromey 2009-04-29 21:12 ` Paul Pluzhnikov 0 siblings, 1 reply; 17+ messages in thread From: Tom Tromey @ 2009-04-21 1:06 UTC (permalink / raw) To: Paul Pluzhnikov; +Cc: gdb-patches >>>>> "Paul" == Paul Pluzhnikov <ppluzhnikov@google.com> writes: Paul> We have a test case which uses ~2800 shared libraries. Awesome. Paul> To address the repeated scanning for objective-c, I propose adding Paul> n_objc_syms to the struct objstats, initializing that field to ~0, Paul> and counting them in find_methods the first time we encounter a given Paul> objfile. If we see that objfile again, and n_objc_syms == 0, find_methods Paul> could return immediately. This seems reasonable. I wonder whether it should use the generic per-objfile data storage stuff, rather than sticking ObjC-specific stuff directly into the objfile. Paul> Comments? This look reasonable enough to me, though I'd prefer someone more familiar with breakpoints take a look. Paul> /* Re-set all breakpoints after symbols have been re-loaded. */ Paul> void Paul> -breakpoint_re_set (void) Paul> +breakpoint_re_set_objfile (struct objfile *objfile) The new argument needs a description in the function header. Paul> +void Paul> +breakpoint_re_set (void) This needs a function header; I think you can just copy the old one. Tom ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [rfc][patch] Eliminate quadratic slow-down on number of solibs. 2009-04-21 1:06 ` Tom Tromey @ 2009-04-29 21:12 ` Paul Pluzhnikov 2009-05-12 8:48 ` Joel Brobecker 0 siblings, 1 reply; 17+ messages in thread From: Paul Pluzhnikov @ 2009-04-29 21:12 UTC (permalink / raw) To: tromey; +Cc: gdb-patches [-- Attachment #1: Type: text/plain, Size: 1158 bytes --] On Mon, Apr 20, 2009 at 6:06 PM, Tom Tromey <tromey@redhat.com> wrote: > Paul> To address the repeated scanning for objective-c, I propose adding > Paul> n_objc_syms to the struct objstats, initializing that field to ~0, > > I wonder whether it should use the generic per-objfile data storage > stuff, rather than sticking ObjC-specific stuff directly into the > objfile. Thanks, this is probably a good idea. I'll work on that next. > Paul> /* Re-set all breakpoints after symbols have been re-loaded. */ > Paul> void > Paul> -breakpoint_re_set (void) > Paul> +breakpoint_re_set_objfile (struct objfile *objfile) > > The new argument needs a description in the function header. Done. OK to commit? Thanks, -- Paul Pluzhnikov 2009-04-29 Paul Pluzhnikov <ppluzhnikov@google.com> * breakpoint.h: Add breakpoint_re_set_objfile prototype. * breakpoint.c (breakpoint_re_set_objfile): Don't rescan all objfiles unnecessarily. (breakpoint_re_set): New function. * symfile.c (new_symfile_objfile): Call breakpoint_re_set_objfile instead of breakpoint_re_set. * objfiles.c (objfile_relocate): Likewise. [-- Attachment #2: gdb-breakpoint-20090429.txt --] [-- Type: text/plain, Size: 3004 bytes --] 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 29 Apr 2009 21:07:03 -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: breakpoint.c =================================================================== RCS file: /cvs/src/src/gdb/breakpoint.c,v retrieving revision 1.392 diff -u -p -u -r1.392 breakpoint.c --- breakpoint.c 29 Apr 2009 19:31:58 -0000 1.392 +++ breakpoint.c 29 Apr 2009 21:07:04 -0000 @@ -7709,9 +7709,13 @@ breakpoint_re_set_one (void *bint) return 0; } -/* Re-set all breakpoints after symbols have been re-loaded. */ +/* 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. */ + void -breakpoint_re_set (void) +breakpoint_re_set_objfile (struct objfile *objfile) { struct breakpoint *b, *temp; enum language save_language; @@ -7730,8 +7734,19 @@ breakpoint_re_set (void) } set_language (save_language); input_radix = save_input_radix; - - create_overlay_event_breakpoint ("_ovly_debug_event"); + + if (objfile != NULL) + create_overlay_event_breakpoint_1 ("_ovly_debug_event", objfile); + else + create_overlay_event_breakpoint ("_ovly_debug_event"); +} + +/* Re-set all breakpoints after symbols have been re-loaded. */ + +void +breakpoint_re_set (void) +{ + breakpoint_re_set_objfile (NULL); } \f /* Reset the thread number of this breakpoint: Index: symfile.c =================================================================== RCS file: /cvs/src/src/gdb/symfile.c,v retrieving revision 1.224 diff -u -p -u -r1.224 symfile.c --- symfile.c 7 Apr 2009 20:43:51 -0000 1.224 +++ symfile.c 29 Apr 2009 21:07:04 -0000 @@ -922,7 +922,7 @@ new_symfile_objfile (struct objfile *obj } else { - breakpoint_re_set (); + breakpoint_re_set_objfile (objfile); } /* We're done reading the symbol file; finish off complaints. */ Index: objfiles.c =================================================================== RCS file: /cvs/src/src/gdb/objfiles.c,v retrieving revision 1.82 diff -u -p -u -r1.82 objfiles.c --- objfiles.c 11 Mar 2009 20:26:02 -0000 1.82 +++ objfiles.c 29 Apr 2009 21:07:04 -0000 @@ -674,7 +674,7 @@ objfile_relocate (struct objfile *objfil } /* Relocate breakpoints as necessary, after things are relocated. */ - breakpoint_re_set (); + breakpoint_re_set_objfile (objfile); } \f /* Many places in gdb want to test just to see if we have any partial ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [rfc][patch] Eliminate quadratic slow-down on number of solibs. 2009-04-29 21:12 ` Paul Pluzhnikov @ 2009-05-12 8:48 ` Joel Brobecker 2009-05-12 21:21 ` Paul Pluzhnikov 0 siblings, 1 reply; 17+ messages in thread From: Joel Brobecker @ 2009-05-12 8:48 UTC (permalink / raw) To: Paul Pluzhnikov; +Cc: tromey, gdb-patches > 2009-04-29 Paul Pluzhnikov <ppluzhnikov@google.com> > > * breakpoint.h: Add breakpoint_re_set_objfile prototype. > > * breakpoint.c (breakpoint_re_set_objfile): Don't rescan > all objfiles unnecessarily. > (breakpoint_re_set): New function. > > * symfile.c (new_symfile_objfile): Call breakpoint_re_set_objfile > instead of breakpoint_re_set. > > * objfiles.c (objfile_relocate): Likewise. Looks OK to me. Perhaps we could get rid of create_overlay_event_breakpoint entirely by inlining it at the only location where it remains in use, and then we can rename create_overlay_event_breakpoint_1 back to create_overlay_event_breakpoint. Just thinking out loud, not that it matters very much; it's just that, if it is potentially expensive to call create_overlay_event_breakpoint because it iterates over all objfiles, it might be beneficial to make this apparent by forcing the caller to do the iteration (one line of code). -- Joel ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [rfc][patch] Eliminate quadratic slow-down on number of solibs. 2009-05-12 8:48 ` Joel Brobecker @ 2009-05-12 21:21 ` Paul Pluzhnikov 2009-05-13 9:39 ` Joel Brobecker 2009-06-22 17:10 ` Ulrich Weigand 0 siblings, 2 replies; 17+ messages in thread From: Paul Pluzhnikov @ 2009-05-12 21:21 UTC (permalink / raw) To: Joel Brobecker; +Cc: tromey, gdb-patches [-- Attachment #1: Type: text/plain, Size: 1362 bytes --] On Tue, May 12, 2009 at 1:48 AM, Joel Brobecker <brobecker@adacore.com> wrote: > Perhaps we could get rid of create_overlay_event_breakpoint entirely > by inlining it at the only location where it remains in use, There were two locations ... > and then > we can rename create_overlay_event_breakpoint_1 back to > create_overlay_event_breakpoint. Just thinking out loud, not that > it matters very much; it's just that, if it is potentially expensive > to call create_overlay_event_breakpoint because it iterates over > all objfiles, it might be beneficial to make this apparent by forcing > the caller to do the iteration (one line of code). Sounds like a good idea. Revised patch attached (there is a bit of code movement to eliminate the need for forward prototypes). Tested on Linux/x86_64 with no regressions. Thanks, -- Paul Pluzhnikov 2009-05-12 Paul Pluzhnikov <ppluzhnikov@google.com> * breakpoint.h: Add breakpoint_re_set_objfile prototype. * breakpoint.c (create_overlay_event_breakpoint): Renamed from create_overlay_event_breakpoint_1, old create_overlay_event_breakpoint deleted. (breakpoint_re_set_objfile): Don't rescan all objfiles unnecessarily. (breakpoint_re_set): New function. * symfile.c (new_symfile_objfile): Call breakpoint_re_set_objfile instead of breakpoint_re_set. * objfiles.c (objfile_relocate): Likewise. [-- Attachment #2: gdb-breakpoint-20090512.txt --] [-- Type: text/plain, Size: 6092 bytes --] diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index d403f36..3461824 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -150,8 +150,6 @@ static int watchpoint_check (void *); static void maintenance_info_breakpoints (char *, int); -static void create_overlay_event_breakpoint (char *); - static int hw_breakpoint_used_count (void); static int hw_watchpoint_used_count (enum bptype, int *); @@ -1459,12 +1457,58 @@ reattach_breakpoints (int pid) return 0; } +static struct breakpoint * +create_internal_breakpoint (CORE_ADDR address, enum bptype type) +{ + static int internal_breakpoint_number = -1; + struct symtab_and_line sal; + struct breakpoint *b; + + init_sal (&sal); /* initialize to zeroes */ + + sal.pc = address; + sal.section = find_pc_overlay (sal.pc); + + b = set_raw_breakpoint (sal, type); + b->number = internal_breakpoint_number--; + b->disposition = disp_donttouch; + + return b; +} + +static void +create_overlay_event_breakpoint (char *func_name, struct objfile *objfile) +{ + struct breakpoint *b; + struct minimal_symbol *m; + + if ((m = lookup_minimal_symbol_text (func_name, objfile)) == NULL) + return; + + b = create_internal_breakpoint (SYMBOL_VALUE_ADDRESS (m), + bp_overlay_event); + b->addr_string = xstrdup (func_name); + + if (overlay_debugging == ovly_auto) + { + b->enable_state = bp_enabled; + overlay_events_enabled = 1; + } + else + { + b->enable_state = bp_disabled; + overlay_events_enabled = 0; + } + update_global_location_list (1); +} + 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 @@ -1559,7 +1603,8 @@ update_breakpoints_after_exec (void) } } /* FIXME what about longjmp breakpoints? Re-create them here? */ - create_overlay_event_breakpoint ("_ovly_debug_event"); + ALL_OBJFILES (objfile) + create_overlay_event_breakpoint ("_ovly_debug_event", objfile); } int @@ -4380,26 +4425,6 @@ make_breakpoint_permanent (struct breakpoint *b) bl->inserted = 1; } -static struct breakpoint * -create_internal_breakpoint (CORE_ADDR address, enum bptype type) -{ - static int internal_breakpoint_number = -1; - struct symtab_and_line sal; - struct breakpoint *b; - - init_sal (&sal); /* initialize to zeroes */ - - sal.pc = address; - sal.section = find_pc_overlay (sal.pc); - - b = set_raw_breakpoint (sal, type); - b->number = internal_breakpoint_number--; - b->disposition = disp_donttouch; - - return b; -} - - static void create_longjmp_breakpoint (char *func_name) { @@ -4441,40 +4466,6 @@ delete_longjmp_breakpoint (int thread) } } -static void -create_overlay_event_breakpoint_1 (char *func_name, struct objfile *objfile) -{ - struct breakpoint *b; - struct minimal_symbol *m; - - if ((m = lookup_minimal_symbol_text (func_name, objfile)) == NULL) - return; - - b = create_internal_breakpoint (SYMBOL_VALUE_ADDRESS (m), - bp_overlay_event); - b->addr_string = xstrdup (func_name); - - if (overlay_debugging == ovly_auto) - { - b->enable_state = bp_enabled; - overlay_events_enabled = 1; - } - else - { - b->enable_state = bp_disabled; - overlay_events_enabled = 0; - } - 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 enable_overlay_breakpoints (void) { @@ -7723,9 +7714,13 @@ breakpoint_re_set_one (void *bint) return 0; } -/* Re-set all breakpoints after symbols have been re-loaded. */ +/* 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. */ + void -breakpoint_re_set (void) +breakpoint_re_set_objfile (struct objfile *objfile) { struct breakpoint *b, *temp; enum language save_language; @@ -7744,8 +7739,20 @@ breakpoint_re_set (void) } set_language (save_language); input_radix = save_input_radix; - - create_overlay_event_breakpoint ("_ovly_debug_event"); + + 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); } \f /* Reset the thread number of this breakpoint: diff --git a/gdb/breakpoint.h b/gdb/breakpoint.h index 17b2761..43c2f3f 100644 --- a/gdb/breakpoint.h +++ b/gdb/breakpoint.h @@ -687,7 +687,7 @@ extern int breakpoint_thread_match (CORE_ADDR, ptid_t); 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 diff --git a/gdb/objfiles.c b/gdb/objfiles.c index 795d53b..30a4313 100644 --- a/gdb/objfiles.c +++ b/gdb/objfiles.c @@ -674,7 +674,7 @@ objfile_relocate (struct objfile *objfile, struct section_offsets *new_offsets) } /* Relocate breakpoints as necessary, after things are relocated. */ - breakpoint_re_set (); + breakpoint_re_set_objfile (objfile); } \f /* Many places in gdb want to test just to see if we have any partial diff --git a/gdb/symfile.c b/gdb/symfile.c index 527b0d5..774101d 100644 --- a/gdb/symfile.c +++ b/gdb/symfile.c @@ -923,7 +923,7 @@ new_symfile_objfile (struct objfile *objfile, int mainline, int verbo) } else { - breakpoint_re_set (); + breakpoint_re_set_objfile (objfile); } /* We're done reading the symbol file; finish off complaints. */ ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [rfc][patch] Eliminate quadratic slow-down on number of solibs. 2009-05-12 21:21 ` Paul Pluzhnikov @ 2009-05-13 9:39 ` Joel Brobecker 2009-06-22 17:10 ` Ulrich Weigand 1 sibling, 0 replies; 17+ messages in thread From: Joel Brobecker @ 2009-05-13 9:39 UTC (permalink / raw) To: Paul Pluzhnikov; +Cc: tromey, gdb-patches > 2009-05-12 Paul Pluzhnikov <ppluzhnikov@google.com> > > * breakpoint.h: Add breakpoint_re_set_objfile prototype. > > * breakpoint.c (create_overlay_event_breakpoint): Renamed > from create_overlay_event_breakpoint_1, old > create_overlay_event_breakpoint deleted. > (breakpoint_re_set_objfile): Don't rescan all objfiles > unnecessarily. > (breakpoint_re_set): New function. > > * symfile.c (new_symfile_objfile): Call breakpoint_re_set_objfile > instead of breakpoint_re_set. > > * objfiles.c (objfile_relocate): Likewise. Looks good. Just a tiny formatting remark in your ChangeLog: A new line should be used I think only when the changes are logically unrelated. -- Joel ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [rfc][patch] Eliminate quadratic slow-down on number of solibs. 2009-05-12 21:21 ` Paul Pluzhnikov 2009-05-13 9:39 ` Joel Brobecker @ 2009-06-22 17:10 ` Ulrich Weigand 2009-06-22 18:56 ` Paul Pluzhnikov 1 sibling, 1 reply; 17+ messages in thread From: Ulrich Weigand @ 2009-06-22 17:10 UTC (permalink / raw) To: Paul Pluzhnikov; +Cc: Joel Brobecker, tromey, gdb-patches Paul Pluzhnikov wrote: > 2009-05-12 Paul Pluzhnikov <ppluzhnikov@google.com> > > * breakpoint.h: Add breakpoint_re_set_objfile prototype. > > * breakpoint.c (create_overlay_event_breakpoint): Renamed > from create_overlay_event_breakpoint_1, old > create_overlay_event_breakpoint deleted. > (breakpoint_re_set_objfile): Don't rescan all objfiles > unnecessarily. > (breakpoint_re_set): New function. > > * symfile.c (new_symfile_objfile): Call breakpoint_re_set_objfile > instead of breakpoint_re_set. > > * objfiles.c (objfile_relocate): Likewise. Maybe I'm missing something here, but this seems to break overlay support. Assume that _ovly_debug_event is defined in objfile A, and breakpoint_re_set_objfile is called for objfile B. The logic in breakpoint_re_set_one will unconditionally delete all instances of bp_overlay_event breakpoints, including the one in objfile A, because it assumes they will be reset later. However, after your change only objfile B is scanned for that symbol; as it is not found there, the overlay event breakpoint will simply not be reset. I guess the situation for Cell/B.E. applications with multiple SPU contexts would be even worse. In this case, we have multiple objfiles each defining its own instance of _ovly_debug_event, and for proper operation of overlay debugging each of those instances need to carry a breakpoint. Before your patch, breakpoint_re_set would first delete all instances of the overlay event breakpoint, and subsequently reset them all. After your patch, breakpoint_re_set_objfile will *still* delete *all* instances, but will subsequently reset at most one of them ... How is this supposed to work? If you're going to reset only breakpoints from one objfile, maybe you should likewise *delete* only breakpoints from that objfile? Bye, Ulrich -- Dr. Ulrich Weigand GNU Toolchain for Linux on System z and Cell BE Ulrich.Weigand@de.ibm.com ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [rfc][patch] Eliminate quadratic slow-down on number of solibs. 2009-06-22 17:10 ` Ulrich Weigand @ 2009-06-22 18:56 ` Paul Pluzhnikov 2009-06-22 19:30 ` Ulrich Weigand 2009-06-22 20:41 ` Doug Evans 0 siblings, 2 replies; 17+ messages in thread From: Paul Pluzhnikov @ 2009-06-22 18:56 UTC (permalink / raw) To: Ulrich Weigand; +Cc: Joel Brobecker, tromey, gdb-patches [-- 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; ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [rfc][patch] Eliminate quadratic slow-down on number of solibs. 2009-06-22 18:56 ` Paul Pluzhnikov @ 2009-06-22 19:30 ` Ulrich Weigand 2009-06-22 19:42 ` Paul Pluzhnikov 2009-06-22 20:41 ` Doug Evans 1 sibling, 1 reply; 17+ messages in thread From: Ulrich Weigand @ 2009-06-22 19:30 UTC (permalink / raw) To: Paul Pluzhnikov; +Cc: Joel Brobecker, tromey, gdb-patches Paul Pluzhnikov wrote: > > 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. Thanks for the quick reply! > 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? Unfortunately, I don't have a ready test case, I noticed the problem while reading the code ... Mainline GDB does not yet support combined Cell/B.E. debugging, and stand-alone SPU executables are always statically linked so I'm never seeing more than one objfile anyway. In any case, I don't think your patch fixes the problem in the case where more than one objfile defines _ovly_debug_event: > + 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; If objfile actually defines _ovly_debug_event, the symbol lookup will succeed for *all* bp_overlay_event breakpoints, as they all use the same addr_string, and thus all breakpoints will be deleted. But again, only one of them will get re-inserted ... I guess you'd have to verify that not only symbol lookup succeeded, but it results in the address used to set this breakpoint. But that's not really correct either, because breakpoint_re_set may get called after an objfile has been relocated. In fact, I don't really see an easy way to identify the originating objfile just from looking at the breakpoint. Maybe we could set addr_string to some string that uniquely identifies the objfile when creating the breakpoint? It isn't really used for a lot else for bp_overlay_event breakpoints (except for the maint info breakpoint output). Bye, Ulrich -- Dr. Ulrich Weigand GNU Toolchain for Linux on System z and Cell BE Ulrich.Weigand@de.ibm.com ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [rfc][patch] Eliminate quadratic slow-down on number of solibs. 2009-06-22 19:30 ` Ulrich Weigand @ 2009-06-22 19:42 ` Paul Pluzhnikov 2009-06-22 20:06 ` Ulrich Weigand 0 siblings, 1 reply; 17+ messages in thread From: Paul Pluzhnikov @ 2009-06-22 19:42 UTC (permalink / raw) To: Ulrich Weigand; +Cc: Joel Brobecker, tromey, gdb-patches On Mon, Jun 22, 2009 at 12:28 PM, Ulrich Weigand<uweigand@de.ibm.com> wrote: > In any case, I don't think your patch fixes the problem in the case > where more than one objfile defines _ovly_debug_event: Yes, I realized that soon after posting the patch as well :-( > In fact, I don't really see an easy way to identify the originating > objfile just from looking at the breakpoint. Maybe we could set addr_string > to some string that uniquely identifies the objfile when creating the > breakpoint? It isn't really used for a lot else for bp_overlay_event > breakpoints (except for the maint info breakpoint output). Perhaps a better alternative is to restore the overlay-bp-reset behavior to "before 2009-05-12" commit: now that this change is in: 2009-06-16 Paul Pluzhnikov <ppluzhnikov@google.com> * solib.c (symbol_add_stub): New FLAGS parameter. ... (solib_add): Defer breakpoint_re_set until after all solibs. the 2009-05-12 change (I believe -- I'd need to verify that) should no longer make any difference. Thanks, -- Paul Pluzhnikov ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [rfc][patch] Eliminate quadratic slow-down on number of solibs. 2009-06-22 19:42 ` Paul Pluzhnikov @ 2009-06-22 20:06 ` Ulrich Weigand 2009-06-22 22:04 ` Paul Pluzhnikov 0 siblings, 1 reply; 17+ messages in thread From: Ulrich Weigand @ 2009-06-22 20:06 UTC (permalink / raw) To: Paul Pluzhnikov; +Cc: Joel Brobecker, tromey, gdb-patches Paul Pluzhnikov 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: > > 2009-06-16 Paul Pluzhnikov <ppluzhnikov@google.com> > > * solib.c (symbol_add_stub): New FLAGS parameter. > ... > (solib_add): Defer breakpoint_re_set until after all solibs. > > the 2009-05-12 change (I believe -- I'd need to verify that) should no > longer make any difference. That would certainly be OK with me as well. Thanks, Ulrich -- Dr. Ulrich Weigand GNU Toolchain for Linux on System z and Cell BE Ulrich.Weigand@de.ibm.com ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [rfc][patch] Eliminate quadratic slow-down on number of solibs. 2009-06-22 20:06 ` Ulrich Weigand @ 2009-06-22 22:04 ` Paul Pluzhnikov 2009-06-23 0:43 ` Ulrich Weigand 0 siblings, 1 reply; 17+ messages in thread From: Paul Pluzhnikov @ 2009-06-22 22:04 UTC (permalink / raw) To: Ulrich Weigand; +Cc: Joel Brobecker, tromey, gdb-patches [-- 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. */ ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [rfc][patch] Eliminate quadratic slow-down on number of solibs. 2009-06-22 22:04 ` Paul Pluzhnikov @ 2009-06-23 0:43 ` Ulrich Weigand 2009-06-23 1:33 ` Paul Pluzhnikov 0 siblings, 1 reply; 17+ messages in thread From: Ulrich Weigand @ 2009-06-23 0:43 UTC (permalink / raw) To: Paul Pluzhnikov; +Cc: Joel Brobecker, tromey, gdb-patches Paul Pluzhnikov wrote: > 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. This is OK. (Any reason why we can't inline create_overlay_event_breakpoint_1 into its sole caller?) > 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). Hmm, do you understand where the other calls come from? Bye, Ulrich -- Dr. Ulrich Weigand GNU Toolchain for Linux on System z and Cell BE Ulrich.Weigand@de.ibm.com ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [rfc][patch] Eliminate quadratic slow-down on number of solibs. 2009-06-23 0:43 ` Ulrich Weigand @ 2009-06-23 1:33 ` Paul Pluzhnikov 2009-06-23 13:32 ` Ulrich Weigand 0 siblings, 1 reply; 17+ messages in thread From: Paul Pluzhnikov @ 2009-06-23 1:33 UTC (permalink / raw) To: Ulrich Weigand; +Cc: Joel Brobecker, tromey, gdb-patches [-- Attachment #1: Type: text/plain, Size: 1276 bytes --] On Mon, Jun 22, 2009 at 5:43 PM, Ulrich Weigand<uweigand@de.ibm.com> wrote: > This is OK. (Any reason why we can't inline create_overlay_event_breakpoint_1 > into its sole caller?) No particular reason (it was that way before my 2009-05-14 change). I've inlined it in the patch below, and that saves a bunch of calls to update_global_location_list as well :-) 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). > > Hmm, do you understand where the other calls come from? I've attached a log (to avoid GMail line wrapping): 4 calls at startup, 3 more when all the solibs are loaded. I haven't debugged the exact reason; in my reading of the code it should only fire once after all solibs. 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): Remove objfile parameter, iterate over all objfiles. * objfiles.c (objfile_relocate): Update. * symfile.c (new_symfile_objfile): Likewise. [-- Attachment #2: gdb-overlay-bp-20090622-3.txt --] [-- Type: text/plain, Size: 5106 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 23 Jun 2009 01:22:08 -0000 @@ -1476,28 +1476,33 @@ create_internal_breakpoint (CORE_ADDR ad } static void -create_overlay_event_breakpoint (char *func_name, struct objfile *objfile) +create_overlay_event_breakpoint (char *func_name) { - struct breakpoint *b; - struct minimal_symbol *m; + struct objfile *objfile; - m = lookup_minimal_symbol_text (func_name, objfile); - if (m == NULL) - return; + ALL_OBJFILES (objfile) + { + struct breakpoint *b; + struct minimal_symbol *m; + + m = lookup_minimal_symbol_text (func_name, objfile); + if (m == NULL) + continue; - b = create_internal_breakpoint (SYMBOL_VALUE_ADDRESS (m), - bp_overlay_event); - b->addr_string = xstrdup (func_name); + b = create_internal_breakpoint (SYMBOL_VALUE_ADDRESS (m), + bp_overlay_event); + b->addr_string = xstrdup (func_name); - if (overlay_debugging == ovly_auto) - { - b->enable_state = bp_enabled; - overlay_events_enabled = 1; - } - else - { - b->enable_state = bp_disabled; - overlay_events_enabled = 0; + if (overlay_debugging == ovly_auto) + { + b->enable_state = bp_enabled; + overlay_events_enabled = 1; + } + else + { + b->enable_state = bp_disabled; + overlay_events_enabled = 0; + } } update_global_location_list (1); } @@ -1508,7 +1513,6 @@ 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 +1607,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 +7774,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 +7796,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 23 Jun 2009 01:22:08 -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 23 Jun 2009 01:22:08 -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 23 Jun 2009 01:22:08 -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. */ [-- Attachment #3: gdblog.txt --] [-- Type: text/plain, Size: 11447 bytes --] Breakpoint 1, create_overlay_event_breakpoint (func_name=0x676609 "_ovly_debug_event") at ../../src/gdb/breakpoint.c:1480 1480 { #0 create_overlay_event_breakpoint (func_name=0x676609 "_ovly_debug_event") at ../../src/gdb/breakpoint.c:1480 #1 0x00000000004e1a23 in clear_symtab_users () at ../../src/gdb/symfile.c:2800 #2 0x00000000004e2104 in new_symfile_objfile (objfile=0x676609, add_flags=4) at ../../src/gdb/symfile.c:918 #3 0x00000000004e3c6a in symbol_file_add_with_addrs_or_offsets (abfd=0x0, add_flags=4, addrs=0x0, offsets=0x0, num_offsets=0, flags=0) at ../../src/gdb/symfile.c:1083 #4 0x00000000004e45a8 in symbol_file_add_main_1 (args=0x676609 "_ovly_debug_event", from_tty=<value optimized out>, flags=99) at ../../src/gdb/symfile.c:1137 #5 0x00000000004fe626 in catch_command_errors (command=0x4e45c0 <symbol_file_add_main>, arg=0x7fffffffdea7 "blaze-google3/blaze-out/gcc-4.3.1-glibc-2.3.6-grte-k8-dbg/bin/gws/output/pages/custom_test", from_tty=0, mask=<value optimized out>) at ../../src/gdb/exceptions.c:525 #6 0x0000000000446574 in captured_main (data=<value optimized out>) at ../../src/gdb/main.c:811 #7 0x00000000004fe6ab in catch_errors (func=0x445d20 <captured_main>, func_args=0x7fffffffd960, errstring=0x660050 "", mask=<value optimized out>) at ../../src/gdb/exceptions.c:510 #8 0x0000000000445ac4 in gdb_main (args=0x6635f1) at ../../src/gdb/main.c:911 #9 0x0000000000445a96 in main (argc=<value optimized out>, argv=0x6635f1) at ../../src/gdb/gdb.c:33 Breakpoint 1 at 0x406b3d: file gws/output/pages/custom_test.cc, line 793. Breakpoint 1, create_overlay_event_breakpoint (func_name=0x676609 "_ovly_debug_event") at ../../src/gdb/breakpoint.c:1480 1480 { #0 create_overlay_event_breakpoint (func_name=0x676609 "_ovly_debug_event") at ../../src/gdb/breakpoint.c:1480 #1 0x0000000000462a67 in solib_add (pattern=0x0, from_tty=0, target=<value optimized out>, readsyms=1) at ../../src/gdb/solib.c:763 #2 0x0000000000464283 in enable_break (info=0xa8fd60) at ../../src/gdb/solib-svr4.c:1393 #3 0x00000000004eea63 in post_create_inferior (target=0x9e0bc0, from_tty=0) at ../../src/gdb/infcmd.c:419 #4 0x00000000004ef3f3 in run_command_1 (args=0x0, from_tty=0, tbreak_at_main=<value optimized out>) at ../../src/gdb/infcmd.c:572 #5 0x000000000044d434 in execute_command (p=0x7fffffffde94 "", from_tty=0) at ../../src/gdb/top.c:442 #6 0x00000000004fe626 in catch_command_errors (command=0x44d1c0 <execute_command>, arg=0x7fffffffde91 "run", from_tty=1, mask=<value optimized out>) at ../../src/gdb/exceptions.c:525 #7 0x00000000004463dd in captured_main (data=<value optimized out>) at ../../src/gdb/main.c:861 #8 0x00000000004fe6ab in catch_errors (func=0x445d20 <captured_main>, func_args=0x7fffffffd960, errstring=0x660050 "", mask=<value optimized out>) at ../../src/gdb/exceptions.c:510 #9 0x0000000000445ac4 in gdb_main (args=0x6837c3) at ../../src/gdb/main.c:911 #10 0x0000000000445a96 in main (argc=<value optimized out>, argv=0x6837c3) at ../../src/gdb/gdb.c:33 Breakpoint 1, create_overlay_event_breakpoint (func_name=0x676609 "_ovly_debug_event") at ../../src/gdb/breakpoint.c:1480 1480 { #0 create_overlay_event_breakpoint (func_name=0x676609 "_ovly_debug_event") at ../../src/gdb/breakpoint.c:1480 #1 0x00000000004eea68 in post_create_inferior (target=0x9e0bc0, from_tty=0) at ../../src/gdb/infcmd.c:433 #2 0x00000000004ef3f3 in run_command_1 (args=0x0, from_tty=0, tbreak_at_main=<value optimized out>) at ../../src/gdb/infcmd.c:572 #3 0x000000000044d434 in execute_command (p=0x7fffffffde94 "", from_tty=0) at ../../src/gdb/top.c:442 #4 0x00000000004fe626 in catch_command_errors (command=0x44d1c0 <execute_command>, arg=0x7fffffffde91 "run", from_tty=1, mask=<value optimized out>) at ../../src/gdb/exceptions.c:525 #5 0x00000000004463dd in captured_main (data=<value optimized out>) at ../../src/gdb/main.c:861 #6 0x00000000004fe6ab in catch_errors (func=0x445d20 <captured_main>, func_args=0x7fffffffd960, errstring=0x660050 "", mask=<value optimized out>) at ../../src/gdb/exceptions.c:510 #7 0x0000000000445ac4 in gdb_main (args=0x6837c3) at ../../src/gdb/main.c:911 #8 0x0000000000445a96 in main (argc=<value optimized out>, argv=0x6837c3) at ../../src/gdb/gdb.c:33 Breakpoint 1, create_overlay_event_breakpoint (func_name=0x676609 "_ovly_debug_event") at ../../src/gdb/breakpoint.c:1480 1480 { #0 create_overlay_event_breakpoint (func_name=0x676609 "_ovly_debug_event") at ../../src/gdb/breakpoint.c:1480 #1 0x00000000004e20f6 in new_symfile_objfile (objfile=0x676609, add_flags=<value optimized out>) at ../../src/gdb/symfile.c:922 #2 0x00000000004e3c6a in symbol_file_add_with_addrs_or_offsets (abfd=0x0, add_flags=0, addrs=0x14bcd90, offsets=0x0, num_offsets=0, flags=2) at ../../src/gdb/symfile.c:1083 #3 0x00000000004661b6 in symbol_file_add_from_memory (templ=<value optimized out>, addr=<value optimized out>, name=<value optimized out>, from_tty=0) at ../../src/gdb/symfile-mem.c:110 #4 0x000000000046625a in symbol_file_add_from_memory_wrapper (uiout=<value optimized out>, data=0x3) at ../../src/gdb/symfile-mem.c:161 #5 0x00000000004fe750 in catch_exceptions_with_msg (uiout=0xa4f400, func=0x466240 <symbol_file_add_from_memory_wrapper>, func_args=0x7fffffffd690, gdberrmsg=0x0, mask=<value optimized out>) at ../../src/gdb/exceptions.c:478 #6 0x00000000004660b0 in add_vsyscall_page (target=<value optimized out>, from_tty=<value optimized out>) at ../../src/gdb/symfile-mem.c:205 #7 0x0000000000448f4e in generic_observer_notify (subject=<value optimized out>, args=0x7fffffffd6f0) at ../../src/gdb/observer.c:166 #8 0x00000000004496ea in observer_notify_inferior_created (objfile=<value optimized out>, from_tty=<value optimized out>) at ./observer.inc:174 #9 0x00000000004ef3f3 in run_command_1 (args=0x0, from_tty=0, tbreak_at_main=<value optimized out>) at ../../src/gdb/infcmd.c:572 #10 0x000000000044d434 in execute_command (p=0x7fffffffde94 "", from_tty=0) at ../../src/gdb/top.c:442 #11 0x00000000004fe626 in catch_command_errors (command=0x44d1c0 <execute_command>, arg=0x7fffffffde91 "run", from_tty=1, mask=<value optimized out>) at ../../src/gdb/exceptions.c:525 #12 0x00000000004463dd in captured_main (data=<value optimized out>) at ../../src/gdb/main.c:861 #13 0x00000000004fe6ab in catch_errors (func=0x445d20 <captured_main>, func_args=0x7fffffffd960, errstring=0x660050 "", mask=<value optimized out>) at ../../src/gdb/exceptions.c:510 #14 0x0000000000445ac4 in gdb_main (args=0x6837c3) at ../../src/gdb/main.c:911 #15 0x0000000000445a96 in main (argc=<value optimized out>, argv=0x6837c3) at ../../src/gdb/gdb.c:33 [Thread debugging using libthread_db enabled] Breakpoint 1, create_overlay_event_breakpoint (func_name=0x676609 "_ovly_debug_event") at ../../src/gdb/breakpoint.c:1480 1480 { #0 create_overlay_event_breakpoint (func_name=0x676609 "_ovly_debug_event") at ../../src/gdb/breakpoint.c:1480 #1 0x0000000000462a67 in solib_add (pattern=0x0, from_tty=0, target=<value optimized out>, readsyms=1) at ../../src/gdb/solib.c:763 #2 0x00000000004f4c2f in handle_inferior_event (ecs=0x7fffffffd580) at ../../src/gdb/infrun.c:3473 #3 0x00000000004f6f00 in wait_for_inferior (treat_exec_as_sigtrap=0) at ../../src/gdb/infrun.c:2023 #4 0x00000000004f7481 in proceed (addr=0, siggnal=TARGET_SIGNAL_0, step=<value optimized out>) at ../../src/gdb/infrun.c:1631 #5 0x00000000004ef403 in run_command_1 (args=0x0, from_tty=0, tbreak_at_main=<value optimized out>) at ../../src/gdb/infcmd.c:575 #6 0x000000000044d434 in execute_command (p=0x7fffffffde94 "", from_tty=0) at ../../src/gdb/top.c:442 #7 0x00000000004fe626 in catch_command_errors (command=0x44d1c0 <execute_command>, arg=0x7fffffffde91 "run", from_tty=1, mask=<value optimized out>) at ../../src/gdb/exceptions.c:525 #8 0x00000000004463dd in captured_main (data=<value optimized out>) at ../../src/gdb/main.c:861 #9 0x00000000004fe6ab in catch_errors (func=0x445d20 <captured_main>, func_args=0x7fffffffd960, errstring=0x660050 "", mask=<value optimized out>) at ../../src/gdb/exceptions.c:510 #10 0x0000000000445ac4 in gdb_main (args=0x6837c3) at ../../src/gdb/main.c:911 #11 0x0000000000445a96 in main (argc=<value optimized out>, argv=0x6837c3) at ../../src/gdb/gdb.c:33 Breakpoint 1, create_overlay_event_breakpoint (func_name=0x676609 "_ovly_debug_event") at ../../src/gdb/breakpoint.c:1480 1480 { #0 create_overlay_event_breakpoint (func_name=0x676609 "_ovly_debug_event") at ../../src/gdb/breakpoint.c:1480 #1 0x0000000000462a67 in solib_add (pattern=0x0, from_tty=0, target=<value optimized out>, readsyms=1) at ../../src/gdb/solib.c:763 #2 0x00000000004f4c2f in handle_inferior_event (ecs=0x7fffffffd580) at ../../src/gdb/infrun.c:3473 #3 0x00000000004f6f00 in wait_for_inferior (treat_exec_as_sigtrap=0) at ../../src/gdb/infrun.c:2023 #4 0x00000000004f7481 in proceed (addr=0, siggnal=TARGET_SIGNAL_0, step=<value optimized out>) at ../../src/gdb/infrun.c:1631 #5 0x00000000004ef403 in run_command_1 (args=0x0, from_tty=0, tbreak_at_main=<value optimized out>) at ../../src/gdb/infcmd.c:575 #6 0x000000000044d434 in execute_command (p=0x7fffffffde94 "", from_tty=0) at ../../src/gdb/top.c:442 #7 0x00000000004fe626 in catch_command_errors (command=0x44d1c0 <execute_command>, arg=0x7fffffffde91 "run", from_tty=1, mask=<value optimized out>) at ../../src/gdb/exceptions.c:525 #8 0x00000000004463dd in captured_main (data=<value optimized out>) at ../../src/gdb/main.c:861 #9 0x00000000004fe6ab in catch_errors (func=0x445d20 <captured_main>, func_args=0x7fffffffd960, errstring=0x660050 "", mask=<value optimized out>) at ../../src/gdb/exceptions.c:510 #10 0x0000000000445ac4 in gdb_main (args=0x6837c3) at ../../src/gdb/main.c:911 #11 0x0000000000445a96 in main (argc=<value optimized out>, argv=0x6837c3) at ../../src/gdb/gdb.c:33 Breakpoint 1, create_overlay_event_breakpoint (func_name=0x676609 "_ovly_debug_event") at ../../src/gdb/breakpoint.c:1480 1480 { #0 create_overlay_event_breakpoint (func_name=0x676609 "_ovly_debug_event") at ../../src/gdb/breakpoint.c:1480 #1 0x0000000000462a67 in solib_add (pattern=0x0, from_tty=0, target=<value optimized out>, readsyms=1) at ../../src/gdb/solib.c:763 #2 0x00000000004f4c2f in handle_inferior_event (ecs=0x7fffffffd580) at ../../src/gdb/infrun.c:3473 #3 0x00000000004f6f00 in wait_for_inferior (treat_exec_as_sigtrap=0) at ../../src/gdb/infrun.c:2023 #4 0x00000000004f7481 in proceed (addr=0, siggnal=TARGET_SIGNAL_0, step=<value optimized out>) at ../../src/gdb/infrun.c:1631 #5 0x00000000004ef403 in run_command_1 (args=0x0, from_tty=0, tbreak_at_main=<value optimized out>) at ../../src/gdb/infcmd.c:575 #6 0x000000000044d434 in execute_command (p=0x7fffffffde94 "", from_tty=0) at ../../src/gdb/top.c:442 #7 0x00000000004fe626 in catch_command_errors (command=0x44d1c0 <execute_command>, arg=0x7fffffffde91 "run", from_tty=1, mask=<value optimized out>) at ../../src/gdb/exceptions.c:525 #8 0x00000000004463dd in captured_main (data=<value optimized out>) at ../../src/gdb/main.c:861 #9 0x00000000004fe6ab in catch_errors (func=0x445d20 <captured_main>, func_args=0x7fffffffd960, errstring=0x660050 "", mask=<value optimized out>) at ../../src/gdb/exceptions.c:510 #10 0x0000000000445ac4 in gdb_main (args=0x6837c3) at ../../src/gdb/main.c:911 #11 0x0000000000445a96 in main (argc=<value optimized out>, argv=0x6837c3) at ../../src/gdb/gdb.c:33 ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [rfc][patch] Eliminate quadratic slow-down on number of solibs. 2009-06-23 1:33 ` Paul Pluzhnikov @ 2009-06-23 13:32 ` Ulrich Weigand 0 siblings, 0 replies; 17+ messages in thread From: Ulrich Weigand @ 2009-06-23 13:32 UTC (permalink / raw) To: Paul Pluzhnikov; +Cc: Joel Brobecker, tromey, gdb-patches Paul Pluzhnikov wrote: > >> 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). > > > > Hmm, do you understand where the other calls come from? > > I've attached a log (to avoid GMail line wrapping): 4 calls at startup, > 3 more when all the solibs are loaded. I haven't debugged the exact reason; > in my reading of the code it should only fire once after all solibs. So from these backtraces it looks like the calls on startup are: - one call after the main executable is loaded - one call in solib_add after all the directly linked shared libraries are loaded - one extra call in post_create_inferior: /* If the user sets watchpoints before execution having started, then she gets software watchpoints, because GDB can't know which target will end up being pushed, or if it supports hardware watchpoints or not. breakpoint_re_set takes care of promoting watchpoints to hardware watchpoints if possible, however, if this new inferior doesn't load shared libraries or we don't pull in symbols from any other source on this target/arch, breakpoint_re_set is never called. Call it now so that software watchpoints get a chance to be promoted to hardware watchpoints if the now pushed target supports hardware watchpoints. */ - and finally one more call after the "magic" vsyscall solib is installed (from add_vsyscall_page) I guess some of those could get removed by some more restructuring of the code, but I'm not sure this is worth the effort. The three subsequent calls all come from solib_add, presumably as more shared libraries are loaded via dlopen? If so, there's again probably not a lot we can do about that. > 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): Remove objfile parameter, > iterate over all objfiles. > * objfiles.c (objfile_relocate): Update. > * symfile.c (new_symfile_objfile): Likewise. This is OK. Thanks, Ulrich -- Dr. Ulrich Weigand GNU Toolchain for Linux on System z and Cell BE Ulrich.Weigand@de.ibm.com ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [rfc][patch] Eliminate quadratic slow-down on number of solibs. 2009-06-22 18:56 ` Paul Pluzhnikov 2009-06-22 19:30 ` Ulrich Weigand @ 2009-06-22 20:41 ` Doug Evans 2009-06-22 20:48 ` Michael Snyder 1 sibling, 1 reply; 17+ messages in thread From: Doug Evans @ 2009-06-22 20:41 UTC (permalink / raw) To: Paul Pluzhnikov Cc: Ulrich Weigand, Joel Brobecker, tromey, gdb-patches, Michael Snyder On Mon, Jun 22, 2009 at 11:56 AM, Paul Pluzhnikov<ppluzhnikov@google.com> wrote: > Unfortunately I don't have any targets that support overlays, so I can't > test this. For reference sake, m32r-elf target has overlays, and there's a simulator in the gdb tree for it. If one wanted to play with overlay support, that should work, right Michael? [m32r was the original target for overlays] ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [rfc][patch] Eliminate quadratic slow-down on number of solibs. 2009-06-22 20:41 ` Doug Evans @ 2009-06-22 20:48 ` Michael Snyder 0 siblings, 0 replies; 17+ messages in thread From: Michael Snyder @ 2009-06-22 20:48 UTC (permalink / raw) To: Doug Evans Cc: Paul Pluzhnikov, Ulrich Weigand, Joel Brobecker, tromey, gdb-patches Doug Evans wrote: > On Mon, Jun 22, 2009 at 11:56 AM, Paul Pluzhnikov<ppluzhnikov@google.com> wrote: >> Unfortunately I don't have any targets that support overlays, so I can't >> test this. > > For reference sake, m32r-elf target has overlays, and there's a simulator > in the gdb tree for it. > If one wanted to play with overlay support, that should work, right Michael? > > [m32r was the original target for overlays] Yes, hopefully. I don't know how well maintained is that particular feature... ^ permalink raw reply [flat|nested] 17+ messages in thread
end of thread, other threads:[~2009-06-23 13:32 UTC | newest] Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2009-04-20 23:29 [rfc][patch] Eliminate quadratic slow-down on number of solibs Paul Pluzhnikov 2009-04-21 1:06 ` Tom Tromey 2009-04-29 21:12 ` Paul Pluzhnikov 2009-05-12 8:48 ` Joel Brobecker 2009-05-12 21:21 ` Paul Pluzhnikov 2009-05-13 9:39 ` Joel Brobecker 2009-06-22 17:10 ` Ulrich Weigand 2009-06-22 18:56 ` Paul Pluzhnikov 2009-06-22 19:30 ` Ulrich Weigand 2009-06-22 19:42 ` Paul Pluzhnikov 2009-06-22 20:06 ` Ulrich Weigand 2009-06-22 22:04 ` Paul Pluzhnikov 2009-06-23 0:43 ` Ulrich Weigand 2009-06-23 1:33 ` Paul Pluzhnikov 2009-06-23 13:32 ` Ulrich Weigand 2009-06-22 20:41 ` Doug Evans 2009-06-22 20:48 ` Michael Snyder
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox