Re: [PATCH 2/7] Handle Windows drives in auto-load script paths

Hannes Domani
2020-05-26T16:31:34Z

Am Dienstag, 26. Mai 2020, 18:04:13 MESZ hat Jon Turney <jon.turney@dronecode.org.uk> Folgendes geschrieben:

> On 25/05/2020 19:56, Hannes Domani via Gdb-patches wrote:
> > Fixes this testsuite fail on Windows:
> > FAIL: gdb.base/auto-load.exp: print $script_loaded
> >
> > Converts the debugfile path from c:/dir/file to /c/dir/file, so it can be
> > appended to the auto-load path.
> >
> > gdb/ChangeLog:
> >
> > 2020-05-25  Hannes Domani  <ssbssa@yahoo.de>
> >
> >     * auto-load.c (auto_load_objfile_script_1): Convert drive part
> >     of debugfile path on Windows.
> > ---
> >  gdb/auto-load.c | 7 +++++++
> >  1 file changed, 7 insertions(+)
> >
> > diff --git a/gdb/auto-load.c b/gdb/auto-load.c
> > index 99bd96b971..88221d9f3d 100644
> > --- a/gdb/auto-load.c
> > +++ b/gdb/auto-load.c
> > @@ -784,6 +784,13 @@ auto_load_objfile_script_1 (struct objfile *objfile, const char *realname,
> >                        "scripts-directory' path \"%s\".\n"),
> >                  auto_load_dir);
> >
> > +      /* Convert Windows debugfile path from c:/dir/file to /c/dir/file.  */
> > +      if (HAS_DRIVE_SPEC (debugfile))
> > +    {
> > +      debugfile_holder = STRIP_DRIVE_SPEC (debugfile);
> > +      filename = std::string("/") + debugfile[0] + debugfile_holder;
>
>
> Is this kind of path transformation msys(2) specific?

Yes, MSYS2 uses /c/foo paths, but that's not what this is used for.

I think this is basically the same question of Christian I just answered:

> > How does this work? I thought /c/foo was not supported by either
> > cygwin or mingw?
>
> Yes, but in this case we need a path that can be appended to the various
> entries of 'set auto-load scripts-directory'.
> c:/foo can't be appended, but /c/foo can.
> So you would get something like c:/script/directory/c/foo.

Hannes