aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOrjan Friberg <orjanf@axis.com>2001-12-04 09:34:56 +0000
committerOrjan Friberg <orjanf@axis.com>2001-12-04 09:34:56 +0000
commitba5f0d88f312fa47d20c5d196e41477cb24e6180 (patch)
tree7ddbf00b48d65387f2a89a1af6fdf66be96c9577
parent7c7a201a79f24887e4e96be4dd7f17a9be1bbfb2 (diff)
downloadgdb-ba5f0d88f312fa47d20c5d196e41477cb24e6180.zip
gdb-ba5f0d88f312fa47d20c5d196e41477cb24e6180.tar.gz
gdb-ba5f0d88f312fa47d20c5d196e41477cb24e6180.tar.bz2
2001-12-04 Orjan Friberg <orjanf@axis.com>
* solib.c (solib_open): Make path relative if search for absolute path failed. If search for relative path in solib_search_path failed, fall back to search for basename only.
-rw-r--r--gdb/ChangeLog6
-rw-r--r--gdb/solib.c23
2 files changed, 29 insertions, 0 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 617f6d9..4289a2f 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,9 @@
+2001-12-04 Orjan Friberg <orjanf@axis.com>
+
+ * solib.c (solib_open): Make path relative if search for absolute path
+ failed. If search for relative path in solib_search_path failed, fall
+ back to search for basename only.
+
2001-12-03 Martin M. Hunt <hunt@redhat.com>
* serial.h: Add a note to serial_open.
diff --git a/gdb/solib.c b/gdb/solib.c
index 853fab8..ddf3171 100644
--- a/gdb/solib.c
+++ b/gdb/solib.c
@@ -131,10 +131,33 @@ solib_open (char *in_pathname, char **found_pathname)
found_file = open (temp_pathname, O_RDONLY, 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.)
+ Affects subsequent searches for this solib. */
+ if (found_file < 0 && IS_ABSOLUTE_PATH (in_pathname))
+ {
+ /* First, get rid of any drive letters etc. */
+ while (!IS_DIR_SEPARATOR (*in_pathname))
+ in_pathname++;
+
+ /* Next, get rid of all leading dir separators. */
+ while (IS_DIR_SEPARATOR (*in_pathname))
+ in_pathname++;
+ }
+
/* If not found, next 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);
+
+ /* If not found, next search the solib_search_path (if any) for the basename
+ only (ignoring the path). This is to allow reading solibs from a path
+ that differs from the opened path. */
+ if (found_file < 0 && solib_search_path != NULL)
+ found_file = openp (solib_search_path,
+ 1, lbasename (in_pathname), O_RDONLY, 0,
+ &temp_pathname);
/* If not found, next search the inferior's $PATH environment variable. */
if (found_file < 0 && solib_search_path != NULL)