This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: RFC: add relative file name handling for linespecs
- From: Jan Kratochvil <jan dot kratochvil at redhat dot com>
- To: Eli Zaretskii <eliz at gnu dot org>
- Cc: gdb-patches at sourceware dot org, Tom Tromey <tromey at redhat dot com>
- Date: Sat, 8 Dec 2012 17:34:07 +0100
- Subject: Re: RFC: add relative file name handling for linespecs
- References: <m3d3arlez3.fsf@fleche.redhat.com> <83ipkjeagi.fsf@gnu.org> <m3boq93o5q.fsf@fleche.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?
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