* solib.c (reload_shared_libraries): New function.
[deliverable/binutils-gdb.git] / gdb / solib.c
index 0c7eabab393046e8f495080ce72a2a4c082f989c..da7179828003c5e5a1a50556e834974c43b7f531 100644 (file)
@@ -1,7 +1,7 @@
 /* Handle shared libraries for GDB, the GNU Debugger.
-   Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-   2000, 2001
-   Free Software Foundation, Inc.
+
+   Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
+   1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -42,6 +42,7 @@
 #include "filenames.h"         /* for DOSish file names */
 
 #include "solist.h"
+#include <readline/readline.h>
 
 /* external data declarations */
 
@@ -56,7 +57,7 @@ static int solib_cleanup_queued = 0;  /* make_run_cleanup called */
 
 /* Local function prototypes */
 
-static void do_clear_solib (PTR);
+static void do_clear_solib (void *);
 
 /* If non-zero, this is a prefix that will be added to the front of the name
    shared libraries with an absolute filename for loading.  */
@@ -206,7 +207,7 @@ solib_open (char *in_pathname, char **found_pathname)
  */
 
 static int
-solib_map_sections (PTR arg)
+solib_map_sections (void *arg)
 {
   struct so_list *so = (struct so_list *) arg; /* catch_errors bogon */
   char *filename;
@@ -323,7 +324,7 @@ free_so (struct so_list *so)
 /* A small stub to get us past the arg-passing pinhole of catch_errors.  */
 
 static int
-symbol_add_stub (PTR arg)
+symbol_add_stub (void *arg)
 {
   register struct so_list *so = (struct so_list *) arg;  /* catch_errs bogon */
   struct section_addr_info *sap;
@@ -386,7 +387,7 @@ update_solib_list (int from_tty, struct target_ops *target)
      symbols now!  */
   if (attach_flag &&
       symfile_objfile == NULL)
-    catch_errors (TARGET_SO_OPEN_SYMBOL_FILE_OBJECT, (PTR) &from_tty, 
+    catch_errors (TARGET_SO_OPEN_SYMBOL_FILE_OBJECT, &from_tty, 
                  "Error reading attached process's symbol file.\n",
                  RETURN_MASK_ALL);
 
@@ -652,13 +653,13 @@ info_sharedlibrary_command (char *ignore, int from_tty)
 
          printf_unfiltered ("%-*s", addr_width,
                             so->textsection != NULL 
-                              ? longest_local_hex_string_custom (
+                              ? local_hex_string_custom (
                                   (LONGEST) so->textsection->addr,
                                   addr_fmt)
                               : "");
          printf_unfiltered ("%-*s", addr_width,
                             so->textsection != NULL 
-                              ? longest_local_hex_string_custom (
+                              ? local_hex_string_custom (
                                   (LONGEST) so->textsection->endaddr,
                                   addr_fmt)
                               : "");
@@ -754,7 +755,7 @@ clear_solib (void)
 }
 
 static void
-do_clear_solib (PTR dummy)
+do_clear_solib (void *dummy)
 {
   solib_cleanup_queued = 0;
   clear_solib ();
@@ -843,6 +844,13 @@ no_shared_libraries (char *ignored, int from_tty)
   do_clear_solib (NULL);
 }
 
+static void
+reload_shared_libraries (char *ignored, int from_tty)
+{
+  no_shared_libraries (NULL, from_tty);
+  solib_add (NULL, from_tty, NULL, auto_solib_add);
+}
+
 void
 _initialize_solib (void)
 {
@@ -872,13 +880,19 @@ inferior.  Otherwise, symbols must be loaded manually, using `sharedlibrary'.",
 For other (relative) files, you can add values using `set solib-search-path'.",
                   &setlist);
   add_show_from_set (c, &showlist);
+  set_cmd_cfunc (c, reload_shared_libraries);
   set_cmd_completer (c, filename_completer);
 
+  /* Set the default value of "solib-absolute-prefix" from the sysroot, if
+     one is set.  */
+  solib_absolute_prefix = xstrdup (gdb_sysroot);
+
   c = add_set_cmd ("solib-search-path", class_support, var_string,
                   (char *) &solib_search_path,
                   "Set the search path for loading non-absolute shared library symbol files.\n\
 This takes precedence over the environment variables PATH and LD_LIBRARY_PATH.",
                   &setlist);
   add_show_from_set (c, &showlist);
+  set_cmd_cfunc (c, reload_shared_libraries);
   set_cmd_completer (c, filename_completer);
 }
This page took 0.035171 seconds and 4 git commands to generate.