llvm/lib/DebugInfo/DWARF
Pavel Labath 91fd77e058 DWARFDebugLoc: Make parsing and error reporting more robust
Summary:
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 using the newly
introduced DataExtractor Cursor API.

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

Reviewers: dblaikie, JDevlieghere, probinson

Subscribers: lldb-commits, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D63591

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@370363 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-29 14:26:05 +00:00
..
CMakeLists.txt [DWARF] Revert r345546: Refactor range list extraction and dumping 2018-10-31 01:12:58 +00:00
DWARFAbbreviationDeclaration.cpp Switch LLVM to use 64-bit offsets (2/5) 2019-08-06 10:49:40 +00:00
DWARFAcceleratorTable.cpp Remove support for 32-bit offsets in utility classes (5/5) 2019-08-07 11:44:47 +00:00
DWARFAddressRange.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
DWARFCompileUnit.cpp [DWARF] Adjust return type of DWARFUnit::getLength(). 2019-08-21 14:10:57 +00:00
DWARFContext.cpp [llvm] Migrate llvm::make_unique to std::make_unique 2019-08-15 15:54:37 +00:00
DWARFDataExtractor.cpp Add error handling to the DataExtractor class 2019-08-27 11:24:08 +00:00
DWARFDebugAbbrev.cpp Switch LLVM to use 64-bit offsets (2/5) 2019-08-06 10:49:40 +00:00
DWARFDebugAddr.cpp Switch LLVM to use 64-bit offsets (2/5) 2019-08-06 10:49:40 +00:00
DWARFDebugAranges.cpp DebugInfo/DWARF: Normalize DWARFObject members on the DWARF spec section names 2019-08-07 17:18:11 +00:00
DWARFDebugArangeSet.cpp Switch LLVM to use 64-bit offsets (2/5) 2019-08-06 10:49:40 +00:00
DWARFDebugFrame.cpp [llvm] Migrate llvm::make_unique to std::make_unique 2019-08-15 15:54:37 +00:00
DWARFDebugInfoEntry.cpp Switch LLVM to use 64-bit offsets (2/5) 2019-08-06 10:49:40 +00:00
DWARFDebugLine.cpp [DebugLine] Don't try to guess the path style 2019-08-15 23:53:15 +00:00
DWARFDebugLoc.cpp DWARFDebugLoc: Make parsing and error reporting more robust 2019-08-29 14:26:05 +00:00
DWARFDebugMacro.cpp Switch LLVM to use 64-bit offsets (2/5) 2019-08-06 10:49:40 +00:00
DWARFDebugPubTable.cpp Switch LLVM to use 64-bit offsets (2/5) 2019-08-06 10:49:40 +00:00
DWARFDebugRangeList.cpp Switch LLVM to use 64-bit offsets (2/5) 2019-08-06 10:49:40 +00:00
DWARFDebugRnglists.cpp Switch LLVM to use 64-bit offsets (2/5) 2019-08-06 10:49:40 +00:00
DWARFDie.cpp Switch LLVM to use 64-bit offsets (2/5) 2019-08-06 10:49:40 +00:00
DWARFExpression.cpp Switch LLVM to use 64-bit offsets (2/5) 2019-08-06 10:49:40 +00:00
DWARFFormValue.cpp Remove support for 32-bit offsets in utility classes (5/5) 2019-08-07 11:44:47 +00:00
DWARFGdbIndex.cpp Switch LLVM to use 64-bit offsets (2/5) 2019-08-06 10:49:40 +00:00
DWARFListTable.cpp Switch LLVM to use 64-bit offsets (2/5) 2019-08-06 10:49:40 +00:00
DWARFTypeUnit.cpp [DWARF] Adjust return type of DWARFUnit::getLength(). 2019-08-21 14:10:57 +00:00
DWARFUnit.cpp [DWARF] Fix reading 64-bit DWARF type units. 2019-08-20 12:52:32 +00:00
DWARFUnitIndex.cpp [llvm] Migrate llvm::make_unique to std::make_unique 2019-08-15 15:54:37 +00:00
DWARFVerifier.cpp DWARFDebugLoc: Make parsing and error reporting more robust 2019-08-29 14:26:05 +00:00
LLVMBuild.txt Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00