aboutsummaryrefslogtreecommitdiff
path: root/gdb/remote-sim.c
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2015-06-23 11:29:39 -0400
committerMike Frysinger <vapier@gentoo.org>2015-06-24 09:59:17 -0400
commit23bf70af12aa0c14e79c02b6098117bdba8c8a3a (patch)
tree18da725c4e6dbb9c20bd1b8867c34638368f8653 /gdb/remote-sim.c
parent5cd867b414fe3609dbf596c373343474132775a8 (diff)
gdb: sim: handle target sysroot prefix
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.
Diffstat (limited to 'gdb/remote-sim.c')
-rw-r--r--gdb/remote-sim.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/gdb/remote-sim.c b/gdb/remote-sim.c
index fd2fd5872d..0c43379001 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)
@@ -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)
{