From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 125759 invoked by alias); 27 Apr 2015 10:38:15 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 125740 invoked by uid 89); 27 Apr 2015 10:38:14 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.1 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Mon, 27 Apr 2015 10:38:13 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (Postfix) with ESMTPS id A38548E769 for ; Mon, 27 Apr 2015 10:38:11 +0000 (UTC) Received: from blade.nx (ovpn-116-91.ams2.redhat.com [10.36.116.91]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t3RAcAJT020638 for ; Mon, 27 Apr 2015 06:38:11 -0400 Received: by blade.nx (Postfix, from userid 1000) id EAC7D263C8D; Mon, 27 Apr 2015 11:38:09 +0100 (BST) Date: Mon, 27 Apr 2015 10:38:00 -0000 From: Gary Benson To: gdb-patches@sourceware.org Subject: [PING][PATCH] Use exec_file_find to prepend gdb_sysroot in follow_exec Message-ID: <20150427103809.GA13233@blade.nx> References: <1429277318-26646-1-git-send-email-gbenson@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1429277318-26646-1-git-send-email-gbenson@redhat.com> X-IsSubscribed: yes X-SW-Source: 2015-04/txt/msg00987.txt.bz2 Ping: https://sourceware.org/ml/gdb-patches/2015-04/msg00674.html Gary Benson wrote: > Hi all, > > This commit updates follow_exec to use exec_file_find to prefix > the new executable's filename with gdb_sysroot rather than doing > it longhand. > > Built and regtested on RHEL6.6 x86_64. > > Ok to commit? > > Cheers, > Gary > > > gdb/ChangeLog: > > * infrun.c (solist.h): New include. > (follow_exec): Use exec_file_find to prefix execd_pathname > with gdb_sysroot. > --- > gdb/ChangeLog | 6 ++++++ > gdb/infrun.c | 18 +++++++++++------- > 2 files changed, 17 insertions(+), 7 deletions(-) > > diff --git a/gdb/infrun.c b/gdb/infrun.c > index 7870f70..f09e2da 100644 > --- a/gdb/infrun.c > +++ b/gdb/infrun.c > @@ -60,6 +60,7 @@ > #include "target-descriptions.h" > #include "target-dcache.h" > #include "terminal.h" > +#include "solist.h" > > /* Prototypes for local functions */ > > @@ -1133,15 +1134,18 @@ follow_exec (ptid_t ptid, char *execd_pathname) > > breakpoint_init_inferior (inf_execd); > > - if (gdb_sysroot && *gdb_sysroot) > + if (gdb_sysroot != NULL && *gdb_sysroot != '\0') > { > - char *name = alloca (strlen (gdb_sysroot) > - + strlen (execd_pathname) > - + 1); > + int fd = -1; > + char *name; > > - strcpy (name, gdb_sysroot); > - strcat (name, execd_pathname); > - execd_pathname = name; > + name = exec_file_find (execd_pathname, &fd); > + if (fd >= 0) > + close (fd); > + > + execd_pathname = alloca (strlen (name) + 1); > + strcpy (execd_pathname, name); > + xfree (name); > } > > /* Reset the shared library package. This ensures that we get a > -- > 1.7.1 > -- http://gbenson.net/