[PATCH] D16697: Updating .debug_line section version information to match DWARF version.

Katya Romanova via cfe-commits cfe-commits at lists.llvm.org
Thu Jan 28 16:28:15 PST 2016


kromanova created this revision.
kromanova added reviewers: dblaikie, echristo, probinson.
kromanova added a subscriber: cfe-commits.
kromanova set the repository for this revision to rL LLVM.

Hello,
The compiler always emits .debug_line version 2, though some opcodes from DWARF 3 (e.g. DW_LNS_set_prologue_end, DW_LNS_set_epilogue_begin or DW_LNS_set_isa) and from DWARF 4 could be emitted by the compiler. That's not exactly right.

This patch changes version information of .debug_line to exactly match the DWARF version (which is 4 by default).
For .debug_line version 4, a new field maximum_operations_per_instruction is emitted. I'm not exactly sure how to set this field correctly for VLIW architectures. Hopefully, there are some experts in the community that could help out (any Hexagon debuginfo developers out there?).

I’ve tried a few tools to check if they could handle .debug_line version 4.
On a simple testcase, I verified that GDB debugger 7.7 understands .debug_line version 4.
Sony’s proprietary debugger can understand it too.
I don't have LLDB built, so I haven’t tried it.
GCC (older version 4.8.2) still emits version 2 for the .debug_line section, even though the DWARF version is set to 4. I'm not sure about the latest GCC. 
GNU's readelf (version 2.24) can handle .debug_line version 4.

I added 3 new tests debug-line-version2.ll, debug-line-version3.ll and debug-line-version4.ll. The IR is generated from one source using different options (-gdwarf-2, -gdwarf-3 and –gdwarf-4). Any idea how to merge these three tests into one?

Let me know what do you think about the patch.


Repository:
  rL LLVM

http://reviews.llvm.org/D16697

Files:
  lib/MC/MCDwarf.cpp
  test/DebugInfo/AArch64/line-header.ll
  test/DebugInfo/Generic/debug-line-version2.ll
  test/DebugInfo/Generic/debug-line-version3.ll
  test/DebugInfo/Generic/debug-line-version4.ll
  test/DebugInfo/Generic/empty.ll
  test/DebugInfo/X86/empty.ll
  test/DebugInfo/X86/stmt-list-multiple-compile-units.ll
  test/MC/ELF/debug-line.s
  test/MC/ELF/debug-line2.s
  test/MC/ELF/debug-loc.s
  test/MC/ELF/discriminator.s
  test/MC/ELF/empty-dwarf-lines.s
  test/MC/MachO/file.s
  test/MC/MachO/gen-dwarf.s
  test/MC/MachO/loc.s

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D16697.46324.patch
Type: text/x-patch
Size: 15668 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160129/856175e7/attachment-0001.bin>


More information about the cfe-commits mailing list