[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 Mar 28 06:58:11 PDT 2018


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

Rebased to account for https://reviews.llvm.org/rLLD328284 and https://reviews.llvm.org/rL328235, plus some minor tweaks:

- Convert the fprintf added in https://reviews.llvm.org/rL328235 into a call to `createError` and add a unit test to match.
- Added a new signature for `getLineTableForUnit` that takes a callback and returns an `Expected`, to allow LLD to provide its own error mechanism. Existing users of the function will use the existing signature, which follows the default policy of printing `Error`s returned by getOrParseLineTable as warnings.
- Renamed set of function and parameters to use singular when referring to `Error`, since it's never expected that there will be more than one `Error` returned.
- Remove an extraneous FIXME comment that had snuck in previously.
- Update a comment that suggested that we might expect errors. Errors are always unexpected under normal behaviour.
- Move responsibility of appending '\n' to the error/warning message to the logging functions, for consistency with LLD behaviour.

I haven't attempted in this version to implement a new error handler mechanism for the whole DWARFContext, as I didn't have a clear idea of how to tie this in with the debug line parser (and how it needs to indicate that the line table does not have a valid length). This can be done either in a later update to this diff, or a new diff.


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.140064.patch
Type: text/x-patch
Size: 66069 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180328/4b3403a1/attachment.bin>


More information about the llvm-commits mailing list