From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 54752 invoked by alias); 22 Jun 2015 09:50:32 -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 54742 invoked by uid 89); 22 Jun 2015 09:50:31 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.2 required=5.0 tests=AWL,BAYES_00,KAM_LAZY_DOMAIN_SECURITY,RP_MATCHES_RCVD,SPF_HELO_PASS 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, 22 Jun 2015 09:50:29 +0000 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (Postfix) with ESMTPS id 67D9B350108; Mon, 22 Jun 2015 09:50:28 +0000 (UTC) Received: from blade.nx (ovpn-116-95.ams2.redhat.com [10.36.116.95]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t5M9oRW9013443; Mon, 22 Jun 2015 05:50:28 -0400 Received: by blade.nx (Postfix, from userid 1000) id 33610264251; Mon, 22 Jun 2015 10:50:27 +0100 (BST) Date: Mon, 22 Jun 2015 09:50:00 -0000 From: Gary Benson To: Mike Frysinger Cc: gdb-patches@sourceware.org Subject: Re: [PATCH] gdb: sim: handle target sysroot prefix Message-ID: <20150622095026.GA22082@blade.nx> References: <1434910105-7023-1-git-send-email-vapier@gentoo.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1434910105-7023-1-git-send-email-vapier@gentoo.org> X-IsSubscribed: yes X-SW-Source: 2015-06/txt/msg00431.txt.bz2 Hi Mike, Mike Frysinger wrote: > The default gdb sysroot now sets itself to "target:". This works > for most remote targets, but when using the simulator, this causes > problems as the sim will attempt to search for that path. > > Update the remote-sim logic to skip this leading prefix when it is > found so that the sysroot isn't passed in as an invalid value. > > 2015-06-21 Mike Frysinger > > * remote-sim.c: Include gdb_bfd.h. > (gdbsim_open): Declare new local sysroot pointing to gdb_sysroot. > Skip TARGET_SYSROOT_PREFIX in gdb_sysroot when it is set. > --- > gdb/remote-sim.c | 6 +++++- > 1 file changed, 5 insertions(+), 1 deletion(-) > > diff --git a/gdb/remote-sim.c b/gdb/remote-sim.c > index fd2fd58..b4f25bf 100644 > --- a/gdb/remote-sim.c > +++ b/gdb/remote-sim.c > @@ -21,6 +21,7 @@ > along with this program. If not, see . */ > > #include "defs.h" > +#include "gdb_bfd.h" > #include "inferior.h" > #include "infrun.h" > #include "value.h" > @@ -669,6 +670,7 @@ gdbsim_open (const char *args, int from_tty) > int len; > char *arg_buf; > struct sim_inferior_data *sim_data; > + const char *sysroot = gdb_sysroot; > SIM_DESC gdbsim_desc; > > if (remote_debug) > @@ -715,7 +717,9 @@ gdbsim_open (const char *args, int from_tty) > } > /* Pass along gdb's concept of the sysroot. */ > strcat (arg_buf, " --sysroot="); > - strcat (arg_buf, gdb_sysroot); > + if (startswith (sysroot, TARGET_SYSROOT_PREFIX)) > + sysroot += strlen (TARGET_SYSROOT_PREFIX); > + strcat (arg_buf, sysroot); > /* finally, any explicit args */ > if (args) > { Please use "is_target_filename (sysroot)" rather than startswith. Please also update the "strlen (gdb_sysroot)" in this function. Please note that gdb_sysroot can be NULL. Otherwise looks good to me :) Cheers, Gary -- http://gbenson.net/