Re: gdb_realpath: dealing with ./ and ../

Daniel Jacobowitz
2008-01-04T12:52:01Z

On Thu, Jan 03, 2008 at 01:25:55PM -0500, Aleksandar Ristovski wrote:
> 1. Problem one - relative NAME and absolute subfile->name case not covered:

I think you're right, but I can't tell for sure.

> 2. Problem two - one physical file is specified with two pathnames.
>
> This is the case I was talking about. To fix it, I would try a combination
> of guessing/normalizing, by inserting code for "second-best" match using
> normalized path (in the same loop) if FILENAME_CMP fails to match and then
> if no perfect match is found, use the second-best match. Not sure what
> happens if there are more than one second-best matches (you say it's going
> to be very rare)... probably at least issue a warning and behave as if no
> match was found? Or resort to getting the first/last second-best match? On a
> second thought, if we go with the second-best match we will never get into a
> situation where two created subfile-s give more two second-best matches...
> it will always be either perfect match or the second-best... this should
> work.

The specific case that's important here is associating the main file
from a dwarf2 CU DIE with the right lines from .debug_line. When we
go to create that subfile we haven't created the other subfiles yet.
So what we need, I think, is to handle this in dwarf2read.c by walking
through the filename / directory table.

--
Daniel Jacobowitz
CodeSourcery