gdb: sim: handle target sysroot prefix
authorMike Frysinger <vapier@gentoo.org>
Tue, 23 Jun 2015 15:29:39 +0000 (11:29 -0400)
committerMike Frysinger <vapier@gentoo.org>
Wed, 24 Jun 2015 13:59:17 +0000 (09:59 -0400)
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.

gdb/ChangeLog
gdb/remote-sim.c

index 3603241abc1df3c45c593a903d0c1575e907733d..f46a620728a5958cda688162e3231dd3bfad7597 100644 (file)
@@ -1,3 +1,9 @@
+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.
+
 2015-06-24  Yao Qi  <yao.qi@linaro.org>
 
        * aarch64-linux-tdep.c (aarch64_linux_init_abi): Don't call
index fd2fd5872d243a6fbae2cc42b2a6e17bccf7bf0c..0c43379001d0826702ed524af5499e3619d8c8b8 100644 (file)
@@ -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)
@@ -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)
     {
This page took 0.031981 seconds and 4 git commands to generate.