Re: RFC: add relative file name handling for linespecs

Eli Zaretskii
2012-12-08T18:33:05Z

> Date: Sat, 8 Dec 2012 17:34:07 +0100
> From: Jan Kratochvil <jan.kratochvil@redhat.com>
> Cc: gdb-patches@sourceware.org, Tom Tromey <tromey@redhat.com>
>
> Hi Eli,
>
> On Wed, 11 Jan 2012 22:49:37 +0100, Tom Tromey wrote:
> > Tom> + /* Either the names must completely match, or the character
> > Tom> + preceding the trailing SEARCH_NAME segment of FILENAME must be a
> > Tom> + directory separator. */
> > Tom> + return (len == search_len
> > Tom> + || IS_DIR_SEPARATOR (filename[len - search_len - 1]));
> >
> > Eli> What about the (somewhat perverse) case of "d:foo/bar" and "foo/bar"
> > Eli> on Windows?
> >
> > Would something like this work?
> >
> > || (HAS_DRIVE_SPEC (filename) && len - search_len == 2)
>
> FILENAME here is from the debug info file (not from the user), I believe on
> MinGW the path from DWARF is absolute (like in UNIX) and it has the format
> d:\foo\bar (not d:foo\bar), doesn't it?

If this comes only from debug info, I guess you are right, although it
would be good to make sure GCC never writes such names into debug info.