From: Mike Frysinger <vapier@gentoo.org>
To: Pedro Alves <palves@redhat.com>
Cc: gdb-patches@sourceware.org, gbenson@redhat.com
Subject: Re: [PATCH v2] gdb: sim: handle target sysroot prefix
Date: Wed, 24 Jun 2015 14:32:00 -0000 [thread overview]
Message-ID: <20150624143234.GO17734@vapier> (raw)
In-Reply-To: <558AB4D2.5030905@redhat.com>
[-- Attachment #1.1: Type: text/plain, Size: 1562 bytes --]
On 24 Jun 2015 14:46, Pedro Alves wrote:
> On 06/23/2015 04:29 PM, Mike Frysinger wrote:
> > --- a/gdb/remote-sim.c
> > +++ b/gdb/remote-sim.c
> > @@ -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.
already pushed ;). i've committed the attached on top though.
> (it would be easy to get rid of all that using reconcat.)
hmm, maybe. would be nice if the argv could be built up incrementally.
maybe xstrprintf would be a simple stop gap.
-mike
[-- Attachment #1.2: 0001-gdb-sim-merge-the-sysroot-update-logic-together.patch --]
[-- Type: text/x-diff, Size: 1860 bytes --]
From 87d1b30944783ae0efb49236c6d872d775a37417 Mon Sep 17 00:00:00 2001
From: Mike Frysinger <vapier@gentoo.org>
Date: Wed, 24 Jun 2015 21:23:12 +0700
Subject: [PATCH] gdb: sim: merge the sysroot update logic together
Initialize the local sysroot fully before we start using it.
This keeps it all a bit simpler.
---
gdb/ChangeLog | 4 ++++
gdb/remote-sim.c | 8 +++++---
2 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index f46a620..19144ed 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,9 @@
2015-06-24 Mike Frysinger <vapier@gentoo.org>
+ * remote-sim.c (gdbsim_open): Move sysroot update to the top.
+
+2015-06-24 Mike Frysinger <vapier@gentoo.org>
+
* 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.
diff --git a/gdb/remote-sim.c b/gdb/remote-sim.c
index 0c43379..82c129d 100644
--- a/gdb/remote-sim.c
+++ b/gdb/remote-sim.c
@@ -670,9 +670,13 @@ gdbsim_open (const char *args, int from_tty)
int len;
char *arg_buf;
struct sim_inferior_data *sim_data;
- const char *sysroot = gdb_sysroot;
+ const char *sysroot;
SIM_DESC gdbsim_desc;
+ sysroot = gdb_sysroot;
+ if (is_target_filename (sysroot))
+ sysroot += strlen (TARGET_SYSROOT_PREFIX);
+
if (remote_debug)
fprintf_unfiltered (gdb_stdlog,
"gdbsim_open: args \"%s\"\n", args ? args : "(null)");
@@ -717,8 +721,6 @@ gdbsim_open (const char *args, int from_tty)
}
/* Pass along gdb's concept of the sysroot. */
strcat (arg_buf, " --sysroot=");
- if (is_target_filename (sysroot))
- sysroot += strlen (TARGET_SYSROOT_PREFIX);
strcat (arg_buf, sysroot);
/* finally, any explicit args */
if (args)
--
2.4.4
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
next prev parent reply other threads:[~2015-06-24 14:32 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-21 18:08 [PATCH] " Mike Frysinger
2015-06-22 9:50 ` Gary Benson
2015-06-23 15:28 ` Mike Frysinger
2015-06-24 10:30 ` Gary Benson
2015-06-25 8:35 ` [OB PATCH] Remove gdb_sysroot NULL checks Gary Benson
2015-06-23 15:29 ` [PATCH v2] gdb: sim: handle target sysroot prefix Mike Frysinger
2015-06-24 10:31 ` Gary Benson
2015-06-24 13:47 ` Pedro Alves
2015-06-24 14:32 ` Mike Frysinger [this message]
2015-06-23 15:29 ` [PATCH] gdb: microblaze: delete useless stubs Mike Frysinger
2015-06-23 15:31 ` Mike Frysinger
2015-06-23 17:39 ` Michael Eager
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20150624143234.GO17734@vapier \
--to=vapier@gentoo.org \
--cc=gbenson@redhat.com \
--cc=gdb-patches@sourceware.org \
--cc=palves@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox