[PATCH] D11003: Tolerate DWARF compile unit without filename.

Greg Clayton clayborg at gmail.com
Tue Jul 7 15:53:05 PDT 2015


DWARF has the notion in its line tables that the primary source file is the first one in the file list of the line table prologue. Compile units are also how the compiles think of things so this is the way they were represented in the debug info. Things tend to be less clear when you apply link time optimizations where a number of .o files are optimized into new code and then debug info is written out for the newly optimized code, but in general, most compilers have the notion of one file being compiled at a time and that is one primary file. DWARF added the DW_AT_name to the DW_TAG_compile_unit so that you could see the source file by just looking at the DWARF in the .debug_info section. The DW_AT_stmt_list is an attribute that has an offset into the .debug_line section which contains the line table prologue (directory lists, file lists and more) and the line table rows (address -> file + line + column). It would be a pain to not include the name of the compile unit (the file path) in the .debug_info because then you would need to parse a separate section to show the complete info for the compile unit. So part of this is just organization of the debug info and how to make each section stand on its own (there might not be a line table and a compile unit might not have a DW_AT_stmt_list).


http://reviews.llvm.org/D11003







More information about the llvm-commits mailing list