/* Handle shared libraries for GDB, the GNU Debugger.
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
- 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
+ 1999, 2000, 2001, 2002, 2003, 2005
+ Free Software Foundation, Inc.
This file is part of GDB.
if (!abfd)
{
close (scratch_chan);
- error ("Could not open `%s' as an executable file: %s",
+ error (_("Could not open `%s' as an executable file: %s"),
scratch_pathname, bfd_errmsg (bfd_get_error ()));
}
/* copy full path name into so_name, so that later symbol_file_add
can find it */
if (strlen (scratch_pathname) >= SO_NAME_MAX_PATH_SIZE)
- error ("Full path name length of shared library exceeds SO_NAME_MAX_PATH_SIZE in so_list structure.");
+ error (_("Full path name length of shared library exceeds SO_NAME_MAX_PATH_SIZE in so_list structure."));
strcpy (so->so_name, scratch_pathname);
if (!bfd_check_format (abfd, bfd_object))
{
- error ("\"%s\": not in executable format: %s.",
+ error (_("\"%s\": not in executable format: %s."),
scratch_pathname, bfd_errmsg (bfd_get_error ()));
}
if (build_section_table (abfd, &so->sections, &so->sections_end))
{
- error ("Can't find the file sections in `%s': %s",
+ error (_("Can't find the file sections in `%s': %s"),
bfd_get_filename (abfd), bfd_errmsg (bfd_get_error ()));
}
{
bfd_filename = bfd_get_filename (so->abfd);
if (! bfd_close (so->abfd))
- warning ("cannot close \"%s\": %s",
+ warning (_("cannot close \"%s\": %s"),
bfd_filename, bfd_errmsg (bfd_get_error ()));
}
return (1);
}
+/* 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
+ loaded. */
+
+int
+solib_read_symbols (struct so_list *so, int from_tty)
+{
+ if (so->symbols_loaded)
+ {
+ if (from_tty)
+ printf_unfiltered ("Symbols already loaded for %s\n", so->so_name);
+ }
+ else
+ {
+ if (catch_errors (symbol_add_stub, so,
+ "Error while reading shared library symbols:\n",
+ RETURN_MASK_ALL))
+ {
+ if (from_tty)
+ printf_unfiltered ("Loaded symbols for %s\n", so->so_name);
+ so->symbols_loaded = 1;
+ return 1;
+ }
+ }
+
+ return 0;
+}
/* LOCAL FUNCTION
/* If it's not on the inferior's list, remove it from GDB's tables. */
else
{
- /* Notify any observer that the SO has been unloaded
- before we remove it from the gdb tables. */
+ /* Notify any observer that the shared object has been
+ unloaded before we remove it from GDB's tables. */
observer_notify_solib_unloaded (gdb);
*gdb_link = gdb->next;
count * sizeof (i->sections[0]));
}
}
+
+ /* Notify any observer that the shared object has been
+ loaded now that we've added it to GDB's tables. */
+ observer_notify_solib_loaded (i);
}
}
}
char *re_err = re_comp (pattern);
if (re_err)
- error ("Invalid regexp: %s", re_err);
+ error (_("Invalid regexp: %s"), re_err);
}
update_solib_list (from_tty, target);
if (! pattern || re_exec (gdb->so_name))
{
any_matches = 1;
-
- if (gdb->symbols_loaded)
- {
- if (from_tty)
- printf_unfiltered ("Symbols already loaded for %s\n",
- gdb->so_name);
- }
- else if (readsyms)
- {
- if (catch_errors
- (symbol_add_stub, gdb,
- "Error while reading shared library symbols:\n",
- RETURN_MASK_ALL))
- {
- if (from_tty)
- printf_unfiltered ("Loaded symbols for %s\n",
- gdb->so_name);
- gdb->symbols_loaded = 1;
- loaded_any_symbols = 1;
- }
- }
+ if (readsyms && solib_read_symbols (gdb, from_tty))
+ loaded_any_symbols = 1;
}
if (from_tty && pattern && ! any_matches)
else
{
internal_error (__FILE__, __LINE__,
- "TARGET_PTR_BIT returned unknown size %d",
+ _("TARGET_PTR_BIT returned unknown size %d"),
TARGET_PTR_BIT);
}
SYNOPSIS
- void solib_create_inferior_hook()
+ void solib_create_inferior_hook ()
DESCRIPTION