From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 112080 invoked by alias); 24 Jun 2015 14:32:38 -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 112070 invoked by uid 89); 24 Jun 2015 14:32:37 -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; Wed, 24 Jun 2015 14:32:36 +0000 Received: from vapier (localhost [127.0.0.1]) by smtp.gentoo.org (Postfix) with SMTP id A545234091F; Wed, 24 Jun 2015 14:32:34 +0000 (UTC) Date: Wed, 24 Jun 2015 14:32:00 -0000 From: Mike Frysinger To: Pedro Alves Cc: gdb-patches@sourceware.org, gbenson@redhat.com Subject: Re: [PATCH v2] gdb: sim: handle target sysroot prefix Message-ID: <20150624143234.GO17734@vapier> Mail-Followup-To: Pedro Alves , gdb-patches@sourceware.org, gbenson@redhat.com References: <1434910105-7023-1-git-send-email-vapier@gentoo.org> <1435073379-30787-1-git-send-email-vapier@gentoo.org> <558AB4D2.5030905@redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="KM+e2hnYAO+MCJ5e" Content-Disposition: inline In-Reply-To: <558AB4D2.5030905@redhat.com> X-IsSubscribed: yes X-SW-Source: 2015-06/txt/msg00531.txt.bz2 --KM+e2hnYAO+MCJ5e Content-Type: multipart/mixed; boundary="i6vqABX3nJKXLk01" Content-Disposition: inline --i6vqABX3nJKXLk01 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-length: 1546 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 =3D gdb_sysroot; > > SIM_DESC gdbsim_desc; > >=20=20 > > if (remote_debug) > > @@ -688,7 +690,7 @@ gdbsim_open (const char *args, int from_tty) > > len =3D (7 + 1 /* gdbsim */ > > + strlen (" -E little") > > + strlen (" --architecture=3Dxxxxxxxxxx") > > - + strlen (" --sysroot=3D") + strlen (gdb_sysroot) + > > + + strlen (" --sysroot=3D") + strlen (sysroot) + > > + (args ? strlen (args) : 0) > > + 50) /* slack */ ; > > arg_buf =3D (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=3D"); > > - strcat (arg_buf, gdb_sysroot); > > + if (is_target_filename (sysroot)) > > + sysroot +=3D strlen (TARGET_SYSROOT_PREFIX); >=20 > Please do this skipping above the "len =3D " computation. As is > we'll just oversize arg_bug, but there's no good reason > for the discrepancy. >=20 > 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 --i6vqABX3nJKXLk01 Content-Type: text/x-diff; charset=utf-8 Content-Disposition: attachment; filename="0001-gdb-sim-merge-the-sysroot-update-logic-together.patch" Content-Transfer-Encoding: quoted-printable Content-length: 1821 =46rom 87d1b30944783ae0efb49236c6d872d775a37417 Mon Sep 17 00:00:00 2001 From: Mike Frysinger 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 =20 + * remote-sim.c (gdbsim_open): Move sysroot update to the top. + +2015-06-24 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. 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 =3D gdb_sysroot; + const char *sysroot; SIM_DESC gdbsim_desc; =20 + sysroot =3D gdb_sysroot; + if (is_target_filename (sysroot)) + sysroot +=3D 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=3D"); - if (is_target_filename (sysroot)) - sysroot +=3D strlen (TARGET_SYSROOT_PREFIX); strcat (arg_buf, sysroot); /* finally, any explicit args */ if (args) --=20 2.4.4 --i6vqABX3nJKXLk01-- --KM+e2hnYAO+MCJ5e Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature Content-length: 819 -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJVir+CAAoJEEFjO5/oN/WBnrYQALLb+QOEOMHQc3OT2rdNvXSc Vd41ifoIylN4rLhKoM6jwtQHGTcwXCVslOxJLN0Hem5iyj44A0QQi7vRtt0aC+sX eNN68h1aFPvGneYn7MALeU5L166DJzDHs00E0gTK9AqJfbrfTEJQGIWDR4WoG4QA hXDzDsHxau7ac03ytT7a1/LE6EIIzc5eEGrN//vvbi6UUcrg+QyJXROqfu1qQVuQ LgDDqJM9jBC2X7L72xxY+NmXCsrZLGErZkXJoOZNnjFFb/Ep/DSIoBMZNufUDVlv uXLfglA9vupatjrGODwDZ+Rr9k58STbGeWh6/dE2bm6fIHljufzEGJxlGABI0ej5 QV3u8fZaL4BB6Hb8QlvCzbUfE4vWWvmMiJzRM92KA8inEm/HsXYjUocj3X0SfWAb qBHt5qMfX76CGhgpyNcD75btHpEYPMAvZtHEn2cVPw4GHltGJqo5JldHtJXRgA8/ EAGRhJWfbFWNOHR8PCpRgiEjWzlYaQ2sumRaRVt51h9So3nmMQdn4aSfn+Ft1+GJ ihNgh8p4BFiypteebeyUXXlDt3s0zuDwkl9PsKQK+Qo/S4g9NlhsKUw8chSbi6rD pqpSegTH1iP5abj7KCyFma/TK5SuAbul+nZC1MkVz+WGWTnLZufA6JjStFemi+FQ gWTGvobaMcwe6P/Ind+u =rvuw -----END PGP SIGNATURE----- --KM+e2hnYAO+MCJ5e--