This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
Re: [RFC]: Solib search (Was: Re: Cross solib support; continued)
Here's an updated patch. Thanks to Eli, Daniel J, and Kevin for helping out.
Ok to commit?
2001-11-29 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.
Index: solib.c
===================================================================
RCS file: /cvs/src/src/gdb/solib.c,v
retrieving revision 1.45
diff -u -p -r1.45 solib.c
--- solib.c 2001/11/01 16:17:08 1.45
+++ solib.c 2001/11/29 13:36:48
@@ -131,10 +131,33 @@ solib_open (char *in_pathname, char **fo
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)
--
Orjan Friberg
Axis Communications AB