This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] gdb: sim: handle target sysroot prefix


On 22 Jun 2015 10:50, Gary Benson wrote:
> Mike Frysinger wrote:
> > @@ -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)
> >      {
> 
> Please use "is_target_filename (sysroot)" rather than startswith.

OK

> Please also update the "strlen (gdb_sysroot)" in this function.

OK

> Please note that gdb_sysroot can be NULL.

how so ?  main.c:captured_main specifically handles that:

  /* Set the sysroot path.  */
  gdb_sysroot = relocate_gdb_directory (TARGET_SYSTEM_ROOT,
                    TARGET_SYSTEM_ROOT_RELOCATABLE);

  if (gdb_sysroot == NULL || *gdb_sysroot == '\0')
    {
      xfree (gdb_sysroot);
      gdb_sysroot = xstrdup (TARGET_SYSROOT_PREFIX);
    }
-mike

Attachment: signature.asc
Description: Digital signature


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]