This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
Re: [RFC]: Solib search (Was: Re: Cross solib support; continued)
> Date: Wed, 28 Nov 2001 11:00:09 +0100
> From: Orjan Friberg <orjan.friberg@axis.com>
> >
> > while (!IS_DIR_SEPARATOR (*in_pathname++))
> > ;
>
> If I understand you correctly, your suggestion is:
>
> if (found_file < 0 && IS_ABSOLUTE_PATH (in_pathname))
> {
> while (!IS_DIR_SEPARATOR (*in_pathname++))
> ;
> }
Yes, that's what I suggested.
> That will only get rid of the first dir separator.
But that's what your original code did on Unix: it would test if the
first character is a slash, and if so, step over that one slash. Did
I miss something?
> To me it seems it should be something like:
>
> if (found_file < 0 && IS_ABSOLUTE_PATH (in_pathname))
> {
> while (IS_DIR_SEPARATOR (*in_pathname))
> in_pathname++;
> }
>
> (Can't use while (IS_DIR_SEPARATOR (*in_pathname++)) as it would
> remove the first non-dir separator also.)
No, I do think my code is right. Let me explain why.
Since we are under the if clause, we _know_ that the file name begins
with either "/foo" or "d:/foo". In the first case, IS_DIR_SEPARATOR
returns 1, so the while loop is terminated immediately, but
in_pathname was already bumped to point after the slash--that's what
your original code did. In the second code, the loop will march over
the drive letter and the colon and terminate on the slash that
follows, and again in_pathname will be incremented by the last
iteration to point right after the slash.