From patchwork Tue Jun 23 15:29:39 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Frysinger X-Patchwork-Id: 7303 Received: (qmail 69383 invoked by alias); 23 Jun 2015 15:29:45 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 69359 invoked by uid 89); 23 Jun 2015 15:29:44 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.5 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD, SPF_PASS autolearn=ham version=3.3.2 X-HELO: smtp.gentoo.org Received: from smtp.gentoo.org (HELO smtp.gentoo.org) (140.211.166.183) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Tue, 23 Jun 2015 15:29:43 +0000 Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.gentoo.org (Postfix) with ESMTP id 803CD3409D5; Tue, 23 Jun 2015 15:29:41 +0000 (UTC) From: Mike Frysinger To: gdb-patches@sourceware.org Cc: gbenson@redhat.com Subject: [PATCH v2] gdb: sim: handle target sysroot prefix Date: Tue, 23 Jun 2015 11:29:39 -0400 Message-Id: <1435073379-30787-1-git-send-email-vapier@gentoo.org> In-Reply-To: <1434910105-7023-1-git-send-email-vapier@gentoo.org> References: <1434910105-7023-1-git-send-email-vapier@gentoo.org> X-IsSubscribed: yes 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 active. --- v2 - use is_target_filename 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); + strcat (arg_buf, sysroot); /* finally, any explicit args */ if (args) {