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

Paul Robinson Paul_Robinson at playstation.sony.com
Tue Jul 7 15:20:51 PDT 2015


probinson added a subscriber: probinson.

In http://reviews.llvm.org/D11003#200613, @dsrbecky wrote:

> As a side note, what is the compilation unit filename needed for?  The filenames in the line table are obviously used for PC->line mapping, and they may be referenced from the debug_info.  However, it is not clear to me why compilation unit needs a filename.  I believe it is perfectly valid to aggregate all debug information info to single compilation unit, and then there is no obvious primary source file.


The primary source filename is in the compilation unit's DW_AT_name and repeated in the .debug_line section's file table.  However the current directory of the compilation unit is found only in the compilation unit's DW_AT_comp_dir; this implicitly becomes directory entry 0 in the line table.  Sadly this means you cannot collapse all comp units because they can have different comp_dir values.

The only DWARF-specified method for identifying the primary source file in the line table is the name that matches DW_AT_name from the comp unit. If there's no DW_AT_name then you can guess it's the first entry; but that's just a guess.


http://reviews.llvm.org/D11003







More information about the llvm-commits mailing list