public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] gdb: sim: handle target sysroot prefix
@ 2015-06-21 18:08 Mike Frysinger
  2015-06-22  9:50 ` Gary Benson
                   ` (2 more replies)
  0 siblings, 3 replies; 12+ messages in thread
From: Mike Frysinger @ 2015-06-21 18:08 UTC (permalink / raw)
  To: gdb-patches; +Cc: gbenson

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  <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 set.
---
 gdb/remote-sim.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/gdb/remote-sim.c b/gdb/remote-sim.c
index fd2fd58..b4f25bf 100644
--- a/gdb/remote-sim.c
+++ b/gdb/remote-sim.c
@@ -21,6 +21,7 @@
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
 #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)
@@ -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 (startswith (sysroot, TARGET_SYSROOT_PREFIX))
+    sysroot += strlen (TARGET_SYSROOT_PREFIX);
+  strcat (arg_buf, sysroot);
   /* finally, any explicit args */
   if (args)
     {
-- 
2.4.1

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2015-06-25  8:35 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-21 18:08 [PATCH] gdb: sim: handle target sysroot prefix 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] gdb: microblaze: delete useless stubs Mike Frysinger
2015-06-23 15:31   ` Mike Frysinger
2015-06-23 17:39   ` Michael Eager
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 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).