aboutsummaryrefslogtreecommitdiff
path: root/gdb/solib.c
diff options
context:
space:
mode:
authorPaul Pluzhnikov <ppluzhnikov@google.com>2009-06-16 18:49:25 +0000
committerPaul Pluzhnikov <ppluzhnikov@google.com>2009-06-16 18:49:25 +0000
commit7eedccfa2afb7a44b513282cb138d85cde1f7f41 (patch)
treeca021f970e20247ff72764df9982ce692250b94d /gdb/solib.c
parent19ef5c713c0116f2e15fea28168614d7894b613a (diff)
downloadfsf-binutils-gdb-7eedccfa2afb7a44b513282cb138d85cde1f7f41.zip
fsf-binutils-gdb-7eedccfa2afb7a44b513282cb138d85cde1f7f41.tar.gz
fsf-binutils-gdb-7eedccfa2afb7a44b513282cb138d85cde1f7f41.tar.bz2
2009-06-16 Paul Pluzhnikov <ppluzhnikov@google.com>
* solib.c (symbol_add_stub): New FLAGS parameter. (solib_read_symbols): FROM_TTY -> FLAGS, call symbol_add_stub directly. (solib_add): Defer breakpoint_re_set until after all solibs. * bsd-uthread.c (bsd_uthread_solib_loaded): Adjust. * rs6000-nat.c (objfile_symbol_add): Adjust. * symfile.c (syms_from_objfile): Merge parameters into ADD_FLAGS. (new_symfile_objfile): Likewise. (symbol_file_add_with_addrs_or_offsets): Likewise. (symbol_file_add_from_bfd): Likewise. (symbol_file_add): Likewise. * symfile.h (enum symfile_add_flags): New. Adjust prototypes. * symfile-mem.c (symbol_file_add_from_memory): Adjust. * windows-nat.c (safe_symbol_file_add_stub): Adjust. * machoread.c (macho_oso_symfile, macho_symfile_read): Adjust.
Diffstat (limited to 'gdb/solib.c')
-rw-r--r--gdb/solib.c55
1 files changed, 32 insertions, 23 deletions
diff --git a/gdb/solib.c b/gdb/solib.c
index a434ece..d194ac7 100644
--- a/gdb/solib.c
+++ b/gdb/solib.c
@@ -448,39 +448,37 @@ 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 flags)
{
- struct so_list *so = (struct so_list *) arg; /* catch_errs bogon */
struct section_addr_info *sap;
/* 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);
- so->objfile = symbol_file_add_from_bfd (so->abfd, so->from_tty,
- sap, 0, OBJF_SHARED | OBJF_KEEPBFD);
+ so->objfile = symbol_file_add_from_bfd (so->abfd, flags,
+ sap, OBJF_SHARED | OBJF_KEEPBFD);
free_section_addr_info (sap);
- return (1);
+ return;
}
-/* Read in symbols for shared object SO. If FROM_TTY is non-zero, be
- chatty about it. Return non-zero if any symbols were actually
+/* Read in symbols for shared object SO. If SYMFILE_VERBOSE is set in FLAGS,
+ be chatty about it. Return non-zero if any symbols were actually
loaded. */
int
-solib_read_symbols (struct so_list *so, int from_tty)
+solib_read_symbols (struct so_list *so, int flags)
{
+ const int from_tty = flags & SYMFILE_VERBOSE;
+
if (so->symbols_loaded)
{
if (from_tty)
@@ -493,15 +491,21 @@ solib_read_symbols (struct so_list *so, int from_tty)
}
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, flags);
+ }
+ 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;
@@ -736,6 +740,8 @@ solib_add (char *pattern, int from_tty, struct target_ops *target, int readsyms)
{
int any_matches = 0;
int loaded_any_symbols = 0;
+ const int flags =
+ SYMFILE_DEFER_BP_RESET | (from_tty ? SYMFILE_VERBOSE : 0);
for (gdb = so_list_head; gdb; gdb = gdb->next)
if (! pattern || re_exec (gdb->so_name))
@@ -749,10 +755,13 @@ solib_add (char *pattern, int from_tty, struct target_ops *target, int readsyms)
(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, flags))
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);