[Support] Make DataExtractor error messages more clear
authorPavel Labath <pavel@labath.sk>
Mon, 20 Apr 2020 15:28:15 +0000 (17:28 +0200)
committerPavel Labath <pavel@labath.sk>
Tue, 2 Jun 2020 10:57:51 +0000 (12:57 +0200)
commit04aea769bfad4ec78242adc2241aa751d10862f8
tree7af0ff1741c0924983132d9de9aeb4a4c271e4de
parentbddd2888264492a6deb0d447ee6ac042d3fb44e4
[Support] Make DataExtractor error messages more clear

Summary:
This is a result of the discussion at D78113. Previously we would be
only giving the current offset at which the error was detected. However,
this was phrased somewhat ambiguously (as it could also mean that end of
data was at that offset). The new error message includes the current
offset as well as the extent of the data being read.

I've changed a couple of file-level static functions into private member
functions in order to avoid passing a bunch of new arguments everywhere.

Reviewers: dblaikie, jhenderson

Subscribers: hiraditya, MaskRay, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D78558
13 files changed:
llvm/include/llvm/Support/DataExtractor.h
llvm/lib/Support/DataExtractor.cpp
llvm/test/DebugInfo/X86/dwarfdump-debug-loc-error-cases2.s
llvm/test/DebugInfo/X86/dwarfdump-debug-loclists-error-cases2.s
llvm/test/tools/llvm-dwarfdump/X86/debug_addr_too_small_for_extended_length_field.s
llvm/test/tools/llvm-dwarfdump/X86/debug_addr_too_small_for_length_field.s
llvm/test/tools/llvm-dwarfdump/X86/debug_rnglists_invalid.s
llvm/unittests/DebugInfo/DWARF/DWARFAcceleratorTableTest.cpp
llvm/unittests/DebugInfo/DWARF/DWARFDataExtractorTest.cpp
llvm/unittests/DebugInfo/DWARF/DWARFDebugArangeSetTest.cpp
llvm/unittests/DebugInfo/DWARF/DWARFDebugLineTest.cpp
llvm/unittests/DebugInfo/DWARF/DWARFDieTest.cpp
llvm/unittests/Support/DataExtractorTest.cpp