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 = 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); > > Please do this skipping above the "len = " computation. As is > we'll just oversize arg_bug, but there's no good reason > for the discrepancy. > > 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