* gas/mips/macro-warn-[1234].[sdl]: New tests.
[deliverable/binutils-gdb.git] / gdb / solib.c
index 289b84f34bfc4478a723383cd12597c491538132..baabf20651c5ab0e5b6f14373236b1395e5de756 100644 (file)
@@ -40,7 +40,7 @@
 #include "gdbcmd.h"
 #include "completer.h"
 #include "filenames.h"         /* for DOSish file names */
-
+#include "exec.h"
 #include "solist.h"
 #include <readline/readline.h>
 
@@ -87,12 +87,19 @@ static char *solib_search_path = NULL;
    (or set of directories, as in LD_LIBRARY_PATH) to search for all
    shared libraries if not found in SOLIB_ABSOLUTE_PREFIX.
 
-   Search order:
-   * If path is absolute, look in SOLIB_ABSOLUTE_PREFIX.
-   * If path is absolute or relative, look for it literally (unmodified).
+   Search algorithm:
+   * If there is a solib_absolute_prefix and path is absolute:
+   *   Search for solib_absolute_prefix/path.
+   * else
+   *   Look for it literally (unmodified).
    * Look in SOLIB_SEARCH_PATH.
-   * Look in inferior's $PATH.
-   * Look in inferior's $LD_LIBRARY_PATH.
+   * If available, use target defined search function.
+   * If solib_absolute_prefix is NOT set, perform the following two searches:
+   *   Look in inferior's $PATH.
+   *   Look in inferior's $LD_LIBRARY_PATH.
+   *   
+   * The last check avoids doing this search when targetting remote
+   * machines since solib_absolute_prefix will almost always be set.
 
    RETURNS
 
@@ -147,7 +154,7 @@ solib_open (char *in_pathname, char **found_pathname)
         in_pathname++;
     }
   
-  /* If not found, next search the solib_search_path (if any).  */
+  /* If not found, search the solib_search_path (if any).  */
   if (found_file < 0 && solib_search_path != NULL)
     found_file = openp (solib_search_path,
                        1, in_pathname, O_RDONLY, 0, &temp_pathname);
@@ -166,13 +173,13 @@ solib_open (char *in_pathname, char **found_pathname)
                  (in_pathname, O_RDONLY, &temp_pathname);
 
   /* If not found, next search the inferior's $PATH environment variable. */
-  if (found_file < 0 && solib_search_path != NULL)
+  if (found_file < 0 && solib_absolute_prefix == NULL)
     found_file = openp (get_in_environ (inferior_environ, "PATH"),
                        1, in_pathname, O_RDONLY, 0, &temp_pathname);
 
   /* If not found, next search the inferior's $LD_LIBRARY_PATH 
      environment variable. */
-  if (found_file < 0 && solib_search_path != NULL)
+  if (found_file < 0 && solib_absolute_prefix == NULL)
     found_file = openp (get_in_environ (inferior_environ, "LD_LIBRARY_PATH"),
                        1, in_pathname, O_RDONLY, 0, &temp_pathname);
 
@@ -268,7 +275,7 @@ solib_map_sections (void *arg)
          object's file by the base address to which the object was actually
          mapped. */
       TARGET_SO_RELOCATE_SECTION_ADDRESSES (so, p);
-      if (STREQ (p->the_bfd_section->name, ".text"))
+      if (strcmp (p->the_bfd_section->name, ".text") == 0)
        {
          so->textsection = p;
        }
@@ -331,7 +338,7 @@ free_so (struct so_list *so)
 static int
 symbol_add_stub (void *arg)
 {
-  register struct so_list *so = (struct so_list *) arg;  /* catch_errs bogon */
+  struct so_list *so = (struct so_list *) arg;  /* catch_errs bogon */
   struct section_addr_info *sap;
 
   /* Have we already loaded this shared object?  */
@@ -381,7 +388,7 @@ symbol_add_stub (void *arg)
    the section table.  But we only use this for core files and
    processes we've just attached to, so that's okay.  */
 
-void
+static void
 update_solib_list (int from_tty, struct target_ops *target)
 {
   struct so_list *inferior = TARGET_SO_CURRENT_SOS ();
@@ -620,7 +627,7 @@ solib_add (char *pattern, int from_tty, struct target_ops *target, int readsyms)
 static void
 info_sharedlibrary_command (char *ignore, int from_tty)
 {
-  register struct so_list *so = NULL;  /* link map state variable */
+  struct so_list *so = NULL;   /* link map state variable */
   int header_done = 0;
   int addr_width;
   char *addr_fmt;
@@ -702,7 +709,7 @@ info_sharedlibrary_command (char *ignore, int from_tty)
 char *
 solib_address (CORE_ADDR address)
 {
-  register struct so_list *so = 0;     /* link map state variable */
+  struct so_list *so = 0;      /* link map state variable */
 
   for (so = so_list_head; so; so = so->next)
     {
@@ -856,6 +863,8 @@ reload_shared_libraries (char *ignored, int from_tty)
   solib_add (NULL, from_tty, NULL, auto_solib_add);
 }
 
+extern initialize_file_ftype _initialize_solib; /* -Wmissing-prototypes */
+
 void
 _initialize_solib (void)
 {
This page took 0.04206 seconds and 4 git commands to generate.