[PATCH] Use the DWARF form DW_FORM_sec_offset or DW_FORM_data4 depending on the Dwarf version being generated

Keith Walker kwalker at arm.com
Thu Nov 14 08:28:49 PST 2013


Hi echristo,

In Dwarf 3 (and Dwarf 2) attributes whose value are offsets into a section use the form DW_FORM_data4 whilst in Dwarf 4 and later they use the form DW_FORM_sec_offset.

This patch updates the places where such attributes are generated to use the appropriate form depending on the Dwarf version.  The DIE entries affected have the following tags: 
DW_AT_stmt_list, DW_AT_ranges, DW_AT_location, DW_AT_GNU_pubnames, DW_AT_GNU_pubtypes, DW_AT_GNU_addr_base, DW_AT_GNU_ranges_base

It also adds a hidden command line option "--dwarf-version=<uint>" to llc which allows the version of Dwarf to be generated to override what is specified in the metadata;  this makes it possible to update existing tests to check the debugging information generated for both Dwarf 4 (the default) and Dwarf 3 using the same metadata.

http://llvm-reviews.chandlerc.com/D2180

Files:
  lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
  lib/CodeGen/AsmPrinter/DwarfCompileUnit.h
  lib/CodeGen/AsmPrinter/DIE.cpp
  lib/CodeGen/AsmPrinter/DwarfDebug.cpp
  test/DebugInfo/X86/op_deref.ll
  test/DebugInfo/X86/block-capture.ll
  test/DebugInfo/X86/DW_AT_stmt_list_sec_offset.ll
  test/DebugInfo/X86/gnu-public-names.ll
  test/DebugInfo/X86/fission-cu.ll
  test/DebugInfo/X86/stmt-list-multiple-compile-units.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D2180.1.patch
Type: text/x-patch
Size: 25591 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20131114/396b570c/attachment.bin>


More information about the llvm-commits mailing list