From: Tom Tromey <tromey@adacore.com>
To: gdb-patches@sourceware.org
Cc: Tom Tromey <tromey@adacore.com>
Subject: [pushed] Fix remote-sim.c compilation
Date: Mon, 4 Oct 2021 09:16:15 -0600 [thread overview]
Message-ID: <20211004151615.1842079-1-tromey@adacore.com> (raw)
The change "make string-like set show commands use std::string
variable" caused remote-sim.c to fail to build. The issue is that the
code does:
const std::string &sysroot = gdb_sysroot;
if (is_target_filename (sysroot))
sysroot += strlen (TARGET_SYSROOT_PREFIX);
... which isn't valid.
This patch changes this code to use a 'const char *' again, fixing the
build.
---
gdb/remote-sim.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/gdb/remote-sim.c b/gdb/remote-sim.c
index 5bfce2a9a31..3143b4213a6 100644
--- a/gdb/remote-sim.c
+++ b/gdb/remote-sim.c
@@ -682,7 +682,7 @@ gdbsim_target_open (const char *args, int from_tty)
struct sim_inferior_data *sim_data;
SIM_DESC gdbsim_desc;
- const std::string &sysroot = gdb_sysroot;
+ const char *sysroot = gdb_sysroot.c_str ();
if (is_target_filename (sysroot))
sysroot += strlen (TARGET_SYSROOT_PREFIX);
@@ -703,7 +703,7 @@ gdbsim_target_open (const char *args, int from_tty)
len = (7 + 1 /* gdbsim */
+ strlen (" -E little")
+ strlen (" --architecture=xxxxxxxxxx")
- + strlen (" --sysroot=") + sysroot.length () +
+ + strlen (" --sysroot=") + strlen (sysroot) +
+ (args ? strlen (args) : 0)
+ 50) /* slack */ ;
arg_buf = (char *) alloca (len);
@@ -730,7 +730,7 @@ gdbsim_target_open (const char *args, int from_tty)
}
/* Pass along gdb's concept of the sysroot. */
strcat (arg_buf, " --sysroot=");
- strcat (arg_buf, sysroot.c_str ());
+ strcat (arg_buf, sysroot);
/* finally, any explicit args */
if (args)
{
--
2.31.1
reply other threads:[~2021-10-04 15:16 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20211004151615.1842079-1-tromey@adacore.com \
--to=tromey@adacore.com \
--cc=gdb-patches@sourceware.org \
/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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).