2006-11-29 Andrew Stubbs <andrew.stubbs@st.com>
authorAndrew Stubbs <andrew.stubbs@st.com>
Wed, 29 Nov 2006 12:27:01 +0000 (12:27 +0000)
committerAndrew Stubbs <andrew.stubbs@st.com>
Wed, 29 Nov 2006 12:27:01 +0000 (12:27 +0000)
* solib.c (solib_open): Treat bare file names as relative paths.

gdb/ChangeLog
gdb/solib.c

index dc4257f947cbb30173b7e6aa1d74eb3f22a4fdc9..9c7b5d12e6677a19dce9cd977acd18d2db6280e9 100644 (file)
@@ -1,3 +1,7 @@
+2006-11-29  Andrew Stubbs  <andrew.stubbs@st.com>
+
+       * solib.c (solib_open): Treat bare file names as relative paths.
+
 2006-11-29  Vladimir Prus  <vladimir@codesourcery.com>
 
        * varobj.c (varobj_set_value): Don't compare the old
index 4fa9fce65f6ce51712e9858edab16dbcf46c63a1..215d82bcbc9b3d82e600e2cf49922aa835336f76 100644 (file)
@@ -1,7 +1,7 @@
 /* Handle shared libraries for GDB, the GNU Debugger.
 
    Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
-   1999, 2000, 2001, 2002, 2003, 2005
+   1999, 2000, 2001, 2002, 2003, 2005, 2006
    Free Software Foundation, Inc.
 
    This file is part of GDB.
@@ -151,33 +151,27 @@ solib_open (char *in_pathname, char **found_pathname)
   solib_absolute_prefix_is_empty = (solib_absolute_prefix == NULL
                                     || *solib_absolute_prefix == 0);
 
-  while (*p && !IS_DIR_SEPARATOR (*p))
-    p++;
-
-  if (*p)
+  if (! IS_ABSOLUTE_PATH (in_pathname) || solib_absolute_prefix_is_empty)
+    temp_pathname = in_pathname;
+  else
     {
-      if (! IS_ABSOLUTE_PATH (in_pathname) || solib_absolute_prefix_is_empty)
-        temp_pathname = in_pathname;
-      else
-       {
-         int prefix_len = strlen (solib_absolute_prefix);
-
-         /* Remove trailing slashes from absolute prefix.  */
-         while (prefix_len > 0
-                && IS_DIR_SEPARATOR (solib_absolute_prefix[prefix_len - 1]))
-           prefix_len--;
-
-         /* Cat the prefixed pathname together.  */
-         temp_pathname = alloca (prefix_len + strlen (in_pathname) + 1);
-         strncpy (temp_pathname, solib_absolute_prefix, prefix_len);
-         temp_pathname[prefix_len] = '\0';
-         strcat (temp_pathname, in_pathname);
-       }
-
-      /* Now see if we can open it.  */
-      found_file = open (temp_pathname, O_RDONLY | O_BINARY, 0);
+      int prefix_len = strlen (solib_absolute_prefix);
+
+      /* Remove trailing slashes from absolute prefix.  */
+      while (prefix_len > 0
+            && IS_DIR_SEPARATOR (solib_absolute_prefix[prefix_len - 1]))
+       prefix_len--;
+
+      /* Cat the prefixed pathname together.  */
+      temp_pathname = alloca (prefix_len + strlen (in_pathname) + 1);
+      strncpy (temp_pathname, solib_absolute_prefix, prefix_len);
+      temp_pathname[prefix_len] = '\0';
+      strcat (temp_pathname, in_pathname);
     }
 
+  /* Now see if we can open it.  */
+  found_file = open (temp_pathname, O_RDONLY | O_BINARY, 0);
+
   /* If the search in solib_absolute_prefix failed, and the path name is
      absolute at this point, make it relative.  (openp will try and open the
      file according to its absolute path otherwise, which is not what we want.)
This page took 0.028862 seconds and 4 git commands to generate.