[Lldb-commits] [PATCH] D63591: DWARFDebugLoc: Make parsing and error reporting more robust

Pavel Labath via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Thu Jun 20 03:01:56 PDT 2019


labath created this revision.
labath added reviewers: dblaikie, JDevlieghere, probinson.
Herald added a project: LLVM.

While examining this class for possible use in lldb, I noticed two
things:

- it spits out parsing errors directly to stderr
- the loclists parser can incorrectly return valid location lists when parsing malformed (truncated) data

I improve the stderr situation by making the parseOneLocationList
functions return Expected<T>s. The errors are still dumped to stderr by
their callers, so this is only a partial fix, but it is enough for my
use case, as I intend to parse the locations lists one by one.

I fix the behavior in the truncated scenario by making the parser
explictly check for success. This makes the code a bit clunky, as the
DataExtractor API makes it really hard to do that, but this is the best
implementation I came up with given the current API.

I also add tests for handling the error cases, as they currently have no
coverage.


Repository:
  rL LLVM

https://reviews.llvm.org/D63591

Files:
  include/llvm/DebugInfo/DWARF/DWARFDebugLoc.h
  lib/DebugInfo/DWARF/DWARFDebugLoc.cpp
  lib/DebugInfo/DWARF/DWARFDie.cpp
  test/DebugInfo/X86/dwarfdump-debug-loc-error-cases.s
  test/DebugInfo/X86/dwarfdump-debug-loclists-error-cases.s

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D63591.205770.patch
Type: text/x-patch
Size: 13309 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20190620/518a67ce/attachment-0001.bin>


More information about the lldb-commits mailing list