Re: [RFA] patch for DW_AT_comp_dir/DW_AT_name vs .debug_line inco nsistencies

Daniel Jacobowitz
2008-01-08T16:19:26Z

On Tue, Jan 08, 2008 at 11:09:18AM -0500, Aleksandar Ristovski wrote:
> b) Symlinks involved:
> b1) Then I tried to make a symlink to another location:
> ln -s /tmp /foo/bar/obj
> Make /foo/bar/obj my work dir and try:
> gcc ../main.cc
> It fails to find it (and rightfully so).
> The only way I could build it is by using the absolute names.
> gcc -c -g /foo/bar/main.cc -o main.o
> now DW_AT_comp_dir is not specified and all paths are absolute (so no
> problems there).

No, try:

mkdir -p /foo/bar/real-obj/obj
touch /foo/bar/real-obj/main.c
rm /foo/bar/obj
ln -s /foo/bar/real-obj/obj /foo/bar/obj
cd /foo/bar/obj
gcc ../main.c

The path "/foo/bar/obj/../main.c" is valid. The path
"/foo/bar/main.c" is not.

I think we should not implement this unless we have a real-world
example where it would be necessary. It would require a version of
the compiler which outputs different paths in .debug_info and
.debug_line for the same file (which is a bug in the compiler, in my
opinion!), a Makefile using ".." to find source files, and a source
file including another file with the same basename.

--
Daniel Jacobowitz
CodeSourcery