Index: solib.h =================================================================== RCS file: /cvs/src/src/gdb/solib.h,v retrieving revision 1.24 diff -u -p -u -r1.24 solib.h --- solib.h 15 May 2009 16:53:44 -0000 1.24 +++ solib.h 9 Jun 2009 00:49:30 -0000 @@ -34,7 +34,7 @@ extern void clear_solib (void); /* Called to add symbols from a shared library to gdb's symbol table. */ extern void solib_add (char *, int, struct target_ops *, int); -extern int solib_read_symbols (struct so_list *, int); +extern int solib_read_symbols (struct so_list *, int, int); /* Function to be called when the inferior starts up, to discover the names of shared libraries that are dynamically linked, the base Index: solib.c =================================================================== RCS file: /cvs/src/src/gdb/solib.c,v retrieving revision 1.119 diff -u -p -u -r1.119 solib.c --- solib.c 3 Jun 2009 18:50:36 -0000 1.119 +++ solib.c 9 Jun 2009 00:49:31 -0000 @@ -448,30 +448,29 @@ master_so_list (void) return so_list_head; } - -/* A small stub to get us past the arg-passing pinhole of catch_errors. */ - -static int -symbol_add_stub (void *arg) +static void +symbol_add_stub (struct so_list *so, int defer_bp_reset) { - struct so_list *so = (struct so_list *) arg; /* catch_errs bogon */ struct section_addr_info *sap; + int flags = OBJF_SHARED | OBJF_KEEPBFD; /* Have we already loaded this shared object? */ ALL_OBJFILES (so->objfile) { if (strcmp (so->objfile->name, so->so_name) == 0) - return 1; + return; } sap = build_section_addr_info_from_section_table (so->sections, so->sections_end); + if (defer_bp_reset) + flags |= OBJF_DEFER_BP_RESET; so->objfile = symbol_file_add_from_bfd (so->abfd, so->from_tty, - sap, 0, OBJF_SHARED | OBJF_KEEPBFD); + sap, 0, flags); free_section_addr_info (sap); - return (1); + return; } /* Read in symbols for shared object SO. If FROM_TTY is non-zero, be @@ -479,7 +478,7 @@ symbol_add_stub (void *arg) loaded. */ int -solib_read_symbols (struct so_list *so, int from_tty) +solib_read_symbols (struct so_list *so, int from_tty, int defer_bp_reset) { if (so->symbols_loaded) { @@ -493,15 +492,21 @@ solib_read_symbols (struct so_list *so, } else { - if (catch_errors (symbol_add_stub, so, - "Error while reading shared library symbols:\n", - RETURN_MASK_ALL)) - { - if (from_tty && print_symbol_loading) - printf_unfiltered (_("Loaded symbols for %s\n"), so->so_name); - so->symbols_loaded = 1; - return 1; - } + volatile struct gdb_exception exception; + TRY_CATCH (exception, RETURN_MASK_ALL) + { + symbol_add_stub (so, defer_bp_reset); + } + if (exception.reason != 0) + { + exception_fprintf (gdb_stderr, exception, + "Error while reading shared library symbols:\n"); + return 0; + } + if (from_tty && print_symbol_loading) + printf_unfiltered (_("Loaded symbols for %s\n"), so->so_name); + so->symbols_loaded = 1; + return 1; } return 0; @@ -749,10 +754,13 @@ solib_add (char *pattern, int from_tty, (readsyms || libpthread_solib_p (gdb)); any_matches = 1; - if (add_this_solib && solib_read_symbols (gdb, from_tty)) + if (add_this_solib && solib_read_symbols (gdb, from_tty, 1)) loaded_any_symbols = 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); Index: symfile.h =================================================================== RCS file: /cvs/src/src/gdb/symfile.h,v retrieving revision 1.50 diff -u -p -u -r1.50 symfile.h --- symfile.h 22 May 2009 23:49:14 -0000 1.50 +++ symfile.h 9 Jun 2009 00:49:31 -0000 @@ -214,7 +214,7 @@ extern void syms_from_objfile (struct ob struct section_addr_info *, struct section_offsets *, int, int, int); -extern void new_symfile_objfile (struct objfile *, int, int); +extern void new_symfile_objfile (struct objfile *, int, int, int); extern struct objfile *symbol_file_add (char *, int, struct section_addr_info *, int, int); Index: symfile.c =================================================================== RCS file: /cvs/src/src/gdb/symfile.c,v retrieving revision 1.230 diff -u -p -u -r1.230 symfile.c --- symfile.c 4 Jun 2009 00:50:16 -0000 1.230 +++ symfile.c 9 Jun 2009 00:49:31 -0000 @@ -906,7 +906,8 @@ syms_from_objfile (struct objfile *objfi objfile. */ void -new_symfile_objfile (struct objfile *objfile, int mainline, int verbo) +new_symfile_objfile (struct objfile *objfile, int mainline, int verbo, + int flags) { /* If this is the main symbol file we have to clean up all users of the @@ -919,7 +920,7 @@ new_symfile_objfile (struct objfile *obj clear_symtab_users (); } - else + else if ((flags & OBJF_DEFER_BP_RESET) == 0) { breakpoint_re_set_objfile (objfile); } @@ -1081,7 +1082,7 @@ symbol_file_add_with_addrs_or_offsets (b if (objfile->sf == NULL) return objfile; /* No symbols. */ - new_symfile_objfile (objfile, mainline, from_tty); + new_symfile_objfile (objfile, mainline, from_tty, flags); observer_notify_new_objfile (objfile); Index: objfiles.h =================================================================== RCS file: /cvs/src/src/gdb/objfiles.h,v retrieving revision 1.59 diff -u -p -u -r1.59 objfiles.h --- objfiles.h 15 Jan 2009 16:35:22 -0000 1.59 +++ objfiles.h 9 Jun 2009 00:49:31 -0000 @@ -419,6 +419,9 @@ struct objfile #define OBJF_KEEPBFD (1 << 4) /* Do not delete bfd */ +/* User requested that this objfile not trigger breakpoint reset. */ + +#define OBJF_DEFER_BP_RESET (1 << 5) /* Defer breakpoint reset. */ /* The object file that the main symbol table was loaded from (e.g. the argument to the "symbol-file" or "file" command). */ Index: bsd-uthread.c =================================================================== RCS file: /cvs/src/src/gdb/bsd-uthread.c,v retrieving revision 1.24 diff -u -p -u -r1.24 bsd-uthread.c --- bsd-uthread.c 21 May 2009 15:48:41 -0000 1.24 +++ bsd-uthread.c 9 Jun 2009 00:49:31 -0000 @@ -248,7 +248,7 @@ bsd_uthread_solib_loaded (struct so_list { if (strncmp (so->so_original_name, *names, strlen (*names)) == 0) { - solib_read_symbols (so, so->from_tty); + solib_read_symbols (so, so->from_tty, 0); if (bsd_uthread_activate (so->objfile)) { Index: rs6000-nat.c =================================================================== RCS file: /cvs/src/src/gdb/rs6000-nat.c,v retrieving revision 1.93 diff -u -p -u -r1.93 rs6000-nat.c --- rs6000-nat.c 3 Jun 2009 18:50:36 -0000 1.93 +++ rs6000-nat.c 9 Jun 2009 00:49:31 -0000 @@ -692,7 +692,7 @@ objfile_symbol_add (void *arg) struct objfile *obj = (struct objfile *) arg; syms_from_objfile (obj, NULL, 0, 0, 0, 0); - new_symfile_objfile (obj, 0, 0); + new_symfile_objfile (obj, 0, 0, 0); return 1; }