[llvm-bugs] [Bug 44170] New: Duplicate file names in DWARF v5 line tables

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Nov 28 02:54:03 PST 2019


https://bugs.llvm.org/show_bug.cgi?id=44170

            Bug ID: 44170
           Summary: Duplicate file names in DWARF v5 line tables
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: DebugInfo
          Assignee: unassignedbugs at nondot.org
          Reporter: labath at google.com
                CC: dblaikie at gmail.com, jdevlieghere at apple.com,
                    keith.walker at arm.com, llvm-bugs at lists.llvm.org,
                    paul_robinson at playstation.sony.com

[Filing this as a debug info bug, but in all likelihood this is a bug in how
clang generates llvm ir.]

If compile the a file with just a slightly more complicated path (e.g. add a
leading "./"), the file will end up twice in the line table.

=====
$ clang -gmlt -gdwarf-5 -o a.o ./a.c -c && llvm-dwarfdump -debug-line a.o
...
include_directories[  0] = "/tmp/X"
include_directories[  1] = "."
file_names[  0]:
           name: "a.c"
      dir_index: 0
   md5_checksum: e6ab1d5b7f82464c963a8522037dfa72
file_names[  1]:
           name: "a.c"
      dir_index: 1
   md5_checksum: e6ab1d5b7f82464c963a8522037dfa72

Address            Line   Column File   ISA Discriminator Flags
------------------ ------ ------ ------ --- ------------- -------------
0x0000000000000000      1      0      1   0             0  is_stmt
=====

If I remove the "./" then the file is present just once, and all the line table
entries correctly reference entry 0.

I found this while playing around with lldb and dwarf 5. It seems lldb has some
code, which assumes a file will be present only once in a line table, and so
things fail in subtle ways, because sometimes it will pick file zero, which has
no line entries associated with it. Lldb probably shouldn't be making that
assumption, but regardless of that, this looks like a bug in llvm/clang. The
code in question definitely comes from the primary source file, so the line
tables should reference it as such.

This is probably caused by the fact that we do some form of path simplification
on the path which goes in the the DICompileUnit, but not on the line !dbg
attachments.  I guess both should undergo the same kinds of simplifications.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20191128/7fa2f1bb/attachment-0001.html>


More information about the llvm-bugs mailing list