summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorSpyridoula Gravani <sgravani@apple.com>2017-07-18 01:00:26 +0000
committerSpyridoula Gravani <sgravani@apple.com>2017-07-18 01:00:26 +0000
commit0ea156d8ef9aeced09528be7b80e23b5b034c66b (patch)
tree5b19ca96e8e7cb4546a6babbdb13dbb21236a7fe /include
parentbc231539864f522e8c752c112c9e131ea286cfff (diff)
[DWARF] Modification of code for the verification of .debug_info section.
Summary: This patch modifies the handleDebugInfo() function so that we verify the contents of each unit in the .debug_info section only if its header has been successfully verified. This change will allow for more/different verification checks depending on the type of the unit since from dwarf5, the .debug_info section may consist of different types of units. Subscribers: aprantl Differential Revision: https://reviews.llvm.org/D35521 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@308245 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r--include/llvm/DebugInfo/DWARF/DWARFVerifier.h30
1 files changed, 17 insertions, 13 deletions
diff --git a/include/llvm/DebugInfo/DWARF/DWARFVerifier.h b/include/llvm/DebugInfo/DWARF/DWARFVerifier.h
index d9e0e3aaa65e..c0291a83ed97 100644
--- a/include/llvm/DebugInfo/DWARF/DWARFVerifier.h
+++ b/include/llvm/DebugInfo/DWARF/DWARFVerifier.h
@@ -31,7 +31,6 @@ class DWARFVerifier {
/// can verify each reference points to a valid DIE and not an offset that
/// lies between to valid DIEs.
std::map<uint64_t, std::set<uint32_t>> ReferenceToDIEOffsets;
- uint32_t NumDebugInfoErrors = 0;
uint32_t NumDebugLineErrors = 0;
uint32_t NumAppleNamesErrors = 0;
@@ -50,14 +49,17 @@ class DWARFVerifier {
/// \param Offset A reference to the offset start of the unit. The offset will
/// be updated to point to the next unit in .debug_info
/// \param UnitIndex The index of the unit to be verified
+ /// \param UnitType A reference to the type of the unit
/// \param isUnitDWARF64 A reference to a flag that shows whether the unit is
/// in 64-bit format.
///
/// \returns true if the header is verified successfully, false otherwise.
bool verifyUnitHeader(const DWARFDataExtractor DebugInfoData,
- uint32_t *Offset, unsigned UnitIndex,
+ uint32_t *Offset, unsigned UnitIndex, uint8_t &UnitType,
bool &isUnitDWARF64);
+
+ bool verifyUnitContents(DWARFUnit Unit);
/// Verifies the attribute's DWARF attribute and its value.
///
/// This function currently checks for:
@@ -66,7 +68,11 @@ class DWARFVerifier {
///
/// \param Die The DWARF DIE that owns the attribute value
/// \param AttrValue The DWARF attribute value to check
- void verifyDebugInfoAttribute(const DWARFDie &Die, DWARFAttribute &AttrValue);
+ ///
+ /// \returns NumErrors The number of errors occured during verification of
+ /// attributes' values in a .debug_info section unit
+ unsigned verifyDebugInfoAttribute(const DWARFDie &Die,
+ DWARFAttribute &AttrValue);
/// Verifies the attribute's DWARF form.
///
@@ -77,7 +83,10 @@ class DWARFVerifier {
///
/// \param Die The DWARF DIE that owns the attribute value
/// \param AttrValue The DWARF attribute value to check
- void verifyDebugInfoForm(const DWARFDie &Die, DWARFAttribute &AttrValue);
+ ///
+ /// \returns NumErrors The number of errors occured during verification of
+ /// attributes' forms in a .debug_info section unit
+ unsigned verifyDebugInfoForm(const DWARFDie &Die, DWARFAttribute &AttrValue);
/// Verifies the all valid references that were found when iterating through
/// all of the DIE attributes.
@@ -86,7 +95,10 @@ class DWARFVerifier {
/// offset matches. This helps to ensure if a DWARF link phase moved things
/// around, that it doesn't create invalid references by failing to relocate
/// CU relative and absolute references.
- void verifyDebugInfoReferences();
+ ///
+ /// \returns NumErrors The number of errors occured during verification of
+ /// references for the .debug_info section
+ unsigned verifyDebugInfoReferences();
/// Verify the the DW_AT_stmt_list encoding and value and ensure that no
/// compile units that have the same DW_AT_stmt_list value.
@@ -102,14 +114,6 @@ class DWARFVerifier {
public:
DWARFVerifier(raw_ostream &S, DWARFContext &D)
: OS(S), DCtx(D) {}
- /// Verify the unit header chain in the .debug_info section.
- ///
- /// Any errors are reported to the stream that this object was
- /// constructed with.
- ///
- /// \returns true if the unit header chain verifies successfully, false
- /// otherwise.
- bool handleDebugInfoUnitHeaderChain();
/// Verify the information in the .debug_info section.
///
/// Any errors are reported to the stream that was this object was