diff options
author | Andrew Stubbs <andrew.stubbs@st.com> | 2006-11-29 12:27:01 +0000 |
---|---|---|
committer | Andrew Stubbs <andrew.stubbs@st.com> | 2006-11-29 12:27:01 +0000 |
commit | f1d10cfb3275dbbe933f988a83ca81c54de41f87 (patch) | |
tree | d082ea9a66afa5bf9611fbe7718224d84aed811a | |
parent | d394c9935db1a5d26ed959fa332e0bf79e4a5c2b (diff) | |
download | gdb-f1d10cfb3275dbbe933f988a83ca81c54de41f87.zip gdb-f1d10cfb3275dbbe933f988a83ca81c54de41f87.tar.gz gdb-f1d10cfb3275dbbe933f988a83ca81c54de41f87.tar.bz2 |
2006-11-29 Andrew Stubbs <andrew.stubbs@st.com>
* solib.c (solib_open): Treat bare file names as relative paths.
-rw-r--r-- | gdb/ChangeLog | 4 | ||||
-rw-r--r-- | gdb/solib.c | 44 |
2 files changed, 23 insertions, 25 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index dc4257f..9c7b5d1 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -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 diff --git a/gdb/solib.c b/gdb/solib.c index 4fa9fce..215d82b 100644 --- a/gdb/solib.c +++ b/gdb/solib.c @@ -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.) |