Greg Clayton | b8c162b | 2017-05-03 16:02:29 +0000 | [diff] [blame] | 1 | //===- DWARFVerifier.cpp --------------------------------------------------===// |
| 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
| 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
| 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | |
| 10 | #include "llvm/DebugInfo/DWARF/DWARFVerifier.h" |
Jonas Devlieghere | 6921753 | 2018-03-09 09:56:24 +0000 | [diff] [blame] | 11 | #include "llvm/DebugInfo/DWARF/DWARFAcceleratorTable.h" |
Greg Clayton | b8c162b | 2017-05-03 16:02:29 +0000 | [diff] [blame] | 12 | #include "llvm/DebugInfo/DWARF/DWARFCompileUnit.h" |
| 13 | #include "llvm/DebugInfo/DWARF/DWARFContext.h" |
| 14 | #include "llvm/DebugInfo/DWARF/DWARFDebugLine.h" |
| 15 | #include "llvm/DebugInfo/DWARF/DWARFDie.h" |
George Rimar | 144e4c5 | 2017-10-27 10:42:04 +0000 | [diff] [blame] | 16 | #include "llvm/DebugInfo/DWARF/DWARFExpression.h" |
Greg Clayton | b8c162b | 2017-05-03 16:02:29 +0000 | [diff] [blame] | 17 | #include "llvm/DebugInfo/DWARF/DWARFFormValue.h" |
| 18 | #include "llvm/DebugInfo/DWARF/DWARFSection.h" |
George Rimar | 144e4c5 | 2017-10-27 10:42:04 +0000 | [diff] [blame] | 19 | #include "llvm/Support/FormatVariadic.h" |
Jonas Devlieghere | 6921753 | 2018-03-09 09:56:24 +0000 | [diff] [blame] | 20 | #include "llvm/Support/WithColor.h" |
Greg Clayton | b8c162b | 2017-05-03 16:02:29 +0000 | [diff] [blame] | 21 | #include "llvm/Support/raw_ostream.h" |
| 22 | #include <map> |
| 23 | #include <set> |
| 24 | #include <vector> |
| 25 | |
| 26 | using namespace llvm; |
| 27 | using namespace dwarf; |
| 28 | using namespace object; |
| 29 | |
Jonas Devlieghere | 5891060 | 2017-09-14 11:33:42 +0000 | [diff] [blame] | 30 | DWARFVerifier::DieRangeInfo::address_range_iterator |
| 31 | DWARFVerifier::DieRangeInfo::insert(const DWARFAddressRange &R) { |
| 32 | auto Begin = Ranges.begin(); |
| 33 | auto End = Ranges.end(); |
| 34 | auto Pos = std::lower_bound(Begin, End, R); |
| 35 | |
| 36 | if (Pos != End) { |
| 37 | if (Pos->intersects(R)) |
| 38 | return Pos; |
| 39 | if (Pos != Begin) { |
| 40 | auto Iter = Pos - 1; |
| 41 | if (Iter->intersects(R)) |
| 42 | return Iter; |
| 43 | } |
| 44 | } |
| 45 | |
| 46 | Ranges.insert(Pos, R); |
| 47 | return Ranges.end(); |
| 48 | } |
| 49 | |
| 50 | DWARFVerifier::DieRangeInfo::die_range_info_iterator |
| 51 | DWARFVerifier::DieRangeInfo::insert(const DieRangeInfo &RI) { |
| 52 | auto End = Children.end(); |
| 53 | auto Iter = Children.begin(); |
| 54 | while (Iter != End) { |
| 55 | if (Iter->intersects(RI)) |
| 56 | return Iter; |
| 57 | ++Iter; |
| 58 | } |
| 59 | Children.insert(RI); |
| 60 | return Children.end(); |
| 61 | } |
| 62 | |
| 63 | bool DWARFVerifier::DieRangeInfo::contains(const DieRangeInfo &RHS) const { |
| 64 | // Both list of ranges are sorted so we can make this fast. |
| 65 | |
| 66 | if (Ranges.empty() || RHS.Ranges.empty()) |
| 67 | return false; |
| 68 | |
| 69 | // Since the ranges are sorted we can advance where we start searching with |
| 70 | // this object's ranges as we traverse RHS.Ranges. |
| 71 | auto End = Ranges.end(); |
| 72 | auto Iter = findRange(RHS.Ranges.front()); |
| 73 | |
| 74 | // Now linearly walk the ranges in this object and see if they contain each |
| 75 | // ranges from RHS.Ranges. |
| 76 | for (const auto &R : RHS.Ranges) { |
| 77 | while (Iter != End) { |
| 78 | if (Iter->contains(R)) |
| 79 | break; |
| 80 | ++Iter; |
| 81 | } |
| 82 | if (Iter == End) |
| 83 | return false; |
| 84 | } |
| 85 | return true; |
| 86 | } |
| 87 | |
| 88 | bool DWARFVerifier::DieRangeInfo::intersects(const DieRangeInfo &RHS) const { |
| 89 | if (Ranges.empty() || RHS.Ranges.empty()) |
| 90 | return false; |
| 91 | |
| 92 | auto End = Ranges.end(); |
| 93 | auto Iter = findRange(RHS.Ranges.front()); |
| 94 | for (const auto &R : RHS.Ranges) { |
Jonas Devlieghere | d585a20 | 2017-09-14 17:46:23 +0000 | [diff] [blame] | 95 | if(Iter == End) |
| 96 | return false; |
Jonas Devlieghere | 5891060 | 2017-09-14 11:33:42 +0000 | [diff] [blame] | 97 | if (R.HighPC <= Iter->LowPC) |
| 98 | continue; |
| 99 | while (Iter != End) { |
| 100 | if (Iter->intersects(R)) |
| 101 | return true; |
| 102 | ++Iter; |
| 103 | } |
| 104 | } |
| 105 | |
| 106 | return false; |
| 107 | } |
| 108 | |
Spyridoula Gravani | 890eedc | 2017-07-13 23:25:24 +0000 | [diff] [blame] | 109 | bool DWARFVerifier::verifyUnitHeader(const DWARFDataExtractor DebugInfoData, |
Spyridoula Gravani | f6bd788d | 2017-07-18 01:00:26 +0000 | [diff] [blame] | 110 | uint32_t *Offset, unsigned UnitIndex, |
| 111 | uint8_t &UnitType, bool &isUnitDWARF64) { |
Spyridoula Gravani | 890eedc | 2017-07-13 23:25:24 +0000 | [diff] [blame] | 112 | uint32_t AbbrOffset, Length; |
Spyridoula Gravani | f6bd788d | 2017-07-18 01:00:26 +0000 | [diff] [blame] | 113 | uint8_t AddrSize = 0; |
Spyridoula Gravani | 890eedc | 2017-07-13 23:25:24 +0000 | [diff] [blame] | 114 | uint16_t Version; |
| 115 | bool Success = true; |
Spyridoula Gravani | 890eedc | 2017-07-13 23:25:24 +0000 | [diff] [blame] | 116 | |
| 117 | bool ValidLength = false; |
| 118 | bool ValidVersion = false; |
| 119 | bool ValidAddrSize = false; |
| 120 | bool ValidType = true; |
| 121 | bool ValidAbbrevOffset = true; |
| 122 | |
| 123 | uint32_t OffsetStart = *Offset; |
| 124 | Length = DebugInfoData.getU32(Offset); |
| 125 | if (Length == UINT32_MAX) { |
| 126 | isUnitDWARF64 = true; |
| 127 | OS << format( |
| 128 | "Unit[%d] is in 64-bit DWARF format; cannot verify from this point.\n", |
| 129 | UnitIndex); |
| 130 | return false; |
| 131 | } |
| 132 | Version = DebugInfoData.getU16(Offset); |
| 133 | |
| 134 | if (Version >= 5) { |
| 135 | UnitType = DebugInfoData.getU8(Offset); |
| 136 | AddrSize = DebugInfoData.getU8(Offset); |
| 137 | AbbrOffset = DebugInfoData.getU32(Offset); |
Jonas Devlieghere | f2fa9eb | 2017-10-06 22:27:31 +0000 | [diff] [blame] | 138 | ValidType = dwarf::isUnitType(UnitType); |
Spyridoula Gravani | 890eedc | 2017-07-13 23:25:24 +0000 | [diff] [blame] | 139 | } else { |
Spyridoula Gravani | f6bd788d | 2017-07-18 01:00:26 +0000 | [diff] [blame] | 140 | UnitType = 0; |
Spyridoula Gravani | 890eedc | 2017-07-13 23:25:24 +0000 | [diff] [blame] | 141 | AbbrOffset = DebugInfoData.getU32(Offset); |
| 142 | AddrSize = DebugInfoData.getU8(Offset); |
| 143 | } |
| 144 | |
| 145 | if (!DCtx.getDebugAbbrev()->getAbbreviationDeclarationSet(AbbrOffset)) |
| 146 | ValidAbbrevOffset = false; |
| 147 | |
| 148 | ValidLength = DebugInfoData.isValidOffset(OffsetStart + Length + 3); |
| 149 | ValidVersion = DWARFContext::isSupportedVersion(Version); |
| 150 | ValidAddrSize = AddrSize == 4 || AddrSize == 8; |
| 151 | if (!ValidLength || !ValidVersion || !ValidAddrSize || !ValidAbbrevOffset || |
| 152 | !ValidType) { |
| 153 | Success = false; |
Jonas Devlieghere | 19fc4d9 | 2017-09-29 09:33:31 +0000 | [diff] [blame] | 154 | error() << format("Units[%d] - start offset: 0x%08x \n", UnitIndex, |
| 155 | OffsetStart); |
Spyridoula Gravani | 890eedc | 2017-07-13 23:25:24 +0000 | [diff] [blame] | 156 | if (!ValidLength) |
Jonas Devlieghere | 19fc4d9 | 2017-09-29 09:33:31 +0000 | [diff] [blame] | 157 | note() << "The length for this unit is too " |
Spyridoula Gravani | 890eedc | 2017-07-13 23:25:24 +0000 | [diff] [blame] | 158 | "large for the .debug_info provided.\n"; |
| 159 | if (!ValidVersion) |
Jonas Devlieghere | 19fc4d9 | 2017-09-29 09:33:31 +0000 | [diff] [blame] | 160 | note() << "The 16 bit unit header version is not valid.\n"; |
Spyridoula Gravani | 890eedc | 2017-07-13 23:25:24 +0000 | [diff] [blame] | 161 | if (!ValidType) |
Jonas Devlieghere | 19fc4d9 | 2017-09-29 09:33:31 +0000 | [diff] [blame] | 162 | note() << "The unit type encoding is not valid.\n"; |
Spyridoula Gravani | 890eedc | 2017-07-13 23:25:24 +0000 | [diff] [blame] | 163 | if (!ValidAbbrevOffset) |
Jonas Devlieghere | 19fc4d9 | 2017-09-29 09:33:31 +0000 | [diff] [blame] | 164 | note() << "The offset into the .debug_abbrev section is " |
Spyridoula Gravani | 890eedc | 2017-07-13 23:25:24 +0000 | [diff] [blame] | 165 | "not valid.\n"; |
| 166 | if (!ValidAddrSize) |
Jonas Devlieghere | 19fc4d9 | 2017-09-29 09:33:31 +0000 | [diff] [blame] | 167 | note() << "The address size is unsupported.\n"; |
Spyridoula Gravani | 890eedc | 2017-07-13 23:25:24 +0000 | [diff] [blame] | 168 | } |
| 169 | *Offset = OffsetStart + Length + 4; |
| 170 | return Success; |
| 171 | } |
| 172 | |
Jonas Devlieghere | f2fa9eb | 2017-10-06 22:27:31 +0000 | [diff] [blame] | 173 | bool DWARFVerifier::verifyUnitContents(DWARFUnit Unit, uint8_t UnitType) { |
Spyridoula Gravani | f6bd788d | 2017-07-18 01:00:26 +0000 | [diff] [blame] | 174 | uint32_t NumUnitErrors = 0; |
| 175 | unsigned NumDies = Unit.getNumDIEs(); |
| 176 | for (unsigned I = 0; I < NumDies; ++I) { |
| 177 | auto Die = Unit.getDIEAtIndex(I); |
| 178 | if (Die.getTag() == DW_TAG_null) |
| 179 | continue; |
| 180 | for (auto AttrValue : Die.attributes()) { |
| 181 | NumUnitErrors += verifyDebugInfoAttribute(Die, AttrValue); |
| 182 | NumUnitErrors += verifyDebugInfoForm(Die, AttrValue); |
| 183 | } |
| 184 | } |
Jonas Devlieghere | 5891060 | 2017-09-14 11:33:42 +0000 | [diff] [blame] | 185 | |
Jonas Devlieghere | f2fa9eb | 2017-10-06 22:27:31 +0000 | [diff] [blame] | 186 | DWARFDie Die = Unit.getUnitDIE(/* ExtractUnitDIEOnly = */ false); |
| 187 | if (!Die) { |
| 188 | error() << "Compilation unit without DIE.\n"; |
| 189 | NumUnitErrors++; |
| 190 | return NumUnitErrors == 0; |
| 191 | } |
| 192 | |
| 193 | if (!dwarf::isUnitType(Die.getTag())) { |
| 194 | error() << "Compilation unit root DIE is not a unit DIE: " |
| 195 | << dwarf::TagString(Die.getTag()) << ".\n"; |
Jonas Devlieghere | 35fdaa9 | 2017-09-28 15:57:50 +0000 | [diff] [blame] | 196 | NumUnitErrors++; |
| 197 | } |
| 198 | |
Jonas Devlieghere | f2fa9eb | 2017-10-06 22:27:31 +0000 | [diff] [blame] | 199 | if (UnitType != 0 && |
| 200 | !DWARFUnit::isMatchingUnitTypeAndTag(UnitType, Die.getTag())) { |
| 201 | error() << "Compilation unit type (" << dwarf::UnitTypeString(UnitType) |
| 202 | << ") and root DIE (" << dwarf::TagString(Die.getTag()) |
| 203 | << ") do not match.\n"; |
| 204 | NumUnitErrors++; |
| 205 | } |
| 206 | |
| 207 | DieRangeInfo RI; |
| 208 | NumUnitErrors += verifyDieRanges(Die, RI); |
| 209 | |
Spyridoula Gravani | f6bd788d | 2017-07-18 01:00:26 +0000 | [diff] [blame] | 210 | return NumUnitErrors == 0; |
| 211 | } |
| 212 | |
Spyridoula Gravani | c6ef987 | 2017-07-21 00:51:32 +0000 | [diff] [blame] | 213 | unsigned DWARFVerifier::verifyAbbrevSection(const DWARFDebugAbbrev *Abbrev) { |
Spyridoula Gravani | 364b535 | 2017-07-20 02:06:52 +0000 | [diff] [blame] | 214 | unsigned NumErrors = 0; |
Spyridoula Gravani | 364b535 | 2017-07-20 02:06:52 +0000 | [diff] [blame] | 215 | if (Abbrev) { |
| 216 | const DWARFAbbreviationDeclarationSet *AbbrDecls = |
| 217 | Abbrev->getAbbreviationDeclarationSet(0); |
| 218 | for (auto AbbrDecl : *AbbrDecls) { |
| 219 | SmallDenseSet<uint16_t> AttributeSet; |
| 220 | for (auto Attribute : AbbrDecl.attributes()) { |
| 221 | auto Result = AttributeSet.insert(Attribute.Attr); |
| 222 | if (!Result.second) { |
Jonas Devlieghere | 19fc4d9 | 2017-09-29 09:33:31 +0000 | [diff] [blame] | 223 | error() << "Abbreviation declaration contains multiple " |
| 224 | << AttributeString(Attribute.Attr) << " attributes.\n"; |
Spyridoula Gravani | c6ef987 | 2017-07-21 00:51:32 +0000 | [diff] [blame] | 225 | AbbrDecl.dump(OS); |
Spyridoula Gravani | 364b535 | 2017-07-20 02:06:52 +0000 | [diff] [blame] | 226 | ++NumErrors; |
| 227 | } |
| 228 | } |
| 229 | } |
| 230 | } |
Spyridoula Gravani | c6ef987 | 2017-07-21 00:51:32 +0000 | [diff] [blame] | 231 | return NumErrors; |
| 232 | } |
| 233 | |
| 234 | bool DWARFVerifier::handleDebugAbbrev() { |
| 235 | OS << "Verifying .debug_abbrev...\n"; |
| 236 | |
| 237 | const DWARFObject &DObj = DCtx.getDWARFObj(); |
| 238 | bool noDebugAbbrev = DObj.getAbbrevSection().empty(); |
| 239 | bool noDebugAbbrevDWO = DObj.getAbbrevDWOSection().empty(); |
| 240 | |
| 241 | if (noDebugAbbrev && noDebugAbbrevDWO) { |
| 242 | return true; |
| 243 | } |
| 244 | |
| 245 | unsigned NumErrors = 0; |
| 246 | if (!noDebugAbbrev) |
| 247 | NumErrors += verifyAbbrevSection(DCtx.getDebugAbbrev()); |
| 248 | |
| 249 | if (!noDebugAbbrevDWO) |
| 250 | NumErrors += verifyAbbrevSection(DCtx.getDebugAbbrevDWO()); |
Spyridoula Gravani | 364b535 | 2017-07-20 02:06:52 +0000 | [diff] [blame] | 251 | return NumErrors == 0; |
| 252 | } |
| 253 | |
Spyridoula Gravani | f6bd788d | 2017-07-18 01:00:26 +0000 | [diff] [blame] | 254 | bool DWARFVerifier::handleDebugInfo() { |
Spyridoula Gravani | 890eedc | 2017-07-13 23:25:24 +0000 | [diff] [blame] | 255 | OS << "Verifying .debug_info Unit Header Chain...\n"; |
| 256 | |
Rafael Espindola | c398e67 | 2017-07-19 22:27:28 +0000 | [diff] [blame] | 257 | const DWARFObject &DObj = DCtx.getDWARFObj(); |
| 258 | DWARFDataExtractor DebugInfoData(DObj, DObj.getInfoSection(), |
| 259 | DCtx.isLittleEndian(), 0); |
Spyridoula Gravani | f6bd788d | 2017-07-18 01:00:26 +0000 | [diff] [blame] | 260 | uint32_t NumDebugInfoErrors = 0; |
| 261 | uint32_t OffsetStart = 0, Offset = 0, UnitIdx = 0; |
| 262 | uint8_t UnitType = 0; |
Spyridoula Gravani | 890eedc | 2017-07-13 23:25:24 +0000 | [diff] [blame] | 263 | bool isUnitDWARF64 = false; |
Spyridoula Gravani | f6bd788d | 2017-07-18 01:00:26 +0000 | [diff] [blame] | 264 | bool isHeaderChainValid = true; |
Spyridoula Gravani | 890eedc | 2017-07-13 23:25:24 +0000 | [diff] [blame] | 265 | bool hasDIE = DebugInfoData.isValidOffset(Offset); |
Jonas Devlieghere | aa6be82 | 2017-10-10 14:15:25 +0000 | [diff] [blame] | 266 | DWARFUnitSection<DWARFTypeUnit> TUSection{}; |
| 267 | DWARFUnitSection<DWARFCompileUnit> CUSection{}; |
Spyridoula Gravani | 890eedc | 2017-07-13 23:25:24 +0000 | [diff] [blame] | 268 | while (hasDIE) { |
Spyridoula Gravani | f6bd788d | 2017-07-18 01:00:26 +0000 | [diff] [blame] | 269 | OffsetStart = Offset; |
| 270 | if (!verifyUnitHeader(DebugInfoData, &Offset, UnitIdx, UnitType, |
| 271 | isUnitDWARF64)) { |
| 272 | isHeaderChainValid = false; |
Spyridoula Gravani | 890eedc | 2017-07-13 23:25:24 +0000 | [diff] [blame] | 273 | if (isUnitDWARF64) |
| 274 | break; |
Spyridoula Gravani | f6bd788d | 2017-07-18 01:00:26 +0000 | [diff] [blame] | 275 | } else { |
| 276 | std::unique_ptr<DWARFUnit> Unit; |
| 277 | switch (UnitType) { |
| 278 | case dwarf::DW_UT_type: |
| 279 | case dwarf::DW_UT_split_type: { |
Spyridoula Gravani | f6bd788d | 2017-07-18 01:00:26 +0000 | [diff] [blame] | 280 | Unit.reset(new DWARFTypeUnit( |
Rafael Espindola | c398e67 | 2017-07-19 22:27:28 +0000 | [diff] [blame] | 281 | DCtx, DObj.getInfoSection(), DCtx.getDebugAbbrev(), |
| 282 | &DObj.getRangeSection(), DObj.getStringSection(), |
| 283 | DObj.getStringOffsetSection(), &DObj.getAppleObjCSection(), |
Paul Robinson | d0c89f8 | 2018-01-29 22:02:56 +0000 | [diff] [blame] | 284 | DObj.getLineSection(), DCtx.isLittleEndian(), false, TUSection, |
| 285 | nullptr)); |
Spyridoula Gravani | f6bd788d | 2017-07-18 01:00:26 +0000 | [diff] [blame] | 286 | break; |
| 287 | } |
| 288 | case dwarf::DW_UT_skeleton: |
| 289 | case dwarf::DW_UT_split_compile: |
| 290 | case dwarf::DW_UT_compile: |
| 291 | case dwarf::DW_UT_partial: |
| 292 | // UnitType = 0 means that we are |
| 293 | // verifying a compile unit in DWARF v4. |
| 294 | case 0: { |
Spyridoula Gravani | f6bd788d | 2017-07-18 01:00:26 +0000 | [diff] [blame] | 295 | Unit.reset(new DWARFCompileUnit( |
Rafael Espindola | c398e67 | 2017-07-19 22:27:28 +0000 | [diff] [blame] | 296 | DCtx, DObj.getInfoSection(), DCtx.getDebugAbbrev(), |
| 297 | &DObj.getRangeSection(), DObj.getStringSection(), |
| 298 | DObj.getStringOffsetSection(), &DObj.getAppleObjCSection(), |
Paul Robinson | d0c89f8 | 2018-01-29 22:02:56 +0000 | [diff] [blame] | 299 | DObj.getLineSection(), DCtx.isLittleEndian(), false, CUSection, |
| 300 | nullptr)); |
Spyridoula Gravani | f6bd788d | 2017-07-18 01:00:26 +0000 | [diff] [blame] | 301 | break; |
| 302 | } |
| 303 | default: { llvm_unreachable("Invalid UnitType."); } |
| 304 | } |
| 305 | Unit->extract(DebugInfoData, &OffsetStart); |
Jonas Devlieghere | f2fa9eb | 2017-10-06 22:27:31 +0000 | [diff] [blame] | 306 | if (!verifyUnitContents(*Unit, UnitType)) |
Spyridoula Gravani | f6bd788d | 2017-07-18 01:00:26 +0000 | [diff] [blame] | 307 | ++NumDebugInfoErrors; |
Spyridoula Gravani | 890eedc | 2017-07-13 23:25:24 +0000 | [diff] [blame] | 308 | } |
| 309 | hasDIE = DebugInfoData.isValidOffset(Offset); |
| 310 | ++UnitIdx; |
| 311 | } |
| 312 | if (UnitIdx == 0 && !hasDIE) { |
Jonas Devlieghere | 19fc4d9 | 2017-09-29 09:33:31 +0000 | [diff] [blame] | 313 | warn() << ".debug_info is empty.\n"; |
Spyridoula Gravani | f6bd788d | 2017-07-18 01:00:26 +0000 | [diff] [blame] | 314 | isHeaderChainValid = true; |
Spyridoula Gravani | 890eedc | 2017-07-13 23:25:24 +0000 | [diff] [blame] | 315 | } |
Spyridoula Gravani | f6bd788d | 2017-07-18 01:00:26 +0000 | [diff] [blame] | 316 | NumDebugInfoErrors += verifyDebugInfoReferences(); |
| 317 | return (isHeaderChainValid && NumDebugInfoErrors == 0); |
Spyridoula Gravani | 890eedc | 2017-07-13 23:25:24 +0000 | [diff] [blame] | 318 | } |
| 319 | |
Jonas Devlieghere | 5891060 | 2017-09-14 11:33:42 +0000 | [diff] [blame] | 320 | unsigned DWARFVerifier::verifyDieRanges(const DWARFDie &Die, |
| 321 | DieRangeInfo &ParentRI) { |
Spyridoula Gravani | e0ba415 | 2017-07-24 21:04:11 +0000 | [diff] [blame] | 322 | unsigned NumErrors = 0; |
Jonas Devlieghere | 5891060 | 2017-09-14 11:33:42 +0000 | [diff] [blame] | 323 | |
| 324 | if (!Die.isValid()) |
| 325 | return NumErrors; |
| 326 | |
| 327 | DWARFAddressRangesVector Ranges = Die.getAddressRanges(); |
| 328 | |
| 329 | // Build RI for this DIE and check that ranges within this DIE do not |
| 330 | // overlap. |
| 331 | DieRangeInfo RI(Die); |
| 332 | for (auto Range : Ranges) { |
| 333 | if (!Range.valid()) { |
Spyridoula Gravani | e0ba415 | 2017-07-24 21:04:11 +0000 | [diff] [blame] | 334 | ++NumErrors; |
Jonas Devlieghere | a15f25d3 | 2017-09-29 15:41:22 +0000 | [diff] [blame] | 335 | error() << "Invalid address range " << Range << "\n"; |
Jonas Devlieghere | 5891060 | 2017-09-14 11:33:42 +0000 | [diff] [blame] | 336 | continue; |
| 337 | } |
| 338 | |
| 339 | // Verify that ranges don't intersect. |
| 340 | const auto IntersectingRange = RI.insert(Range); |
| 341 | if (IntersectingRange != RI.Ranges.end()) { |
| 342 | ++NumErrors; |
Jonas Devlieghere | a15f25d3 | 2017-09-29 15:41:22 +0000 | [diff] [blame] | 343 | error() << "DIE has overlapping address ranges: " << Range << " and " |
| 344 | << *IntersectingRange << "\n"; |
Jonas Devlieghere | 5891060 | 2017-09-14 11:33:42 +0000 | [diff] [blame] | 345 | break; |
Spyridoula Gravani | e0ba415 | 2017-07-24 21:04:11 +0000 | [diff] [blame] | 346 | } |
| 347 | } |
Jonas Devlieghere | 5891060 | 2017-09-14 11:33:42 +0000 | [diff] [blame] | 348 | |
| 349 | // Verify that children don't intersect. |
| 350 | const auto IntersectingChild = ParentRI.insert(RI); |
| 351 | if (IntersectingChild != ParentRI.Children.end()) { |
| 352 | ++NumErrors; |
Jonas Devlieghere | 19fc4d9 | 2017-09-29 09:33:31 +0000 | [diff] [blame] | 353 | error() << "DIEs have overlapping address ranges:"; |
Jonas Devlieghere | 5891060 | 2017-09-14 11:33:42 +0000 | [diff] [blame] | 354 | Die.dump(OS, 0); |
| 355 | IntersectingChild->Die.dump(OS, 0); |
| 356 | OS << "\n"; |
| 357 | } |
| 358 | |
| 359 | // Verify that ranges are contained within their parent. |
| 360 | bool ShouldBeContained = !Ranges.empty() && !ParentRI.Ranges.empty() && |
| 361 | !(Die.getTag() == DW_TAG_subprogram && |
| 362 | ParentRI.Die.getTag() == DW_TAG_subprogram); |
| 363 | if (ShouldBeContained && !ParentRI.contains(RI)) { |
| 364 | ++NumErrors; |
Jonas Devlieghere | 19fc4d9 | 2017-09-29 09:33:31 +0000 | [diff] [blame] | 365 | error() << "DIE address ranges are not " |
| 366 | "contained in its parent's ranges:"; |
Jonas Devlieghere | 5891060 | 2017-09-14 11:33:42 +0000 | [diff] [blame] | 367 | Die.dump(OS, 0); |
| 368 | ParentRI.Die.dump(OS, 0); |
| 369 | OS << "\n"; |
| 370 | } |
| 371 | |
| 372 | // Recursively check children. |
| 373 | for (DWARFDie Child : Die) |
| 374 | NumErrors += verifyDieRanges(Child, RI); |
| 375 | |
Spyridoula Gravani | e0ba415 | 2017-07-24 21:04:11 +0000 | [diff] [blame] | 376 | return NumErrors; |
| 377 | } |
| 378 | |
Spyridoula Gravani | f6bd788d | 2017-07-18 01:00:26 +0000 | [diff] [blame] | 379 | unsigned DWARFVerifier::verifyDebugInfoAttribute(const DWARFDie &Die, |
| 380 | DWARFAttribute &AttrValue) { |
| 381 | unsigned NumErrors = 0; |
George Rimar | 144e4c5 | 2017-10-27 10:42:04 +0000 | [diff] [blame] | 382 | auto ReportError = [&](const Twine &TitleMsg) { |
| 383 | ++NumErrors; |
| 384 | error() << TitleMsg << '\n'; |
| 385 | Die.dump(OS, 0, DumpOpts); |
| 386 | OS << "\n"; |
| 387 | }; |
| 388 | |
| 389 | const DWARFObject &DObj = DCtx.getDWARFObj(); |
Greg Clayton | c5b2d56 | 2017-05-03 18:25:46 +0000 | [diff] [blame] | 390 | const auto Attr = AttrValue.Attr; |
| 391 | switch (Attr) { |
| 392 | case DW_AT_ranges: |
| 393 | // Make sure the offset in the DW_AT_ranges attribute is valid. |
| 394 | if (auto SectionOffset = AttrValue.Value.getAsSectionOffset()) { |
George Rimar | 144e4c5 | 2017-10-27 10:42:04 +0000 | [diff] [blame] | 395 | if (*SectionOffset >= DObj.getRangeSection().Data.size()) |
| 396 | ReportError("DW_AT_ranges offset is beyond .debug_ranges bounds:"); |
| 397 | break; |
Greg Clayton | c5b2d56 | 2017-05-03 18:25:46 +0000 | [diff] [blame] | 398 | } |
George Rimar | 144e4c5 | 2017-10-27 10:42:04 +0000 | [diff] [blame] | 399 | ReportError("DIE has invalid DW_AT_ranges encoding:"); |
Greg Clayton | c5b2d56 | 2017-05-03 18:25:46 +0000 | [diff] [blame] | 400 | break; |
| 401 | case DW_AT_stmt_list: |
| 402 | // Make sure the offset in the DW_AT_stmt_list attribute is valid. |
| 403 | if (auto SectionOffset = AttrValue.Value.getAsSectionOffset()) { |
George Rimar | 144e4c5 | 2017-10-27 10:42:04 +0000 | [diff] [blame] | 404 | if (*SectionOffset >= DObj.getLineSection().Data.size()) |
| 405 | ReportError("DW_AT_stmt_list offset is beyond .debug_line bounds: " + |
George Rimar | 3d07f60 | 2017-10-27 10:58:04 +0000 | [diff] [blame] | 406 | llvm::formatv("{0:x8}", *SectionOffset)); |
George Rimar | 144e4c5 | 2017-10-27 10:42:04 +0000 | [diff] [blame] | 407 | break; |
Greg Clayton | c5b2d56 | 2017-05-03 18:25:46 +0000 | [diff] [blame] | 408 | } |
George Rimar | 144e4c5 | 2017-10-27 10:42:04 +0000 | [diff] [blame] | 409 | ReportError("DIE has invalid DW_AT_stmt_list encoding:"); |
Greg Clayton | c5b2d56 | 2017-05-03 18:25:46 +0000 | [diff] [blame] | 410 | break; |
George Rimar | 144e4c5 | 2017-10-27 10:42:04 +0000 | [diff] [blame] | 411 | case DW_AT_location: { |
Jonas Devlieghere | 7d4a974 | 2018-02-17 13:06:37 +0000 | [diff] [blame] | 412 | auto VerifyLocation = [&](StringRef D) { |
| 413 | DWARFUnit *U = Die.getDwarfUnit(); |
| 414 | DataExtractor Data(D, DCtx.isLittleEndian(), 0); |
| 415 | DWARFExpression Expression(Data, U->getVersion(), |
| 416 | U->getAddressByteSize()); |
| 417 | bool Error = llvm::any_of(Expression, [](DWARFExpression::Operation &Op) { |
| 418 | return Op.isError(); |
| 419 | }); |
| 420 | if (Error) |
| 421 | ReportError("DIE contains invalid DWARF expression:"); |
| 422 | }; |
| 423 | if (Optional<ArrayRef<uint8_t>> Expr = AttrValue.Value.getAsBlock()) { |
| 424 | // Verify inlined location. |
| 425 | VerifyLocation(llvm::toStringRef(*Expr)); |
| 426 | } else if (auto LocOffset = AttrValue.Value.getAsUnsignedConstant()) { |
| 427 | // Verify location list. |
| 428 | if (auto DebugLoc = DCtx.getDebugLoc()) |
| 429 | if (auto LocList = DebugLoc->getLocationListAtOffset(*LocOffset)) |
| 430 | for (const auto &Entry : LocList->Entries) |
| 431 | VerifyLocation({Entry.Loc.data(), Entry.Loc.size()}); |
George Rimar | 144e4c5 | 2017-10-27 10:42:04 +0000 | [diff] [blame] | 432 | } |
George Rimar | 144e4c5 | 2017-10-27 10:42:04 +0000 | [diff] [blame] | 433 | break; |
| 434 | } |
Greg Clayton | b8c162b | 2017-05-03 16:02:29 +0000 | [diff] [blame] | 435 | |
Greg Clayton | c5b2d56 | 2017-05-03 18:25:46 +0000 | [diff] [blame] | 436 | default: |
| 437 | break; |
| 438 | } |
Spyridoula Gravani | f6bd788d | 2017-07-18 01:00:26 +0000 | [diff] [blame] | 439 | return NumErrors; |
Greg Clayton | c5b2d56 | 2017-05-03 18:25:46 +0000 | [diff] [blame] | 440 | } |
Greg Clayton | b8c162b | 2017-05-03 16:02:29 +0000 | [diff] [blame] | 441 | |
Spyridoula Gravani | f6bd788d | 2017-07-18 01:00:26 +0000 | [diff] [blame] | 442 | unsigned DWARFVerifier::verifyDebugInfoForm(const DWARFDie &Die, |
| 443 | DWARFAttribute &AttrValue) { |
Rafael Espindola | c398e67 | 2017-07-19 22:27:28 +0000 | [diff] [blame] | 444 | const DWARFObject &DObj = DCtx.getDWARFObj(); |
Spyridoula Gravani | f6bd788d | 2017-07-18 01:00:26 +0000 | [diff] [blame] | 445 | unsigned NumErrors = 0; |
Greg Clayton | c5b2d56 | 2017-05-03 18:25:46 +0000 | [diff] [blame] | 446 | const auto Form = AttrValue.Value.getForm(); |
| 447 | switch (Form) { |
| 448 | case DW_FORM_ref1: |
| 449 | case DW_FORM_ref2: |
| 450 | case DW_FORM_ref4: |
| 451 | case DW_FORM_ref8: |
| 452 | case DW_FORM_ref_udata: { |
| 453 | // Verify all CU relative references are valid CU offsets. |
| 454 | Optional<uint64_t> RefVal = AttrValue.Value.getAsReference(); |
| 455 | assert(RefVal); |
| 456 | if (RefVal) { |
| 457 | auto DieCU = Die.getDwarfUnit(); |
| 458 | auto CUSize = DieCU->getNextUnitOffset() - DieCU->getOffset(); |
| 459 | auto CUOffset = AttrValue.Value.getRawUValue(); |
| 460 | if (CUOffset >= CUSize) { |
Spyridoula Gravani | f6bd788d | 2017-07-18 01:00:26 +0000 | [diff] [blame] | 461 | ++NumErrors; |
Jonas Devlieghere | 19fc4d9 | 2017-09-29 09:33:31 +0000 | [diff] [blame] | 462 | error() << FormEncodingString(Form) << " CU offset " |
| 463 | << format("0x%08" PRIx64, CUOffset) |
| 464 | << " is invalid (must be less than CU size of " |
| 465 | << format("0x%08" PRIx32, CUSize) << "):\n"; |
Adrian Prantl | d3f9f21 | 2017-09-20 17:44:00 +0000 | [diff] [blame] | 466 | Die.dump(OS, 0, DumpOpts); |
Greg Clayton | c5b2d56 | 2017-05-03 18:25:46 +0000 | [diff] [blame] | 467 | OS << "\n"; |
| 468 | } else { |
| 469 | // Valid reference, but we will verify it points to an actual |
| 470 | // DIE later. |
| 471 | ReferenceToDIEOffsets[*RefVal].insert(Die.getOffset()); |
Greg Clayton | b8c162b | 2017-05-03 16:02:29 +0000 | [diff] [blame] | 472 | } |
| 473 | } |
Greg Clayton | c5b2d56 | 2017-05-03 18:25:46 +0000 | [diff] [blame] | 474 | break; |
Greg Clayton | b8c162b | 2017-05-03 16:02:29 +0000 | [diff] [blame] | 475 | } |
Greg Clayton | c5b2d56 | 2017-05-03 18:25:46 +0000 | [diff] [blame] | 476 | case DW_FORM_ref_addr: { |
| 477 | // Verify all absolute DIE references have valid offsets in the |
| 478 | // .debug_info section. |
| 479 | Optional<uint64_t> RefVal = AttrValue.Value.getAsReference(); |
| 480 | assert(RefVal); |
| 481 | if (RefVal) { |
Rafael Espindola | c398e67 | 2017-07-19 22:27:28 +0000 | [diff] [blame] | 482 | if (*RefVal >= DObj.getInfoSection().Data.size()) { |
Spyridoula Gravani | f6bd788d | 2017-07-18 01:00:26 +0000 | [diff] [blame] | 483 | ++NumErrors; |
Jonas Devlieghere | 19fc4d9 | 2017-09-29 09:33:31 +0000 | [diff] [blame] | 484 | error() << "DW_FORM_ref_addr offset beyond .debug_info " |
| 485 | "bounds:\n"; |
Adrian Prantl | d3f9f21 | 2017-09-20 17:44:00 +0000 | [diff] [blame] | 486 | Die.dump(OS, 0, DumpOpts); |
Greg Clayton | c5b2d56 | 2017-05-03 18:25:46 +0000 | [diff] [blame] | 487 | OS << "\n"; |
| 488 | } else { |
| 489 | // Valid reference, but we will verify it points to an actual |
| 490 | // DIE later. |
| 491 | ReferenceToDIEOffsets[*RefVal].insert(Die.getOffset()); |
| 492 | } |
| 493 | } |
| 494 | break; |
| 495 | } |
| 496 | case DW_FORM_strp: { |
| 497 | auto SecOffset = AttrValue.Value.getAsSectionOffset(); |
| 498 | assert(SecOffset); // DW_FORM_strp is a section offset. |
Rafael Espindola | c398e67 | 2017-07-19 22:27:28 +0000 | [diff] [blame] | 499 | if (SecOffset && *SecOffset >= DObj.getStringSection().size()) { |
Spyridoula Gravani | f6bd788d | 2017-07-18 01:00:26 +0000 | [diff] [blame] | 500 | ++NumErrors; |
Jonas Devlieghere | 19fc4d9 | 2017-09-29 09:33:31 +0000 | [diff] [blame] | 501 | error() << "DW_FORM_strp offset beyond .debug_str bounds:\n"; |
Adrian Prantl | d3f9f21 | 2017-09-20 17:44:00 +0000 | [diff] [blame] | 502 | Die.dump(OS, 0, DumpOpts); |
Greg Clayton | c5b2d56 | 2017-05-03 18:25:46 +0000 | [diff] [blame] | 503 | OS << "\n"; |
| 504 | } |
| 505 | break; |
| 506 | } |
| 507 | default: |
| 508 | break; |
| 509 | } |
Spyridoula Gravani | f6bd788d | 2017-07-18 01:00:26 +0000 | [diff] [blame] | 510 | return NumErrors; |
Greg Clayton | c5b2d56 | 2017-05-03 18:25:46 +0000 | [diff] [blame] | 511 | } |
Greg Clayton | b8c162b | 2017-05-03 16:02:29 +0000 | [diff] [blame] | 512 | |
Spyridoula Gravani | f6bd788d | 2017-07-18 01:00:26 +0000 | [diff] [blame] | 513 | unsigned DWARFVerifier::verifyDebugInfoReferences() { |
Greg Clayton | b8c162b | 2017-05-03 16:02:29 +0000 | [diff] [blame] | 514 | // Take all references and make sure they point to an actual DIE by |
| 515 | // getting the DIE by offset and emitting an error |
| 516 | OS << "Verifying .debug_info references...\n"; |
Spyridoula Gravani | f6bd788d | 2017-07-18 01:00:26 +0000 | [diff] [blame] | 517 | unsigned NumErrors = 0; |
Greg Clayton | b8c162b | 2017-05-03 16:02:29 +0000 | [diff] [blame] | 518 | for (auto Pair : ReferenceToDIEOffsets) { |
| 519 | auto Die = DCtx.getDIEForOffset(Pair.first); |
| 520 | if (Die) |
| 521 | continue; |
Spyridoula Gravani | f6bd788d | 2017-07-18 01:00:26 +0000 | [diff] [blame] | 522 | ++NumErrors; |
Jonas Devlieghere | 19fc4d9 | 2017-09-29 09:33:31 +0000 | [diff] [blame] | 523 | error() << "invalid DIE reference " << format("0x%08" PRIx64, Pair.first) |
| 524 | << ". Offset is in between DIEs:\n"; |
Greg Clayton | b8c162b | 2017-05-03 16:02:29 +0000 | [diff] [blame] | 525 | for (auto Offset : Pair.second) { |
| 526 | auto ReferencingDie = DCtx.getDIEForOffset(Offset); |
Adrian Prantl | d3f9f21 | 2017-09-20 17:44:00 +0000 | [diff] [blame] | 527 | ReferencingDie.dump(OS, 0, DumpOpts); |
Greg Clayton | b8c162b | 2017-05-03 16:02:29 +0000 | [diff] [blame] | 528 | OS << "\n"; |
| 529 | } |
| 530 | OS << "\n"; |
| 531 | } |
Spyridoula Gravani | f6bd788d | 2017-07-18 01:00:26 +0000 | [diff] [blame] | 532 | return NumErrors; |
Greg Clayton | b8c162b | 2017-05-03 16:02:29 +0000 | [diff] [blame] | 533 | } |
| 534 | |
Greg Clayton | c5b2d56 | 2017-05-03 18:25:46 +0000 | [diff] [blame] | 535 | void DWARFVerifier::verifyDebugLineStmtOffsets() { |
Greg Clayton | b8c162b | 2017-05-03 16:02:29 +0000 | [diff] [blame] | 536 | std::map<uint64_t, DWARFDie> StmtListToDie; |
Greg Clayton | b8c162b | 2017-05-03 16:02:29 +0000 | [diff] [blame] | 537 | for (const auto &CU : DCtx.compile_units()) { |
Greg Clayton | c5b2d56 | 2017-05-03 18:25:46 +0000 | [diff] [blame] | 538 | auto Die = CU->getUnitDIE(); |
Greg Clayton | b8c162b | 2017-05-03 16:02:29 +0000 | [diff] [blame] | 539 | // Get the attribute value as a section offset. No need to produce an |
| 540 | // error here if the encoding isn't correct because we validate this in |
| 541 | // the .debug_info verifier. |
Greg Clayton | c5b2d56 | 2017-05-03 18:25:46 +0000 | [diff] [blame] | 542 | auto StmtSectionOffset = toSectionOffset(Die.find(DW_AT_stmt_list)); |
Greg Clayton | b8c162b | 2017-05-03 16:02:29 +0000 | [diff] [blame] | 543 | if (!StmtSectionOffset) |
| 544 | continue; |
| 545 | const uint32_t LineTableOffset = *StmtSectionOffset; |
Greg Clayton | c5b2d56 | 2017-05-03 18:25:46 +0000 | [diff] [blame] | 546 | auto LineTable = DCtx.getLineTableForUnit(CU.get()); |
Rafael Espindola | c398e67 | 2017-07-19 22:27:28 +0000 | [diff] [blame] | 547 | if (LineTableOffset < DCtx.getDWARFObj().getLineSection().Data.size()) { |
Greg Clayton | c5b2d56 | 2017-05-03 18:25:46 +0000 | [diff] [blame] | 548 | if (!LineTable) { |
| 549 | ++NumDebugLineErrors; |
Jonas Devlieghere | 19fc4d9 | 2017-09-29 09:33:31 +0000 | [diff] [blame] | 550 | error() << ".debug_line[" << format("0x%08" PRIx32, LineTableOffset) |
| 551 | << "] was not able to be parsed for CU:\n"; |
Adrian Prantl | d3f9f21 | 2017-09-20 17:44:00 +0000 | [diff] [blame] | 552 | Die.dump(OS, 0, DumpOpts); |
Greg Clayton | c5b2d56 | 2017-05-03 18:25:46 +0000 | [diff] [blame] | 553 | OS << '\n'; |
| 554 | continue; |
| 555 | } |
| 556 | } else { |
| 557 | // Make sure we don't get a valid line table back if the offset is wrong. |
| 558 | assert(LineTable == nullptr); |
Greg Clayton | b8c162b | 2017-05-03 16:02:29 +0000 | [diff] [blame] | 559 | // Skip this line table as it isn't valid. No need to create an error |
| 560 | // here because we validate this in the .debug_info verifier. |
| 561 | continue; |
| 562 | } |
Greg Clayton | b8c162b | 2017-05-03 16:02:29 +0000 | [diff] [blame] | 563 | auto Iter = StmtListToDie.find(LineTableOffset); |
| 564 | if (Iter != StmtListToDie.end()) { |
| 565 | ++NumDebugLineErrors; |
Jonas Devlieghere | 19fc4d9 | 2017-09-29 09:33:31 +0000 | [diff] [blame] | 566 | error() << "two compile unit DIEs, " |
| 567 | << format("0x%08" PRIx32, Iter->second.getOffset()) << " and " |
| 568 | << format("0x%08" PRIx32, Die.getOffset()) |
| 569 | << ", have the same DW_AT_stmt_list section offset:\n"; |
Adrian Prantl | d3f9f21 | 2017-09-20 17:44:00 +0000 | [diff] [blame] | 570 | Iter->second.dump(OS, 0, DumpOpts); |
| 571 | Die.dump(OS, 0, DumpOpts); |
Greg Clayton | b8c162b | 2017-05-03 16:02:29 +0000 | [diff] [blame] | 572 | OS << '\n'; |
| 573 | // Already verified this line table before, no need to do it again. |
| 574 | continue; |
| 575 | } |
Greg Clayton | c5b2d56 | 2017-05-03 18:25:46 +0000 | [diff] [blame] | 576 | StmtListToDie[LineTableOffset] = Die; |
| 577 | } |
| 578 | } |
Greg Clayton | b8c162b | 2017-05-03 16:02:29 +0000 | [diff] [blame] | 579 | |
Greg Clayton | c5b2d56 | 2017-05-03 18:25:46 +0000 | [diff] [blame] | 580 | void DWARFVerifier::verifyDebugLineRows() { |
| 581 | for (const auto &CU : DCtx.compile_units()) { |
| 582 | auto Die = CU->getUnitDIE(); |
Greg Clayton | b8c162b | 2017-05-03 16:02:29 +0000 | [diff] [blame] | 583 | auto LineTable = DCtx.getLineTableForUnit(CU.get()); |
Greg Clayton | c5b2d56 | 2017-05-03 18:25:46 +0000 | [diff] [blame] | 584 | // If there is no line table we will have created an error in the |
| 585 | // .debug_info verifier or in verifyDebugLineStmtOffsets(). |
| 586 | if (!LineTable) |
Greg Clayton | b8c162b | 2017-05-03 16:02:29 +0000 | [diff] [blame] | 587 | continue; |
Jonas Devlieghere | f4ed65d | 2017-09-08 09:48:51 +0000 | [diff] [blame] | 588 | |
| 589 | // Verify prologue. |
Greg Clayton | b8c162b | 2017-05-03 16:02:29 +0000 | [diff] [blame] | 590 | uint32_t MaxFileIndex = LineTable->Prologue.FileNames.size(); |
Jonas Devlieghere | f4ed65d | 2017-09-08 09:48:51 +0000 | [diff] [blame] | 591 | uint32_t MaxDirIndex = LineTable->Prologue.IncludeDirectories.size(); |
| 592 | uint32_t FileIndex = 1; |
| 593 | StringMap<uint16_t> FullPathMap; |
| 594 | for (const auto &FileName : LineTable->Prologue.FileNames) { |
| 595 | // Verify directory index. |
| 596 | if (FileName.DirIdx > MaxDirIndex) { |
| 597 | ++NumDebugLineErrors; |
Jonas Devlieghere | 19fc4d9 | 2017-09-29 09:33:31 +0000 | [diff] [blame] | 598 | error() << ".debug_line[" |
| 599 | << format("0x%08" PRIx64, |
| 600 | *toSectionOffset(Die.find(DW_AT_stmt_list))) |
| 601 | << "].prologue.file_names[" << FileIndex |
| 602 | << "].dir_idx contains an invalid index: " << FileName.DirIdx |
| 603 | << "\n"; |
Jonas Devlieghere | f4ed65d | 2017-09-08 09:48:51 +0000 | [diff] [blame] | 604 | } |
| 605 | |
| 606 | // Check file paths for duplicates. |
| 607 | std::string FullPath; |
| 608 | const bool HasFullPath = LineTable->getFileNameByIndex( |
| 609 | FileIndex, CU->getCompilationDir(), |
| 610 | DILineInfoSpecifier::FileLineInfoKind::AbsoluteFilePath, FullPath); |
| 611 | assert(HasFullPath && "Invalid index?"); |
| 612 | (void)HasFullPath; |
| 613 | auto It = FullPathMap.find(FullPath); |
| 614 | if (It == FullPathMap.end()) |
| 615 | FullPathMap[FullPath] = FileIndex; |
| 616 | else if (It->second != FileIndex) { |
Jonas Devlieghere | 19fc4d9 | 2017-09-29 09:33:31 +0000 | [diff] [blame] | 617 | warn() << ".debug_line[" |
| 618 | << format("0x%08" PRIx64, |
| 619 | *toSectionOffset(Die.find(DW_AT_stmt_list))) |
| 620 | << "].prologue.file_names[" << FileIndex |
| 621 | << "] is a duplicate of file_names[" << It->second << "]\n"; |
Jonas Devlieghere | f4ed65d | 2017-09-08 09:48:51 +0000 | [diff] [blame] | 622 | } |
| 623 | |
| 624 | FileIndex++; |
| 625 | } |
| 626 | |
| 627 | // Verify rows. |
Greg Clayton | b8c162b | 2017-05-03 16:02:29 +0000 | [diff] [blame] | 628 | uint64_t PrevAddress = 0; |
| 629 | uint32_t RowIndex = 0; |
| 630 | for (const auto &Row : LineTable->Rows) { |
Jonas Devlieghere | f4ed65d | 2017-09-08 09:48:51 +0000 | [diff] [blame] | 631 | // Verify row address. |
Greg Clayton | b8c162b | 2017-05-03 16:02:29 +0000 | [diff] [blame] | 632 | if (Row.Address < PrevAddress) { |
| 633 | ++NumDebugLineErrors; |
Jonas Devlieghere | 19fc4d9 | 2017-09-29 09:33:31 +0000 | [diff] [blame] | 634 | error() << ".debug_line[" |
| 635 | << format("0x%08" PRIx64, |
| 636 | *toSectionOffset(Die.find(DW_AT_stmt_list))) |
| 637 | << "] row[" << RowIndex |
| 638 | << "] decreases in address from previous row:\n"; |
Greg Clayton | b8c162b | 2017-05-03 16:02:29 +0000 | [diff] [blame] | 639 | |
| 640 | DWARFDebugLine::Row::dumpTableHeader(OS); |
| 641 | if (RowIndex > 0) |
| 642 | LineTable->Rows[RowIndex - 1].dump(OS); |
| 643 | Row.dump(OS); |
| 644 | OS << '\n'; |
| 645 | } |
| 646 | |
Jonas Devlieghere | f4ed65d | 2017-09-08 09:48:51 +0000 | [diff] [blame] | 647 | // Verify file index. |
Greg Clayton | b8c162b | 2017-05-03 16:02:29 +0000 | [diff] [blame] | 648 | if (Row.File > MaxFileIndex) { |
| 649 | ++NumDebugLineErrors; |
Jonas Devlieghere | 19fc4d9 | 2017-09-29 09:33:31 +0000 | [diff] [blame] | 650 | error() << ".debug_line[" |
| 651 | << format("0x%08" PRIx64, |
| 652 | *toSectionOffset(Die.find(DW_AT_stmt_list))) |
| 653 | << "][" << RowIndex << "] has invalid file index " << Row.File |
| 654 | << " (valid values are [1," << MaxFileIndex << "]):\n"; |
Greg Clayton | b8c162b | 2017-05-03 16:02:29 +0000 | [diff] [blame] | 655 | DWARFDebugLine::Row::dumpTableHeader(OS); |
| 656 | Row.dump(OS); |
| 657 | OS << '\n'; |
| 658 | } |
| 659 | if (Row.EndSequence) |
| 660 | PrevAddress = 0; |
| 661 | else |
| 662 | PrevAddress = Row.Address; |
| 663 | ++RowIndex; |
| 664 | } |
| 665 | } |
Greg Clayton | c5b2d56 | 2017-05-03 18:25:46 +0000 | [diff] [blame] | 666 | } |
| 667 | |
| 668 | bool DWARFVerifier::handleDebugLine() { |
| 669 | NumDebugLineErrors = 0; |
| 670 | OS << "Verifying .debug_line...\n"; |
| 671 | verifyDebugLineStmtOffsets(); |
| 672 | verifyDebugLineRows(); |
Greg Clayton | b8c162b | 2017-05-03 16:02:29 +0000 | [diff] [blame] | 673 | return NumDebugLineErrors == 0; |
| 674 | } |
Spyridoula Gravani | e41823b | 2017-06-14 00:17:55 +0000 | [diff] [blame] | 675 | |
Pavel Labath | 9b36fd2 | 2018-01-22 13:17:23 +0000 | [diff] [blame] | 676 | unsigned DWARFVerifier::verifyAppleAccelTable(const DWARFSection *AccelSection, |
| 677 | DataExtractor *StrData, |
| 678 | const char *SectionName) { |
Spyridoula Gravani | dc635f4 | 2017-07-26 00:52:31 +0000 | [diff] [blame] | 679 | unsigned NumErrors = 0; |
| 680 | DWARFDataExtractor AccelSectionData(DCtx.getDWARFObj(), *AccelSection, |
| 681 | DCtx.isLittleEndian(), 0); |
Pavel Labath | 9b36fd2 | 2018-01-22 13:17:23 +0000 | [diff] [blame] | 682 | AppleAcceleratorTable AccelTable(AccelSectionData, *StrData); |
Spyridoula Gravani | e41823b | 2017-06-14 00:17:55 +0000 | [diff] [blame] | 683 | |
Spyridoula Gravani | dc635f4 | 2017-07-26 00:52:31 +0000 | [diff] [blame] | 684 | OS << "Verifying " << SectionName << "...\n"; |
Spyridoula Gravani | dc635f4 | 2017-07-26 00:52:31 +0000 | [diff] [blame] | 685 | |
Jonas Devlieghere | 19fc4d9 | 2017-09-29 09:33:31 +0000 | [diff] [blame] | 686 | // Verify that the fixed part of the header is not too short. |
Spyridoula Gravani | dc635f4 | 2017-07-26 00:52:31 +0000 | [diff] [blame] | 687 | if (!AccelSectionData.isValidOffset(AccelTable.getSizeHdr())) { |
Jonas Devlieghere | 19fc4d9 | 2017-09-29 09:33:31 +0000 | [diff] [blame] | 688 | error() << "Section is too small to fit a section header.\n"; |
Spyridoula Gravani | dc635f4 | 2017-07-26 00:52:31 +0000 | [diff] [blame] | 689 | return 1; |
Spyridoula Gravani | e41823b | 2017-06-14 00:17:55 +0000 | [diff] [blame] | 690 | } |
Jonas Devlieghere | 19fc4d9 | 2017-09-29 09:33:31 +0000 | [diff] [blame] | 691 | |
Spyridoula Gravani | dc635f4 | 2017-07-26 00:52:31 +0000 | [diff] [blame] | 692 | // Verify that the section is not too short. |
Jonas Devlieghere | ba91589 | 2017-12-11 18:22:47 +0000 | [diff] [blame] | 693 | if (Error E = AccelTable.extract()) { |
| 694 | error() << toString(std::move(E)) << '\n'; |
Spyridoula Gravani | dc635f4 | 2017-07-26 00:52:31 +0000 | [diff] [blame] | 695 | return 1; |
| 696 | } |
Jonas Devlieghere | 19fc4d9 | 2017-09-29 09:33:31 +0000 | [diff] [blame] | 697 | |
Spyridoula Gravani | 837c110 | 2017-06-29 20:13:05 +0000 | [diff] [blame] | 698 | // Verify that all buckets have a valid hash index or are empty. |
Spyridoula Gravani | dc635f4 | 2017-07-26 00:52:31 +0000 | [diff] [blame] | 699 | uint32_t NumBuckets = AccelTable.getNumBuckets(); |
| 700 | uint32_t NumHashes = AccelTable.getNumHashes(); |
Spyridoula Gravani | e41823b | 2017-06-14 00:17:55 +0000 | [diff] [blame] | 701 | |
| 702 | uint32_t BucketsOffset = |
Spyridoula Gravani | dc635f4 | 2017-07-26 00:52:31 +0000 | [diff] [blame] | 703 | AccelTable.getSizeHdr() + AccelTable.getHeaderDataLength(); |
Spyridoula Gravani | 837c110 | 2017-06-29 20:13:05 +0000 | [diff] [blame] | 704 | uint32_t HashesBase = BucketsOffset + NumBuckets * 4; |
| 705 | uint32_t OffsetsBase = HashesBase + NumHashes * 4; |
Spyridoula Gravani | e41823b | 2017-06-14 00:17:55 +0000 | [diff] [blame] | 706 | for (uint32_t BucketIdx = 0; BucketIdx < NumBuckets; ++BucketIdx) { |
Spyridoula Gravani | dc635f4 | 2017-07-26 00:52:31 +0000 | [diff] [blame] | 707 | uint32_t HashIdx = AccelSectionData.getU32(&BucketsOffset); |
Spyridoula Gravani | e41823b | 2017-06-14 00:17:55 +0000 | [diff] [blame] | 708 | if (HashIdx >= NumHashes && HashIdx != UINT32_MAX) { |
Jonas Devlieghere | 19fc4d9 | 2017-09-29 09:33:31 +0000 | [diff] [blame] | 709 | error() << format("Bucket[%d] has invalid hash index: %u.\n", BucketIdx, |
| 710 | HashIdx); |
Spyridoula Gravani | dc635f4 | 2017-07-26 00:52:31 +0000 | [diff] [blame] | 711 | ++NumErrors; |
Spyridoula Gravani | e41823b | 2017-06-14 00:17:55 +0000 | [diff] [blame] | 712 | } |
| 713 | } |
Spyridoula Gravani | dc635f4 | 2017-07-26 00:52:31 +0000 | [diff] [blame] | 714 | uint32_t NumAtoms = AccelTable.getAtomsDesc().size(); |
Spyridoula Gravani | 837c110 | 2017-06-29 20:13:05 +0000 | [diff] [blame] | 715 | if (NumAtoms == 0) { |
Jonas Devlieghere | 19fc4d9 | 2017-09-29 09:33:31 +0000 | [diff] [blame] | 716 | error() << "No atoms: failed to read HashData.\n"; |
Spyridoula Gravani | dc635f4 | 2017-07-26 00:52:31 +0000 | [diff] [blame] | 717 | return 1; |
Spyridoula Gravani | 837c110 | 2017-06-29 20:13:05 +0000 | [diff] [blame] | 718 | } |
Spyridoula Gravani | dc635f4 | 2017-07-26 00:52:31 +0000 | [diff] [blame] | 719 | if (!AccelTable.validateForms()) { |
Jonas Devlieghere | 19fc4d9 | 2017-09-29 09:33:31 +0000 | [diff] [blame] | 720 | error() << "Unsupported form: failed to read HashData.\n"; |
Spyridoula Gravani | dc635f4 | 2017-07-26 00:52:31 +0000 | [diff] [blame] | 721 | return 1; |
Spyridoula Gravani | 837c110 | 2017-06-29 20:13:05 +0000 | [diff] [blame] | 722 | } |
| 723 | |
| 724 | for (uint32_t HashIdx = 0; HashIdx < NumHashes; ++HashIdx) { |
| 725 | uint32_t HashOffset = HashesBase + 4 * HashIdx; |
| 726 | uint32_t DataOffset = OffsetsBase + 4 * HashIdx; |
Spyridoula Gravani | dc635f4 | 2017-07-26 00:52:31 +0000 | [diff] [blame] | 727 | uint32_t Hash = AccelSectionData.getU32(&HashOffset); |
| 728 | uint32_t HashDataOffset = AccelSectionData.getU32(&DataOffset); |
| 729 | if (!AccelSectionData.isValidOffsetForDataOfSize(HashDataOffset, |
| 730 | sizeof(uint64_t))) { |
Jonas Devlieghere | 19fc4d9 | 2017-09-29 09:33:31 +0000 | [diff] [blame] | 731 | error() << format("Hash[%d] has invalid HashData offset: 0x%08x.\n", |
| 732 | HashIdx, HashDataOffset); |
Spyridoula Gravani | dc635f4 | 2017-07-26 00:52:31 +0000 | [diff] [blame] | 733 | ++NumErrors; |
Spyridoula Gravani | 837c110 | 2017-06-29 20:13:05 +0000 | [diff] [blame] | 734 | } |
| 735 | |
| 736 | uint32_t StrpOffset; |
| 737 | uint32_t StringOffset; |
| 738 | uint32_t StringCount = 0; |
Spyridoula Gravani | 70d35e1 | 2017-07-31 18:01:16 +0000 | [diff] [blame] | 739 | unsigned Offset; |
| 740 | unsigned Tag; |
Spyridoula Gravani | dc635f4 | 2017-07-26 00:52:31 +0000 | [diff] [blame] | 741 | while ((StrpOffset = AccelSectionData.getU32(&HashDataOffset)) != 0) { |
Spyridoula Gravani | 837c110 | 2017-06-29 20:13:05 +0000 | [diff] [blame] | 742 | const uint32_t NumHashDataObjects = |
Spyridoula Gravani | dc635f4 | 2017-07-26 00:52:31 +0000 | [diff] [blame] | 743 | AccelSectionData.getU32(&HashDataOffset); |
Spyridoula Gravani | 837c110 | 2017-06-29 20:13:05 +0000 | [diff] [blame] | 744 | for (uint32_t HashDataIdx = 0; HashDataIdx < NumHashDataObjects; |
| 745 | ++HashDataIdx) { |
Spyridoula Gravani | 70d35e1 | 2017-07-31 18:01:16 +0000 | [diff] [blame] | 746 | std::tie(Offset, Tag) = AccelTable.readAtoms(HashDataOffset); |
| 747 | auto Die = DCtx.getDIEForOffset(Offset); |
| 748 | if (!Die) { |
Spyridoula Gravani | 837c110 | 2017-06-29 20:13:05 +0000 | [diff] [blame] | 749 | const uint32_t BucketIdx = |
| 750 | NumBuckets ? (Hash % NumBuckets) : UINT32_MAX; |
| 751 | StringOffset = StrpOffset; |
Spyridoula Gravani | dc635f4 | 2017-07-26 00:52:31 +0000 | [diff] [blame] | 752 | const char *Name = StrData->getCStr(&StringOffset); |
Spyridoula Gravani | 837c110 | 2017-06-29 20:13:05 +0000 | [diff] [blame] | 753 | if (!Name) |
| 754 | Name = "<NULL>"; |
| 755 | |
Jonas Devlieghere | 19fc4d9 | 2017-09-29 09:33:31 +0000 | [diff] [blame] | 756 | error() << format( |
| 757 | "%s Bucket[%d] Hash[%d] = 0x%08x " |
Spyridoula Gravani | 837c110 | 2017-06-29 20:13:05 +0000 | [diff] [blame] | 758 | "Str[%u] = 0x%08x " |
| 759 | "DIE[%d] = 0x%08x is not a valid DIE offset for \"%s\".\n", |
Spyridoula Gravani | dc635f4 | 2017-07-26 00:52:31 +0000 | [diff] [blame] | 760 | SectionName, BucketIdx, HashIdx, Hash, StringCount, StrpOffset, |
Spyridoula Gravani | 70d35e1 | 2017-07-31 18:01:16 +0000 | [diff] [blame] | 761 | HashDataIdx, Offset, Name); |
Spyridoula Gravani | 837c110 | 2017-06-29 20:13:05 +0000 | [diff] [blame] | 762 | |
Spyridoula Gravani | dc635f4 | 2017-07-26 00:52:31 +0000 | [diff] [blame] | 763 | ++NumErrors; |
Spyridoula Gravani | 70d35e1 | 2017-07-31 18:01:16 +0000 | [diff] [blame] | 764 | continue; |
| 765 | } |
| 766 | if ((Tag != dwarf::DW_TAG_null) && (Die.getTag() != Tag)) { |
Jonas Devlieghere | 19fc4d9 | 2017-09-29 09:33:31 +0000 | [diff] [blame] | 767 | error() << "Tag " << dwarf::TagString(Tag) |
| 768 | << " in accelerator table does not match Tag " |
| 769 | << dwarf::TagString(Die.getTag()) << " of DIE[" << HashDataIdx |
| 770 | << "].\n"; |
Spyridoula Gravani | 70d35e1 | 2017-07-31 18:01:16 +0000 | [diff] [blame] | 771 | ++NumErrors; |
Spyridoula Gravani | 837c110 | 2017-06-29 20:13:05 +0000 | [diff] [blame] | 772 | } |
| 773 | } |
| 774 | ++StringCount; |
| 775 | } |
| 776 | } |
Spyridoula Gravani | dc635f4 | 2017-07-26 00:52:31 +0000 | [diff] [blame] | 777 | return NumErrors; |
| 778 | } |
| 779 | |
Pavel Labath | b136c39 | 2018-03-08 15:34:42 +0000 | [diff] [blame] | 780 | unsigned |
| 781 | DWARFVerifier::verifyDebugNamesCULists(const DWARFDebugNames &AccelTable) { |
| 782 | // A map from CU offset to the (first) Name Index offset which claims to index |
| 783 | // this CU. |
| 784 | DenseMap<uint32_t, uint32_t> CUMap; |
| 785 | const uint32_t NotIndexed = std::numeric_limits<uint32_t>::max(); |
| 786 | |
| 787 | CUMap.reserve(DCtx.getNumCompileUnits()); |
| 788 | for (const auto &CU : DCtx.compile_units()) |
| 789 | CUMap[CU->getOffset()] = NotIndexed; |
| 790 | |
| 791 | unsigned NumErrors = 0; |
| 792 | for (const DWARFDebugNames::NameIndex &NI : AccelTable) { |
| 793 | if (NI.getCUCount() == 0) { |
| 794 | error() << formatv("Name Index @ {0:x} does not index any CU\n", |
| 795 | NI.getUnitOffset()); |
| 796 | ++NumErrors; |
| 797 | continue; |
| 798 | } |
| 799 | for (uint32_t CU = 0, End = NI.getCUCount(); CU < End; ++CU) { |
| 800 | uint32_t Offset = NI.getCUOffset(CU); |
| 801 | auto Iter = CUMap.find(Offset); |
| 802 | |
| 803 | if (Iter == CUMap.end()) { |
| 804 | error() << formatv( |
| 805 | "Name Index @ {0:x} references a non-existing CU @ {1:x}\n", |
| 806 | NI.getUnitOffset(), Offset); |
| 807 | ++NumErrors; |
| 808 | continue; |
| 809 | } |
| 810 | |
| 811 | if (Iter->second != NotIndexed) { |
| 812 | error() << formatv("Name Index @ {0:x} references a CU @ {1:x}, but " |
| 813 | "this CU is already indexed by Name Index @ {2:x}\n", |
| 814 | NI.getUnitOffset(), Offset, Iter->second); |
| 815 | continue; |
| 816 | } |
| 817 | Iter->second = NI.getUnitOffset(); |
| 818 | } |
| 819 | } |
| 820 | |
| 821 | for (const auto &KV : CUMap) { |
| 822 | if (KV.second == NotIndexed) |
| 823 | warn() << formatv("CU @ {0:x} not covered by any Name Index\n", KV.first); |
| 824 | } |
| 825 | |
| 826 | return NumErrors; |
| 827 | } |
| 828 | |
| 829 | unsigned DWARFVerifier::verifyDebugNames(const DWARFSection &AccelSection, |
| 830 | const DataExtractor &StrData) { |
| 831 | unsigned NumErrors = 0; |
| 832 | DWARFDataExtractor AccelSectionData(DCtx.getDWARFObj(), AccelSection, |
| 833 | DCtx.isLittleEndian(), 0); |
| 834 | DWARFDebugNames AccelTable(AccelSectionData, StrData); |
| 835 | |
| 836 | OS << "Verifying .debug_names...\n"; |
| 837 | |
| 838 | // This verifies that we can read individual name indices and their |
| 839 | // abbreviation tables. |
| 840 | if (Error E = AccelTable.extract()) { |
| 841 | error() << toString(std::move(E)) << '\n'; |
| 842 | return 1; |
| 843 | } |
| 844 | |
| 845 | NumErrors += verifyDebugNamesCULists(AccelTable); |
| 846 | |
| 847 | for (const DWARFDebugNames::NameIndex &NI : AccelTable) { |
| 848 | for (uint32_t Bucket = 0, End = NI.getBucketCount(); Bucket < End; |
| 849 | ++Bucket) { |
| 850 | uint32_t Index = NI.getBucketArrayEntry(Bucket); |
| 851 | if (Index > NI.getNameCount()) { |
| 852 | error() << formatv("Bucket {0} of Name Index @ {1:x} contains invalid " |
| 853 | "value {2}. Valid range is [0, {3}].\n", |
| 854 | Bucket, NI.getUnitOffset(), Index, |
| 855 | NI.getNameCount()); |
| 856 | ++NumErrors; |
| 857 | } |
| 858 | } |
| 859 | } |
| 860 | |
| 861 | return NumErrors; |
| 862 | } |
| 863 | |
Spyridoula Gravani | dc635f4 | 2017-07-26 00:52:31 +0000 | [diff] [blame] | 864 | bool DWARFVerifier::handleAccelTables() { |
| 865 | const DWARFObject &D = DCtx.getDWARFObj(); |
| 866 | DataExtractor StrData(D.getStringSection(), DCtx.isLittleEndian(), 0); |
| 867 | unsigned NumErrors = 0; |
| 868 | if (!D.getAppleNamesSection().Data.empty()) |
| 869 | NumErrors += |
Pavel Labath | 9b36fd2 | 2018-01-22 13:17:23 +0000 | [diff] [blame] | 870 | verifyAppleAccelTable(&D.getAppleNamesSection(), &StrData, ".apple_names"); |
Spyridoula Gravani | dc635f4 | 2017-07-26 00:52:31 +0000 | [diff] [blame] | 871 | if (!D.getAppleTypesSection().Data.empty()) |
| 872 | NumErrors += |
Pavel Labath | 9b36fd2 | 2018-01-22 13:17:23 +0000 | [diff] [blame] | 873 | verifyAppleAccelTable(&D.getAppleTypesSection(), &StrData, ".apple_types"); |
Spyridoula Gravani | dc635f4 | 2017-07-26 00:52:31 +0000 | [diff] [blame] | 874 | if (!D.getAppleNamespacesSection().Data.empty()) |
Pavel Labath | 9b36fd2 | 2018-01-22 13:17:23 +0000 | [diff] [blame] | 875 | NumErrors += verifyAppleAccelTable(&D.getAppleNamespacesSection(), &StrData, |
Spyridoula Gravani | dc635f4 | 2017-07-26 00:52:31 +0000 | [diff] [blame] | 876 | ".apple_namespaces"); |
| 877 | if (!D.getAppleObjCSection().Data.empty()) |
| 878 | NumErrors += |
Pavel Labath | 9b36fd2 | 2018-01-22 13:17:23 +0000 | [diff] [blame] | 879 | verifyAppleAccelTable(&D.getAppleObjCSection(), &StrData, ".apple_objc"); |
Pavel Labath | b136c39 | 2018-03-08 15:34:42 +0000 | [diff] [blame] | 880 | |
| 881 | if (!D.getDebugNamesSection().Data.empty()) |
| 882 | NumErrors += verifyDebugNames(D.getDebugNamesSection(), StrData); |
Spyridoula Gravani | dc635f4 | 2017-07-26 00:52:31 +0000 | [diff] [blame] | 883 | return NumErrors == 0; |
Spyridoula Gravani | e41823b | 2017-06-14 00:17:55 +0000 | [diff] [blame] | 884 | } |
Jonas Devlieghere | 19fc4d9 | 2017-09-29 09:33:31 +0000 | [diff] [blame] | 885 | |
| 886 | raw_ostream &DWARFVerifier::error() const { |
Jonas Devlieghere | 6921753 | 2018-03-09 09:56:24 +0000 | [diff] [blame] | 887 | return WithColor(OS, HighlightColor::Error).get() << "error: "; |
Jonas Devlieghere | 19fc4d9 | 2017-09-29 09:33:31 +0000 | [diff] [blame] | 888 | } |
| 889 | |
| 890 | raw_ostream &DWARFVerifier::warn() const { |
Jonas Devlieghere | 6921753 | 2018-03-09 09:56:24 +0000 | [diff] [blame] | 891 | return WithColor(OS, HighlightColor::Warning).get() << "warning: "; |
Jonas Devlieghere | 19fc4d9 | 2017-09-29 09:33:31 +0000 | [diff] [blame] | 892 | } |
| 893 | |
| 894 | raw_ostream &DWARFVerifier::note() const { |
Jonas Devlieghere | 6921753 | 2018-03-09 09:56:24 +0000 | [diff] [blame] | 895 | return WithColor(OS, HighlightColor::Note).get() << "note: "; |
Jonas Devlieghere | 19fc4d9 | 2017-09-29 09:33:31 +0000 | [diff] [blame] | 896 | } |