RFC: add relative file name handling for linespecs

Jan Kratochvil jan.kratochvil@redhat.com
Sat Dec 8 16:34:00 GMT 2012


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



More information about the Gdb-patches mailing list