[Bug debug/105088] New: Small DWARF 5 spec violation in line table when passing an absolute path

simon.marchi at polymtl dot ca gcc-bugzilla@gcc.gnu.org
Mon Mar 28 17:38:46 GMT 2022


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105088

            Bug ID: 105088
           Summary: Small DWARF 5 spec violation in line table when
                    passing an absolute path
           Product: gcc
           Version: 11.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: debug
          Assignee: unassigned at gcc dot gnu.org
          Reporter: simon.marchi at polymtl dot ca
  Target Milestone: ---

With:

$ gcc --version
gcc (GCC) 11.2.0
$ as --version
GNU assembler (GNU Binutils) 2.38


I have a source file at /tmp/cwd/test.c and compile it with:

$ gcc /tmp/cwd/test.c -g3 -O0 -gdwarf-5

The DW_AT_name of the CU is "/tmp/cwd/test.c":

    <12>   DW_AT_name        : (line_strp) (offset: 0xd): /tmp/cwd/test.c

The entry at index 0 in the file names table, in the line table header, is
"test.c":

0       (udata) 1       (line_strp)     (offset: 0x16): test.c

In section 6.2.4 (The Line Number Program Header), bullet 20 (file_names),
DWARF5.pdf says:

> The first entry in the sequence is the primary source file whose file name
exactly matches that given in the DW_AT_name attribute in the compilation
unit debugging information entry.

The debug info produced by the toolchain therefore seems to not respect the
spec: the name of the primary source file in the line table header ("test.c")
does not match the DW_AT_name attribute in the compilation unit DIE
("/tmp/cwd/test.c").


More information about the Gcc-bugs mailing list