[PATCH] D44560: [DWARF] Rework debug line parsing to use llvm::Error and callbacks

James Henderson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 9 08:41:23 PDT 2018


jhenderson updated this revision to Diff 145929.
jhenderson edited the summary of this revision.
jhenderson added a comment.

Sorry for the delay - I've been working on other things, and doing this in gaps over the past week or two. I've found what I think is a good iterator-like solution (not actually an iterator), that allows removal of the new error type. Please let me know your thoughts. Key changes are noted below.

- Added a new class `SectionParser` that is for incrementally parsing the line tables in a .debug_line section. Users provide callbacks that are used for reporting errors.
- Instead of a new `Error` type, added a method on the `Prologue` to determine if the length is valid. I felt that this was more appropriate, since the only client who iterates over everything uses the `SectionParser`.
- Modified the DWARFContext dumping of .debug_line and .debug_line.dwo to use this via a common lambda (note: this adds some additional functionality to .debug_line.dwo dumping, specifically supporting verbose dumping.
- Changed the debug line table parse function to print the prologue in verbose mode even if there is an error. This fixes a weird inconsistency between verbose and non-verbose, where non-verbose dumping would print the prologue and verbose wouldn't, if there were problems with the prologue.


Repository:
  rL LLVM

https://reviews.llvm.org/D44560

Files:
  include/llvm/CodeGen/AsmPrinter.h
  include/llvm/DebugInfo/DWARF/DWARFContext.h
  include/llvm/DebugInfo/DWARF/DWARFDebugLine.h
  lib/CodeGen/AsmPrinter/AsmPrinter.cpp
  lib/DebugInfo/DWARF/DWARFContext.cpp
  lib/DebugInfo/DWARF/DWARFDebugLine.cpp
  test/DebugInfo/X86/dwarfdump-bogus-LNE.s
  test/tools/llvm-dwarfdump/X86/Inputs/debug_line_malformed.s
  test/tools/llvm-dwarfdump/X86/Inputs/debug_line_reserved_length.s
  test/tools/llvm-dwarfdump/X86/debug_line_invalid.test
  tools/dsymutil/DwarfLinker.cpp
  unittests/DebugInfo/DWARF/DWARFDebugLineTest.cpp
  unittests/DebugInfo/DWARF/DwarfGenerator.cpp
  unittests/DebugInfo/DWARF/DwarfGenerator.h

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D44560.145929.patch
Type: text/x-patch
Size: 80346 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180509/5fb3bdb6/attachment.bin>


More information about the llvm-commits mailing list