This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [patch] Fix for PR gdb/9538 (loading of separate debuginfo and symlinks).
On Fri, 13 Jan 2012 00:05:06 +0100, Paul Pluzhnikov wrote:
> On Thu, Jan 12, 2012 at 2:40 PM, Jan Kratochvil
> <jan.kratochvil@redhat.com> wrote:
>
> > There exists lstat in gnulib
>
> There doesn't appear to be one in my (freshly sync'd) copy:
>
> grep -r lstat gnulib
> gnulib/Makefile.in:localstatedir = @localstatedir@
I meant upstream gnulib. GDB contains only several pieces of it already in
use by GDB. We could import more of them, if needed.
> > Still you call there:
> > + Âdir1 = xstrdup (objfile->name);
> > + Âcanon_dir = lrealpath (dir1);
> > and later:
> > + Âdir2 = lrealpath (objfile->name);
>
> If objfile->name is "/foo/bar/baz", and is a symlink to "/zork/zark/baz"
> (and nothing else is a symlink) then the two realpath() calls will return
> "/foo/bar" and "/zork/zark/baz" and (I think) are unavoidable.
But in this case "baz" is a symlink. So `lstat (objfile->name)' would report
it is a symlink. This would indicate we should run second lrealpath.
In most cases `lstat (objfile->name)' will report is is a regular file.
In such case the second (new) part of the function can be IMO skipped as it
cannot find anything more.
Thanks,
Jan