DW_AT_low_pc in compile unit

Hi all,

I am using the LLVM compiler to generate DWARF version 2 (passing -gdwarf-2
flag to the compiler).

In the documentation (see DWARF 2 standard, section 3.1 Compilation Unit
Entries <http://www.dwarfstd.org/doc/dwarf-2.0.0.pdf&gt; ) it says:

The presence of low and high pc attributes in a compilation unit entry imply
that the code
generated for that compilation unit is contiguous and exists totally within
the boundaries
specified by those two attributes. If that is not the case, no low and high
pc attributes
should be produced.

Starting with DWARF version 3 there is a new representation described in
section 2.17 Code Addresses and Ranges (see DWARF standard version 3
<http://www.dwarfstd.org/doc/Dwarf3.pdf&gt; )

Looking in the Compiler sources I found that it works according to the newer
standard without any checking of the used version:
In the function "DwarfDebug::constructCompileUnit" from the file

  // 2.17.1 requires that we use DW_AT_low_pc for a single entry point
  // into an entity. We're using 0 (or a NULL label) for this. For
  // split dwarf it's in the skeleton CU so omit it here.
  if (!useSplitDwarf())
    NewCU->addLabelAddress(Die, dwarf::DW_AT_low_pc, NULL);

I didn't find any DW_AT_high_pc attribute generation here for the compile

I may didn't understand these attributes that is why the mentioned above
seems to me is a bug (or at least inconsistent to the DWARF 2 standard).

So I will appreciate any comments or links describing in details (with cases
if possible) these low/high_pc attributes' meaning and contiguous/not
contiguous compile unit.


I have also find the following bug:

Bug 13351 - LLVM doesn't emit DW_AT_high_pc in compile unit

I just would like to know how can I generate DW_AT_high_pc for the compile
unit when DWARF 2 version is used.


Just would like to share for people who will face with this problem in
further (I believe only few ones will).

It seems this is fixed in LLVM 3.6. (I was found the issue with LLVM 3.4
version) in the current - llvm 3.6 version corresponding DW_AT_low_pc and
DW_AT_high_pc attribute pair is generated according to the standard.