aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@gnu.org>2000-12-23 00:27:20 +0000
committerMark Kettenis <kettenis@gnu.org>2000-12-23 00:27:20 +0000
commitb21f0843bf0b6a911c96408de2edf6406a0e72ac (patch)
treedd03d6cfc135cc0361209e4fc366e3e211ed36f0
parent3cd4dda73eba461d60dd77b1b7ce71369a61a459 (diff)
downloadgdb-b21f0843bf0b6a911c96408de2edf6406a0e72ac.zip
gdb-b21f0843bf0b6a911c96408de2edf6406a0e72ac.tar.gz
gdb-b21f0843bf0b6a911c96408de2edf6406a0e72ac.tar.bz2
* solib.c (solib_open): If path is relative, look for it
literally. This matches the behaviour of the GNU dynamic linker more closely.
-rw-r--r--gdb/ChangeLog6
-rw-r--r--gdb/solib.c15
2 files changed, 14 insertions, 7 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 21f60fe..0576b00 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,9 @@
+2000-12-22 Mark Kettenis <kettenis@gnu.org>
+
+ * solib.c (solib_open): If path is relative, look for it
+ literally. This matches the behaviour of the GNU dynamic linker
+ more closely.
+
2000-12-22 Fernando Nasser <fnasser@redhat.com>
* README: Suggest building in an empty directory.
diff --git a/gdb/solib.c b/gdb/solib.c
index abe4f8b..5f9743f 100644
--- a/gdb/solib.c
+++ b/gdb/solib.c
@@ -85,13 +85,13 @@ static char *solib_search_path = NULL;
Search order:
* If path is absolute, look in SOLIB_ABSOLUTE_PREFIX.
- * If path is absolute, look for it literally (unmodified).
+ * If path is absolute or relative, look for it literally (unmodified).
* Look in SOLIB_SEARCH_PATH.
* Look in inferior's $PATH.
* Look in inferior's $LD_LIBRARY_PATH.
RETURNS
-
+
file handle for opened solib, or -1 for failure. */
int
@@ -100,16 +100,17 @@ solib_open (char *in_pathname, char **found_pathname)
int found_file = -1;
char *temp_pathname = NULL;
- if (ROOTED_P (in_pathname))
+ if (strchr (in_pathname, SLASH_CHAR))
{
- if (solib_absolute_prefix == NULL)
+ if (! ROOTED_P (in_pathname) || solib_absolute_prefix == NULL)
temp_pathname = in_pathname;
else
{
- int prefix_len = strlen (solib_absolute_prefix);
+ int prefix_len = strlen (solib_absolute_prefix);
/* Remove trailing slashes from absolute prefix. */
- while (prefix_len > 0 && SLASH_P (solib_absolute_prefix[prefix_len - 1]))
+ while (prefix_len > 0
+ && SLASH_P (solib_absolute_prefix[prefix_len - 1]))
prefix_len--;
/* Cat the prefixed pathname together. */
@@ -117,8 +118,8 @@ solib_open (char *in_pathname, char **found_pathname)
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, 0);
}