https://sourceware.org/bugzilla/show_bug.cgi?id=29535
Nick Clifton <nickc at redhat dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |nickc at redhat dot com --- Comment #1 from Nick Clifton <nickc at redhat dot com> --- Hi Ralf, [I am selectively quoting from parts of your description....] > <a0> DW_AT_name : ../test.c > <a4> DW_AT_comp_dir : /home/<user>/src/test-binutils/build > Combining DW_AT_name, '/' and DW_AT_comp_dir returns the correct path > to the used source file. But the DWARF standard does not specify that these two attributes should be combined when using absolute paths. In fact in section 3.1.1 it says: A DW_AT_name attribute whose value is a null-terminated string containing the full or relative path name (relative to the value of the DW_AT_comp_dir attribute, see below) of the primary source file from which the compilation unit was derived. So the DW_AT_comp_dir attribute is only used when DW_AT_name contains a relative path, not an absolute one. > The problem happens when using absolute paths: > > gcc -C -o test.o ~/src/test-binutils/test.c -g [Note - you are giving an absolute path to gcc, and also asking it to generate debug information]. > <a0> DW_AT_name : /home/<user>/src/test-binutils/test.c > <a4> DW_AT_comp_dir : /home/<user>/src/test-binutils/build Which happens because this is what gcc tells the assembler to do: % gcc -C -o test.o ~/src/test-binutils/test.c -g -fdump-debug % head test.c.341t.debug DWARF for /home/nickc/src/test-binutils/test.c DIE 0: DW_TAG_compile_unit (0x1521e1c2a190) abbrev id: 0 offset: 0 mark: 0 DW_AT_producer: "GNU C17 12.2.1 20220819 (Red Hat 12.2.1-1) -mtune=generic -march=x86-64 -g" DW_AT_language: 29 DW_AT_name: "/home/nickc/work/builds/binutils/current/x86_64-pc-linux-gnu/tests/pr29535.c" DW_AT_comp_dir: "/home/nickc/work/builds/binutils/current/x86_64-pc-linux-gnu/tests" And if you check in gcc's assembler output you will find both of those absolute paths. Cheers Nick -- You are receiving this mail because: You are on the CC list for the bug.