Index: solib.c =================================================================== RCS file: /cvs/src/src/gdb/solib.c,v retrieving revision 1.94 diff -p -r1.94 solib.c *** solib.c 3 Jul 2007 12:14:43 -0000 1.94 --- solib.c 8 Aug 2007 18:29:15 -0000 *************** solib_open (char *in_pathname, char **fo *** 176,194 **** /* Now see if we can open it. */ found_file = open (temp_pathname, O_RDONLY | O_BINARY, 0); ! /* If the search in gdb_sysroot 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, search the solib_search_path (if any). */ --- 176,205 ---- /* Now see if we can open it. */ found_file = open (temp_pathname, O_RDONLY | O_BINARY, 0); ! if (found_file < 0) ! { ! /* If the search in gdb_sysroot 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 (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++; ! } ! /* Previous temp_pathname buffer is no longer in use. */ ! temp_pathname = NULL; ! } ! else if (temp_pathname) ! { ! /* Make a copy that can be returned. */ ! temp_pathname = xstrdup (temp_pathname); } /* If not found, search the solib_search_path (if any). */ *************** solib_open (char *in_pathname, char **fo *** 224,229 **** --- 235,247 ---- /* Done. If not found, tough luck. Return found_file and (optionally) found_pathname. */ + if (temp_pathname) + { + if (found_pathname) + *found_pathname = temp_pathname; + else + xfree (temp_pathname); + } if (found_pathname != NULL && temp_pathname != NULL) *found_pathname = xstrdup (temp_pathname); return found_file;