From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 518 invoked by alias); 29 Nov 2001 13:52:45 -0000 Mailing-List: contact gdb-patches-help@sourceware.cygnus.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 371 invoked from network); 29 Nov 2001 13:52:32 -0000 Received: from unknown (HELO krynn.axis.se) (193.13.178.10) by hostedprojects.ges.redhat.com with SMTP; 29 Nov 2001 13:52:32 -0000 Received: from ironmaiden.axis.se (ironmaiden.axis.se [10.13.8.120]) by krynn.axis.se (8.12.1/8.12.1/Debian -2) with ESMTP id fATDqUCJ019125 for ; Thu, 29 Nov 2001 14:52:30 +0100 Received: from axis.com (localhost [127.0.0.1]) by ironmaiden.axis.se (8.9.3/8.9.3/Debian 8.9.3-21) with ESMTP id OAA17030 for ; Thu, 29 Nov 2001 14:52:30 +0100 X-Authentication-Warning: ironmaiden.axis.se: Host localhost [127.0.0.1] claimed to be axis.com Message-ID: <3C063D9E.E38BF430@axis.com> Date: Mon, 19 Nov 2001 11:44:00 -0000 From: Orjan Friberg Organization: Axis Communications AB X-Mailer: Mozilla 4.76 [en] (X11; U; Linux 2.2.19 i686) X-Accept-Language: en MIME-Version: 1.0 To: gdb-patches@sources.redhat.com Subject: Re: [RFC]: Solib search (Was: Re: Cross solib support; continued) References: <3BEAA3A0.586B3046@axis.com> <20011108110955.A12240@nevyn.them.org> <3C03AB51.DB27B3D4@axis.com> <3405-Tue27Nov2001175932+0200-eliz@is.elta.co.il> <3C04B5A9.1F054A9F@axis.com> <7458-Wed28Nov2001183554+0200-eliz@is.elta.co.il> <3C052245.8C02668E@axis.com> <2950-Wed28Nov2001200425+0200-eliz@is.elta.co.il> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-SW-Source: 2001-11/txt/msg00340.txt.bz2 Message-ID: <20011119114400.0NTX5njvgrxtKIpK9jpUL-vm34GTJJ9n3QTBDtlxGW0@z> Here's an updated patch. Thanks to Eli, Daniel J, and Kevin for helping out. Ok to commit? 2001-11-29 Orjan Friberg * 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