[patch libiberty include]: Add additional helper functions for directory-separator searching
Pedro Alves
pedro@codesourcery.com
Wed Mar 9 12:58:00 GMT 2011
On Wednesday 09 March 2011 12:35:00, Eli Zaretskii wrote:
> > I meant a valid use case in the code bases.
>
> Sorry for my misunderstanding.
NP.
>
> > Might as well cook up a (gdb) patch. Find it pasted below. Does it
> > look good to you?
>
> Yes, looks fine. Thanks.
Thanks. I've applied it.
> > The one's left are: 1 in a linux-native only file (never cares
> > for other filesystem semantics), and a couple in the coff and
> > mdebug readers. The latter could be rewritten in terms of
> > lbasename, but I'm not sure whether gcc outputs a literal '/' in
> > that case even when building on mingw. If so, and we changed them,
> > we'd be breaking reading these files on Windows
>
> Sorry, I don't understand how would that break on Windows. Could you
> elaborate? And what "couple of coff and mdebug readers" did you have
> in mind?
Sorry, in the hurry, I had a (another) brain cramp. Wouldn't break.
Still it'd be useless to change this _if_ gcc hardcodes '/'. Dunno
whether it does.
>find . -name "*.c" | xargs grep strrchr | grep "'/'"
./linux-thread-db.c: cp = strrchr (path, '/');
./mdebugread.c: p = strrchr (namestring, '/');
./dbxread.c: p = strrchr (namestring, '/');
Both look like this:
/* Some compilers (including gcc) emit a pair of initial N_SOs.
The first one is a directory name; the second the file name.
If pst exists, is empty, and has a filename ending in '/',
we assume the previous N_SO was a directory name. */
p = strrchr (namestring, '/');
if (p && *(p + 1) == '\000')
{
/* Save the directory name SOs locally, then save it into
the psymtab when it's created below. */
dirname_nso = namestring;
continue;
}
--
Pedro Alves
More information about the Binutils
mailing list