From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24532 invoked by alias); 21 Jul 2006 18:38:42 -0000 Received: (qmail 24523 invoked by uid 22791); 21 Jul 2006 18:38:41 -0000 X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (66.187.233.31) by sourceware.org (qpsmtpd/0.31) with ESMTP; Fri, 21 Jul 2006 18:38:35 +0000 Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.12.11.20060308/8.12.11) with ESMTP id k6LIcX3H016225 for ; Fri, 21 Jul 2006 14:38:33 -0400 Received: from pobox.stuttgart.redhat.com (pobox.stuttgart.redhat.com [172.16.2.10]) by int-mx1.corp.redhat.com (8.12.11.20060308/8.12.11) with ESMTP id k6LIcWoj026945; Fri, 21 Jul 2006 14:38:32 -0400 Received: from lace.redhat.com (vpn50-19.rdu.redhat.com [172.16.50.19]) by pobox.stuttgart.redhat.com (8.12.8/8.12.8) with ESMTP id k6LIcUXl020199; Fri, 21 Jul 2006 20:38:31 +0200 Received: from lace.redhat.com (localhost.localdomain [127.0.0.1]) by lace.redhat.com (8.13.6/8.13.6) with ESMTP id k6LIcTmg010287; Fri, 21 Jul 2006 20:38:29 +0200 Received: (from lace@localhost) by lace.redhat.com (8.13.6/8.13.6/Submit) id k6LIcTSI010286; Fri, 21 Jul 2006 20:38:29 +0200 Date: Fri, 21 Jul 2006 18:38:00 -0000 From: Jan Kratochvil To: Kevin Buettner Cc: gdb-patches@sources.redhat.com Subject: Re: [patch] Fixed occasional failure to load a custom shared library Message-ID: <20060721183829.GB9150@lace.redhat.com> References: <20060622114016.GA21094@host0.dyn.jankratochvil.net> <20060626180051.0adcce23@ironwood.lan> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="Bn2rw/3z4jIqBvZU" Content-Disposition: inline In-Reply-To: <20060626180051.0adcce23@ironwood.lan> User-Agent: Mutt/1.4.2.1i Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2006-07/txt/msg00300.txt.bz2 --Bn2rw/3z4jIqBvZU Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-length: 1463 Hi Kevin, I am now copyright assignment compliant (as Red Hat employee). Could you please commit the updated patch? Its ChangeLog entry: 2006-07-21 Jan Kratochvil * solib.c (solib_open): Fixed NULL vs. "" refusal to load inferior shared libraries. Thanks, Jan On Tue, 27 Jun 2006 03:00:51 +0200, Kevin Buettner wrote: > On Thu, 22 Jun 2006 13:40:16 +0200 > Jan Kratochvil wrote: > > Index: solib.c > =================================================================== > RCS file: /cvs/src/src/gdb/solib.c,v > retrieving revision 1.84 > diff -u -p -r1.84 solib.c > --- solib.c 25 Feb 2006 04:36:39 -0000 1.84 > +++ solib.c 22 Jun 2006 11:24:40 -0000 > @@ -146,13 +146,17 @@ solib_open (char *in_pathname, char **fo > int found_file = -1; > char *temp_pathname = NULL; > char *p = in_pathname; > + int solib_absolute_prefix_is_empty; > + > + solib_absolute_prefix_is_empty = (!solib_absolute_prefix > + || !*solib_absolute_prefix); > > I'd prefer to see this written as follows: > > + solib_absolute_prefix_is_empty = (solib_absolute_prefix == NULL > + || *solib_absolute_prefix == 0); > > The rest of your patch looks reasonable. (You forgot to include a > ChangeLog entry though...) > > Are you able to commit this yourself or do you need someone to commit > it for you? > > Thanks for the patch! > > Kevin --Bn2rw/3z4jIqBvZU Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="gdb-cvs20060721-solib_absolute_prefix_is_empty-v2.patch" Content-length: 1938 https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=146810 Bug is still present in 2006-07-21 GDB CVS. The segfault is just a consequence of earlier failure to properly load the custom shared library: Error while mapping shared library sections: libc++test4dl.so: Success. Index: solib.c =================================================================== RCS file: /cvs/src/src/gdb/solib.c,v retrieving revision 1.84 diff -u -p -r1.84 solib.c --- solib.c 25 Feb 2006 04:36:39 -0000 1.84 +++ solib.c 21 Jul 2006 18:27:49 -0000 @@ -146,13 +146,17 @@ solib_open (char *in_pathname, char **fo int found_file = -1; char *temp_pathname = NULL; char *p = in_pathname; + int solib_absolute_prefix_is_empty; + + solib_absolute_prefix_is_empty = (solib_absolute_prefix == NULL + || *solib_absolute_prefix == 0); while (*p && !IS_DIR_SEPARATOR (*p)) p++; if (*p) { - if (! IS_ABSOLUTE_PATH (in_pathname) || solib_absolute_prefix == NULL) + if (! IS_ABSOLUTE_PATH (in_pathname) || solib_absolute_prefix_is_empty) temp_pathname = in_pathname; else { @@ -208,14 +212,14 @@ solib_open (char *in_pathname, char **fo &temp_pathname); /* If not found, next search the inferior's $PATH environment variable. */ - if (found_file < 0 && solib_absolute_prefix == NULL) + if (found_file < 0 && solib_absolute_prefix_is_empty) found_file = openp (get_in_environ (inferior_environ, "PATH"), OPF_TRY_CWD_FIRST, in_pathname, O_RDONLY | O_BINARY, 0, &temp_pathname); /* If not found, next search the inferior's $LD_LIBRARY_PATH environment variable. */ - if (found_file < 0 && solib_absolute_prefix == NULL) + if (found_file < 0 && solib_absolute_prefix_is_empty) found_file = openp (get_in_environ (inferior_environ, "LD_LIBRARY_PATH"), OPF_TRY_CWD_FIRST, in_pathname, O_RDONLY | O_BINARY, 0, &temp_pathname); --Bn2rw/3z4jIqBvZU--