[RFC] Apply compilation dir to source_path lookup

Andrew Burgess andrew.burgess@embecosm.com
Fri Sep 13 22:45:00 GMT 2019


* Eli Zaretskii <eliz@gnu.org> [2019-09-13 10:28:52 +0300]:

> > Date: Fri, 13 Sep 2019 09:36:42 +0300
> > From: Eli Zaretskii <eliz@gnu.org>
> > CC: mgulick@mathworks.com, gdb-patches@sourceware.org
> > 
> > >                         @value{GDBN} will also append the compilation
> > > +directory to the filename and check this against all other entries in
> > > +the source path.
> > 
> > I think "append" here is a mistake.  Should it be "prepend"?  And
> > anyway, doesn't this simply repeat what was described in the text
> > above?
> 
> Btw, do the "prepend" and "append", as implemented, take care to DTRT
> with Windows drive letters at the beginning of absolute file names?  A
> literal prepending or appending will do the wrong thing there.

Gah!

Looking at the implementation of 'openp' (in source.c) I see this
code:

  /* For dos paths, d:/foo -> /foo, and d:foo -> foo.  */
  if (HAS_DRIVE_SPEC (string))
    string = STRIP_DRIVE_SPEC (string);

which just seems to throw out the drive spec, and I can't find any
code that adds it back in.  Is that going to do the right thing?

I did consider only creating the COMP_DIR/FILENAME combination if
FILENAME was not absolute, but I worried that this might be
unnecessarily restrictive, but now I'm tempted to say that would solve
this problem, and we should just wait until someone comes up with an
example where that is not good enough, before we figure out how to
allow it...

Thanks,
Andrew



More information about the Gdb-patches mailing list