Re: RFC: add relative file name handling for linespecs

Jan Kratochvil
2012-12-08T16:34:27Z

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?

Whether user can / cannot then specify d:foo/bar is unrelated to the patch Tom
did above. It could be implemented but it would be a different code/patch.

Not that it would be a bug but the current code there
|| (HAS_DRIVE_SPEC (filename)
&& STRIP_DRIVE_SPEC (filename) == &filename[len - search_len]));
can IMO never match on real world MinGW DWARF files.

Thanks,
Jan