From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 105617 invoked by alias); 24 Jun 2015 13:47:03 -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 105604 invoked by uid 89); 24 Jun 2015 13:47:02 -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,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; Wed, 24 Jun 2015 13:47:01 +0000 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by mx1.redhat.com (Postfix) with ESMTPS id CC87BB1F92; Wed, 24 Jun 2015 13:47:00 +0000 (UTC) Received: from [127.0.0.1] (ovpn01.gateway.prod.ext.ams2.redhat.com [10.39.146.11]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t5ODkwFE004728; Wed, 24 Jun 2015 09:46:59 -0400 Message-ID: <558AB4D2.5030905@redhat.com> Date: Wed, 24 Jun 2015 13:47:00 -0000 From: Pedro Alves User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 MIME-Version: 1.0 To: Mike Frysinger , gdb-patches@sourceware.org CC: gbenson@redhat.com Subject: Re: [PATCH v2] gdb: sim: handle target sysroot prefix References: <1434910105-7023-1-git-send-email-vapier@gentoo.org> <1435073379-30787-1-git-send-email-vapier@gentoo.org> In-Reply-To: <1435073379-30787-1-git-send-email-vapier@gentoo.org> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-SW-Source: 2015-06/txt/msg00526.txt.bz2 On 06/23/2015 04:29 PM, Mike Frysinger wrote: > gdb/remote-sim.c | 8 ++++++-- > 1 file changed, 6 insertions(+), 2 deletions(-) > > diff --git a/gdb/remote-sim.c b/gdb/remote-sim.c > index fd2fd58..0c43379 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) > @@ -688,7 +690,7 @@ gdbsim_open (const char *args, int from_tty) > len = (7 + 1 /* gdbsim */ > + strlen (" -E little") > + strlen (" --architecture=xxxxxxxxxx") > - + strlen (" --sysroot=") + strlen (gdb_sysroot) + > + + strlen (" --sysroot=") + strlen (sysroot) + > + (args ? strlen (args) : 0) > + 50) /* slack */ ; > arg_buf = (char *) alloca (len); > @@ -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 (is_target_filename (sysroot)) > + sysroot += strlen (TARGET_SYSROOT_PREFIX); Please do this skipping above the "len = " computation. As is we'll just oversize arg_bug, but there's no good reason for the discrepancy. OK with that change. (it would be easy to get rid of all that using reconcat.) Thanks you; thanks Gary. -- Pedro Alves