1 //===- DWARFDie.cpp -------------------------------------------------------===// 2 // 3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4 // See https://llvm.org/LICENSE.txt for license information. 5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6 // 7 //===----------------------------------------------------------------------===// 8 9 #include "llvm/DebugInfo/DWARF/DWARFDie.h" 10 #include "llvm/ADT/None.h" 11 #include "llvm/ADT/Optional.h" 12 #include "llvm/ADT/SmallSet.h" 13 #include "llvm/ADT/StringRef.h" 14 #include "llvm/BinaryFormat/Dwarf.h" 15 #include "llvm/DebugInfo/DWARF/DWARFAbbreviationDeclaration.h" 16 #include "llvm/DebugInfo/DWARF/DWARFContext.h" 17 #include "llvm/DebugInfo/DWARF/DWARFDebugRangeList.h" 18 #include "llvm/DebugInfo/DWARF/DWARFExpression.h" 19 #include "llvm/DebugInfo/DWARF/DWARFFormValue.h" 20 #include "llvm/DebugInfo/DWARF/DWARFUnit.h" 21 #include "llvm/Object/ObjectFile.h" 22 #include "llvm/Support/DataExtractor.h" 23 #include "llvm/Support/Format.h" 24 #include "llvm/Support/FormatAdapters.h" 25 #include "llvm/Support/FormatVariadic.h" 26 #include "llvm/Support/MathExtras.h" 27 #include "llvm/Support/WithColor.h" 28 #include "llvm/Support/raw_ostream.h" 29 #include <algorithm> 30 #include <cassert> 31 #include <cinttypes> 32 #include <cstdint> 33 #include <string> 34 #include <utility> 35 36 using namespace llvm; 37 using namespace dwarf; 38 using namespace object; 39 40 static void dumpApplePropertyAttribute(raw_ostream &OS, uint64_t Val) { 41 OS << " ("; 42 do { 43 uint64_t Shift = countTrailingZeros(Val); 44 assert(Shift < 64 && "undefined behavior"); 45 uint64_t Bit = 1ULL << Shift; 46 auto PropName = ApplePropertyString(Bit); 47 if (!PropName.empty()) 48 OS << PropName; 49 else 50 OS << format("DW_APPLE_PROPERTY_0x%" PRIx64, Bit); 51 if (!(Val ^= Bit)) 52 break; 53 OS << ", "; 54 } while (true); 55 OS << ")"; 56 } 57 58 static void dumpRanges(const DWARFObject &Obj, raw_ostream &OS, 59 const DWARFAddressRangesVector &Ranges, 60 unsigned AddressSize, unsigned Indent, 61 const DIDumpOptions &DumpOpts) { 62 if (!DumpOpts.ShowAddresses) 63 return; 64 65 for (const DWARFAddressRange &R : Ranges) { 66 OS << '\n'; 67 OS.indent(Indent); 68 R.dump(OS, AddressSize, DumpOpts, &Obj); 69 } 70 } 71 72 static void dumpLocationList(raw_ostream &OS, const DWARFFormValue &FormValue, 73 DWARFUnit *U, unsigned Indent, 74 DIDumpOptions DumpOpts) { 75 assert(FormValue.isFormClass(DWARFFormValue::FC_SectionOffset) && 76 "bad FORM for location list"); 77 DWARFContext &Ctx = U->getContext(); 78 const MCRegisterInfo *MRI = Ctx.getRegisterInfo(); 79 uint64_t Offset = *FormValue.getAsSectionOffset(); 80 81 if (FormValue.getForm() == DW_FORM_loclistx) { 82 FormValue.dump(OS, DumpOpts); 83 84 if (auto LoclistOffset = U->getLoclistOffset(Offset)) 85 Offset = *LoclistOffset; 86 else 87 return; 88 } 89 U->getLocationTable().dumpLocationList(&Offset, OS, U->getBaseAddress(), MRI, 90 Ctx.getDWARFObj(), U, DumpOpts, 91 Indent); 92 return; 93 } 94 95 static void dumpLocationExpr(raw_ostream &OS, const DWARFFormValue &FormValue, 96 DWARFUnit *U, unsigned Indent, 97 DIDumpOptions DumpOpts) { 98 assert((FormValue.isFormClass(DWARFFormValue::FC_Block) || 99 FormValue.isFormClass(DWARFFormValue::FC_Exprloc)) && 100 "bad FORM for location expression"); 101 DWARFContext &Ctx = U->getContext(); 102 const MCRegisterInfo *MRI = Ctx.getRegisterInfo(); 103 ArrayRef<uint8_t> Expr = *FormValue.getAsBlock(); 104 DataExtractor Data(StringRef((const char *)Expr.data(), Expr.size()), 105 Ctx.isLittleEndian(), 0); 106 DWARFExpression(Data, U->getAddressByteSize(), U->getFormParams().Format) 107 .print(OS, DumpOpts, MRI, U); 108 return; 109 } 110 111 static DWARFDie resolveReferencedType(DWARFDie D, 112 dwarf::Attribute Attr = DW_AT_type) { 113 return D.getAttributeValueAsReferencedDie(Attr).resolveTypeUnitReference(); 114 } 115 static DWARFDie resolveReferencedType(DWARFDie D, DWARFFormValue F) { 116 return D.getAttributeValueAsReferencedDie(F).resolveTypeUnitReference(); 117 } 118 119 namespace { 120 121 // FIXME: We should have pretty printers per language. Currently we print 122 // everything as if it was C++ and fall back to the TAG type name. 123 struct DWARFTypePrinter { 124 raw_ostream &OS; 125 bool Word = true; 126 bool EndedWithTemplate = false; 127 128 DWARFTypePrinter(raw_ostream &OS) : OS(OS) {} 129 130 /// Dump the name encoded in the type tag. 131 void appendTypeTagName(dwarf::Tag T) { 132 StringRef TagStr = TagString(T); 133 static constexpr StringRef Prefix = "DW_TAG_"; 134 static constexpr StringRef Suffix = "_type"; 135 if (!TagStr.startswith(Prefix) || !TagStr.endswith(Suffix)) 136 return; 137 OS << TagStr.substr(Prefix.size(), 138 TagStr.size() - (Prefix.size() + Suffix.size())) 139 << " "; 140 } 141 142 void appendArrayType(const DWARFDie &D) { 143 for (const DWARFDie &C : D.children()) { 144 if (C.getTag() != DW_TAG_subrange_type) 145 continue; 146 Optional<uint64_t> LB; 147 Optional<uint64_t> Count; 148 Optional<uint64_t> UB; 149 Optional<unsigned> DefaultLB; 150 if (Optional<DWARFFormValue> L = C.find(DW_AT_lower_bound)) 151 LB = L->getAsUnsignedConstant(); 152 if (Optional<DWARFFormValue> CountV = C.find(DW_AT_count)) 153 Count = CountV->getAsUnsignedConstant(); 154 if (Optional<DWARFFormValue> UpperV = C.find(DW_AT_upper_bound)) 155 UB = UpperV->getAsUnsignedConstant(); 156 if (Optional<DWARFFormValue> LV = 157 D.getDwarfUnit()->getUnitDIE().find(DW_AT_language)) 158 if (Optional<uint64_t> LC = LV->getAsUnsignedConstant()) 159 if ((DefaultLB = 160 LanguageLowerBound(static_cast<dwarf::SourceLanguage>(*LC)))) 161 if (LB && *LB == *DefaultLB) 162 LB = None; 163 if (!LB && !Count && !UB) 164 OS << "[]"; 165 else if (!LB && (Count || UB) && DefaultLB) 166 OS << '[' << (Count ? *Count : *UB - *DefaultLB + 1) << ']'; 167 else { 168 OS << "[["; 169 if (LB) 170 OS << *LB; 171 else 172 OS << '?'; 173 OS << ", "; 174 if (Count) 175 if (LB) 176 OS << *LB + *Count; 177 else 178 OS << "? + " << *Count; 179 else if (UB) 180 OS << *UB + 1; 181 else 182 OS << '?'; 183 OS << ")]"; 184 } 185 } 186 EndedWithTemplate = false; 187 } 188 189 DWARFDie skipQualifiers(DWARFDie D) { 190 while (D && (D.getTag() == DW_TAG_const_type || 191 D.getTag() == DW_TAG_volatile_type)) 192 D = resolveReferencedType(D); 193 return D; 194 } 195 196 bool needsParens(DWARFDie D) { 197 D = skipQualifiers(D); 198 return D && (D.getTag() == DW_TAG_subroutine_type || D.getTag() == DW_TAG_array_type); 199 } 200 201 void appendPointerLikeTypeBefore(DWARFDie D, DWARFDie Inner, StringRef Ptr) { 202 appendQualifiedNameBefore(Inner); 203 if (Word) 204 OS << ' '; 205 if (needsParens(Inner)) 206 OS << '('; 207 OS << Ptr; 208 Word = false; 209 EndedWithTemplate = false; 210 } 211 212 DWARFDie 213 appendUnqualifiedNameBefore(DWARFDie D, 214 std::string *OriginalFullName = nullptr) { 215 Word = true; 216 if (!D) { 217 OS << "void"; 218 return DWARFDie(); 219 } 220 DWARFDie Inner = resolveReferencedType(D); 221 const dwarf::Tag T = D.getTag(); 222 switch (T) { 223 case DW_TAG_pointer_type: { 224 appendPointerLikeTypeBefore(D, Inner, "*"); 225 break; 226 } 227 case DW_TAG_subroutine_type: { 228 appendQualifiedNameBefore(Inner); 229 if (Word) { 230 OS << ' '; 231 } 232 Word = false; 233 break; 234 } 235 case DW_TAG_array_type: { 236 appendQualifiedNameBefore(Inner); 237 break; 238 } 239 case DW_TAG_reference_type: 240 appendPointerLikeTypeBefore(D, Inner, "&"); 241 break; 242 case DW_TAG_rvalue_reference_type: 243 appendPointerLikeTypeBefore(D, Inner, "&&"); 244 break; 245 case DW_TAG_ptr_to_member_type: { 246 appendQualifiedNameBefore(Inner); 247 if (needsParens(Inner)) 248 OS << '('; 249 else if (Word) 250 OS << ' '; 251 if (DWARFDie Cont = resolveReferencedType(D, DW_AT_containing_type)) { 252 appendQualifiedName(Cont); 253 OS << "::"; 254 } 255 OS << "*"; 256 Word = false; 257 break; 258 } 259 case DW_TAG_const_type: 260 case DW_TAG_volatile_type: 261 appendConstVolatileQualifierBefore(D); 262 break; 263 case DW_TAG_namespace: { 264 if (const char *Name = dwarf::toString(D.find(DW_AT_name), nullptr)) 265 OS << Name; 266 else 267 OS << "(anonymous namespace)"; 268 break; 269 } 270 case DW_TAG_unspecified_type: { 271 StringRef TypeName = D.getShortName(); 272 if (TypeName == "decltype(nullptr)") 273 TypeName = "std::nullptr_t"; 274 Word = true; 275 OS << TypeName; 276 EndedWithTemplate = false; 277 break; 278 } 279 /* 280 case DW_TAG_structure_type: 281 case DW_TAG_class_type: 282 case DW_TAG_enumeration_type: 283 case DW_TAG_base_type: 284 */ 285 default: { 286 const char *NamePtr = dwarf::toString(D.find(DW_AT_name), nullptr); 287 if (!NamePtr) { 288 appendTypeTagName(D.getTag()); 289 return Inner; 290 } 291 Word = true; 292 StringRef Name = NamePtr; 293 static constexpr StringRef MangledPrefix = "_STN"; 294 if (Name.startswith(MangledPrefix)) { 295 Name = Name.drop_front(MangledPrefix.size()); 296 auto Separator = Name.find('|'); 297 assert(Separator != StringRef::npos); 298 StringRef BaseName = Name.substr(0, Separator); 299 StringRef TemplateArgs = Name.substr(Separator + 1); 300 if (OriginalFullName) 301 *OriginalFullName = (BaseName + TemplateArgs).str(); 302 Name = BaseName; 303 } else 304 EndedWithTemplate = Name.endswith(">"); 305 OS << Name; 306 // This check would be insufficient for operator overloads like 307 // "operator>>" - but for now Clang doesn't try to simplify them, so this 308 // is OK. Add more nuanced operator overload handling here if/when needed. 309 if (Name.endswith(">")) 310 break; 311 if (!appendTemplateParameters(D)) 312 break; 313 314 if (EndedWithTemplate) 315 OS << ' '; 316 OS << '>'; 317 EndedWithTemplate = true; 318 Word = true; 319 break; 320 } 321 } 322 return Inner; 323 } 324 325 void appendUnqualifiedNameAfter(DWARFDie D, DWARFDie Inner, 326 bool SkipFirstParamIfArtificial = false) { 327 if (!D) 328 return; 329 switch (D.getTag()) { 330 case DW_TAG_subroutine_type: { 331 appendSubroutineNameAfter(D, Inner, SkipFirstParamIfArtificial, false, 332 false); 333 break; 334 } 335 case DW_TAG_array_type: { 336 appendArrayType(D); 337 break; 338 } 339 case DW_TAG_const_type: 340 case DW_TAG_volatile_type: 341 appendConstVolatileQualifierAfter(D); 342 break; 343 case DW_TAG_ptr_to_member_type: 344 case DW_TAG_reference_type: 345 case DW_TAG_rvalue_reference_type: 346 case DW_TAG_pointer_type: { 347 if (needsParens(Inner)) 348 OS << ')'; 349 appendUnqualifiedNameAfter(Inner, resolveReferencedType(Inner), 350 /*SkipFirstParamIfArtificial=*/D.getTag() == 351 DW_TAG_ptr_to_member_type); 352 break; 353 } 354 /* 355 case DW_TAG_structure_type: 356 case DW_TAG_class_type: 357 case DW_TAG_enumeration_type: 358 case DW_TAG_base_type: 359 case DW_TAG_namespace: 360 */ 361 default: 362 break; 363 } 364 } 365 366 void appendQualifiedName(DWARFDie D) { 367 if (D) 368 appendScopes(D.getParent()); 369 appendUnqualifiedName(D); 370 } 371 DWARFDie appendQualifiedNameBefore(DWARFDie D) { 372 if (D) 373 appendScopes(D.getParent()); 374 return appendUnqualifiedNameBefore(D); 375 } 376 bool appendTemplateParameters(DWARFDie D, bool *FirstParameter = nullptr) { 377 bool FirstParameterValue = true; 378 bool IsTemplate = false; 379 if (!FirstParameter) 380 FirstParameter = &FirstParameterValue; 381 for (const DWARFDie &C : D) { 382 auto Sep = [&] { 383 if (*FirstParameter) 384 OS << '<'; 385 else 386 OS << ", "; 387 IsTemplate = true; 388 EndedWithTemplate = false; 389 *FirstParameter = false; 390 }; 391 if (C.getTag() == dwarf::DW_TAG_GNU_template_parameter_pack) { 392 IsTemplate = true; 393 appendTemplateParameters(C, FirstParameter); 394 } 395 if (C.getTag() == dwarf::DW_TAG_template_value_parameter) { 396 DWARFDie T = resolveReferencedType(C); 397 Sep(); 398 if (T.getTag() == DW_TAG_enumeration_type) { 399 auto V = C.find(DW_AT_const_value); 400 bool FoundEnumerator = false; 401 for (const DWARFDie &Enumerator : T) { 402 auto EV = Enumerator.find(DW_AT_const_value); 403 if (V && EV && 404 V->getAsSignedConstant() == EV->getAsSignedConstant()) { 405 if (T.find(DW_AT_enum_class)) { 406 appendQualifiedName(T); 407 OS << "::"; 408 } else 409 appendScopes(T.getParent()); 410 OS << Enumerator.getShortName(); 411 FoundEnumerator = true; 412 break; 413 } 414 } 415 if (FoundEnumerator) 416 continue; 417 OS << '('; 418 appendQualifiedName(T); 419 OS << ')'; 420 OS << to_string(*V->getAsSignedConstant()); 421 continue; 422 } 423 // /Maybe/ we could do pointer type parameters, looking for the 424 // symbol in the ELF symbol table to get back to the variable... 425 // but probably not worth it. 426 if (T.getTag() == DW_TAG_pointer_type) 427 continue; 428 const char *RawName = dwarf::toString(T.find(DW_AT_name), nullptr); 429 assert(RawName); 430 StringRef Name = RawName; 431 auto V = C.find(DW_AT_const_value); 432 bool IsQualifiedChar = false; 433 if (Name == "bool") { 434 OS << (*V->getAsUnsignedConstant() ? "true" : "false"); 435 } else if (Name == "short") { 436 OS << "(short)"; 437 OS << to_string(*V->getAsSignedConstant()); 438 } else if (Name == "unsigned short") { 439 OS << "(unsigned short)"; 440 OS << to_string(*V->getAsSignedConstant()); 441 } else if (Name == "int") 442 OS << to_string(*V->getAsSignedConstant()); 443 else if (Name == "long") { 444 OS << to_string(*V->getAsSignedConstant()); 445 OS << "L"; 446 } else if (Name == "long long") { 447 OS << to_string(*V->getAsSignedConstant()); 448 OS << "LL"; 449 } else if (Name == "unsigned int") { 450 OS << to_string(*V->getAsUnsignedConstant()); 451 OS << "U"; 452 } else if (Name == "unsigned long") { 453 OS << to_string(*V->getAsUnsignedConstant()); 454 OS << "UL"; 455 } else if (Name == "unsigned long long") { 456 OS << to_string(*V->getAsUnsignedConstant()); 457 OS << "ULL"; 458 } else if (Name == "char" || 459 (IsQualifiedChar = 460 (Name == "unsigned char" || Name == "signed char"))) { 461 // FIXME: check T's DW_AT_type to see if it's signed or not (since 462 // char signedness is implementation defined). 463 auto Val = *V->getAsSignedConstant(); 464 // Copied/hacked up from Clang's CharacterLiteral::print - incomplete 465 // (doesn't actually support different character types/widths, sign 466 // handling's not done, and doesn't correctly test if a character is 467 // printable or needs to use a numeric escape sequence instead) 468 if (IsQualifiedChar) { 469 OS << '('; 470 OS << Name; 471 OS << ')'; 472 } 473 switch (Val) { 474 case '\\': 475 OS << "'\\\\'"; 476 break; 477 case '\'': 478 OS << "'\\''"; 479 break; 480 case '\a': 481 // TODO: K&R: the meaning of '\\a' is different in traditional C 482 OS << "'\\a'"; 483 break; 484 case '\b': 485 OS << "'\\b'"; 486 break; 487 case '\f': 488 OS << "'\\f'"; 489 break; 490 case '\n': 491 OS << "'\\n'"; 492 break; 493 case '\r': 494 OS << "'\\r'"; 495 break; 496 case '\t': 497 OS << "'\\t'"; 498 break; 499 case '\v': 500 OS << "'\\v'"; 501 break; 502 default: 503 if ((Val & ~0xFFu) == ~0xFFu) 504 Val &= 0xFFu; 505 if (Val < 127 && Val >= 32) { 506 OS << "'"; 507 OS << (char)Val; 508 OS << "'"; 509 } else if (Val < 256) 510 OS << to_string(llvm::format("'\\x%02x'", Val)); 511 else if (Val <= 0xFFFF) 512 OS << to_string(llvm::format("'\\u%04x'", Val)); 513 else 514 OS << to_string(llvm::format("'\\U%08x'", Val)); 515 } 516 } 517 continue; 518 } 519 if (C.getTag() == dwarf::DW_TAG_GNU_template_template_param) { 520 const char *RawName = 521 dwarf::toString(C.find(DW_AT_GNU_template_name), nullptr); 522 assert(RawName); 523 StringRef Name = RawName; 524 Sep(); 525 OS << Name; 526 continue; 527 } 528 if (C.getTag() != dwarf::DW_TAG_template_type_parameter) 529 continue; 530 auto TypeAttr = C.find(DW_AT_type); 531 Sep(); 532 appendQualifiedName(TypeAttr ? resolveReferencedType(C, *TypeAttr) 533 : DWARFDie()); 534 } 535 if (IsTemplate && *FirstParameter && FirstParameter == &FirstParameterValue) 536 OS << '<'; 537 return IsTemplate; 538 } 539 void decomposeConstVolatile(DWARFDie &N, DWARFDie &T, DWARFDie &C, 540 DWARFDie &V) { 541 (N.getTag() == DW_TAG_const_type ? C : V) = N; 542 T = resolveReferencedType(N); 543 if (T) { 544 auto Tag = T.getTag(); 545 if (Tag == DW_TAG_const_type) { 546 C = T; 547 T = resolveReferencedType(T); 548 } else if (Tag == DW_TAG_volatile_type) { 549 V = T; 550 T = resolveReferencedType(T); 551 } 552 } 553 } 554 void appendConstVolatileQualifierAfter(DWARFDie N) { 555 DWARFDie C; 556 DWARFDie V; 557 DWARFDie T; 558 decomposeConstVolatile(N, T, C, V); 559 if (T && T.getTag() == DW_TAG_subroutine_type) 560 appendSubroutineNameAfter(T, resolveReferencedType(T), false, C.isValid(), 561 V.isValid()); 562 else 563 appendUnqualifiedNameAfter(T, resolveReferencedType(T)); 564 } 565 void appendConstVolatileQualifierBefore(DWARFDie N) { 566 DWARFDie C; 567 DWARFDie V; 568 DWARFDie T; 569 decomposeConstVolatile(N, T, C, V); 570 bool Subroutine = T && T.getTag() == DW_TAG_subroutine_type; 571 DWARFDie A = T; 572 while (A && A.getTag() == DW_TAG_array_type) 573 A = resolveReferencedType(A); 574 bool Leading = 575 (!A || (A.getTag() != DW_TAG_pointer_type && 576 A.getTag() != llvm::dwarf::DW_TAG_ptr_to_member_type)) && 577 !Subroutine; 578 if (Leading) { 579 if (C) 580 OS << "const "; 581 if (V) 582 OS << "volatile "; 583 } 584 appendQualifiedNameBefore(T); 585 if (!Leading && !Subroutine) { 586 Word = true; 587 if (C) 588 OS << "const"; 589 if (V) { 590 if (C) 591 OS << ' '; 592 OS << "volatile"; 593 } 594 } 595 } 596 597 /// Recursively append the DIE type name when applicable. 598 void appendUnqualifiedName(DWARFDie D, 599 std::string *OriginalFullName = nullptr) { 600 // FIXME: We should have pretty printers per language. Currently we print 601 // everything as if it was C++ and fall back to the TAG type name. 602 DWARFDie Inner = appendUnqualifiedNameBefore(D, OriginalFullName); 603 appendUnqualifiedNameAfter(D, Inner); 604 } 605 606 void appendSubroutineNameAfter(DWARFDie D, DWARFDie Inner, 607 bool SkipFirstParamIfArtificial, bool Const, 608 bool Volatile) { 609 DWARFDie FirstParamIfArtificial; 610 OS << '('; 611 EndedWithTemplate = false; 612 bool First = true; 613 bool RealFirst = true; 614 for (DWARFDie P : D) { 615 if (P.getTag() != DW_TAG_formal_parameter) 616 return; 617 DWARFDie T = resolveReferencedType(P); 618 if (SkipFirstParamIfArtificial && RealFirst && P.find(DW_AT_artificial)) { 619 FirstParamIfArtificial = T; 620 RealFirst = false; 621 continue; 622 } 623 if (!First) { 624 OS << ", "; 625 } 626 First = false; 627 appendQualifiedName(T); 628 } 629 EndedWithTemplate = false; 630 OS << ')'; 631 if (FirstParamIfArtificial) { 632 if (DWARFDie P = FirstParamIfArtificial) { 633 if (P.getTag() == DW_TAG_pointer_type) { 634 DWARFDie C; 635 DWARFDie V; 636 auto CVStep = [&](DWARFDie CV) { 637 if (DWARFDie U = resolveReferencedType(CV)) { 638 if (U.getTag() == DW_TAG_const_type) 639 return C = U; 640 if (U.getTag() == DW_TAG_volatile_type) 641 return V = U; 642 } 643 return DWARFDie(); 644 }; 645 if (DWARFDie CV = CVStep(P)) { 646 CVStep(CV); 647 } 648 if (C) 649 OS << " const"; 650 if (V) 651 OS << " volatile"; 652 } 653 } 654 } else { 655 if (Const) 656 OS << " const"; 657 if (Volatile) 658 OS << " volatile"; 659 } 660 if (D.find(DW_AT_reference)) 661 OS << " &"; 662 if (D.find(DW_AT_rvalue_reference)) 663 OS << " &&"; 664 appendUnqualifiedNameAfter(Inner, resolveReferencedType(Inner)); 665 } 666 void appendScopes(DWARFDie D) { 667 if (D.getTag() == DW_TAG_compile_unit) 668 return; 669 if (D.getTag() == DW_TAG_type_unit) 670 return; 671 if (D.getTag() == DW_TAG_skeleton_unit) 672 return; 673 if (D.getTag() == DW_TAG_subprogram) 674 return; 675 D = D.resolveTypeUnitReference(); 676 if (DWARFDie P = D.getParent()) 677 appendScopes(P); 678 appendUnqualifiedName(D); 679 OS << "::"; 680 } 681 }; 682 } // anonymous namespace 683 684 static void dumpAttribute(raw_ostream &OS, const DWARFDie &Die, 685 const DWARFAttribute &AttrValue, unsigned Indent, 686 DIDumpOptions DumpOpts) { 687 if (!Die.isValid()) 688 return; 689 const char BaseIndent[] = " "; 690 OS << BaseIndent; 691 OS.indent(Indent + 2); 692 dwarf::Attribute Attr = AttrValue.Attr; 693 WithColor(OS, HighlightColor::Attribute) << formatv("{0}", Attr); 694 695 dwarf::Form Form = AttrValue.Value.getForm(); 696 if (DumpOpts.Verbose || DumpOpts.ShowForm) 697 OS << formatv(" [{0}]", Form); 698 699 DWARFUnit *U = Die.getDwarfUnit(); 700 const DWARFFormValue &FormValue = AttrValue.Value; 701 702 OS << "\t("; 703 704 StringRef Name; 705 std::string File; 706 auto Color = HighlightColor::Enumerator; 707 if (Attr == DW_AT_decl_file || Attr == DW_AT_call_file) { 708 Color = HighlightColor::String; 709 if (const auto *LT = U->getContext().getLineTableForUnit(U)) 710 if (LT->getFileNameByIndex( 711 FormValue.getAsUnsignedConstant().getValue(), 712 U->getCompilationDir(), 713 DILineInfoSpecifier::FileLineInfoKind::AbsoluteFilePath, File)) { 714 File = '"' + File + '"'; 715 Name = File; 716 } 717 } else if (Optional<uint64_t> Val = FormValue.getAsUnsignedConstant()) 718 Name = AttributeValueString(Attr, *Val); 719 720 if (!Name.empty()) 721 WithColor(OS, Color) << Name; 722 else if (Attr == DW_AT_decl_line || Attr == DW_AT_call_line) 723 OS << *FormValue.getAsUnsignedConstant(); 724 else if (Attr == DW_AT_low_pc && 725 (FormValue.getAsAddress() == 726 dwarf::computeTombstoneAddress(U->getAddressByteSize()))) { 727 if (DumpOpts.Verbose) { 728 FormValue.dump(OS, DumpOpts); 729 OS << " ("; 730 } 731 OS << "dead code"; 732 if (DumpOpts.Verbose) 733 OS << ')'; 734 } else if (Attr == DW_AT_high_pc && !DumpOpts.ShowForm && !DumpOpts.Verbose && 735 FormValue.getAsUnsignedConstant()) { 736 if (DumpOpts.ShowAddresses) { 737 // Print the actual address rather than the offset. 738 uint64_t LowPC, HighPC, Index; 739 if (Die.getLowAndHighPC(LowPC, HighPC, Index)) 740 DWARFFormValue::dumpAddress(OS, U->getAddressByteSize(), HighPC); 741 else 742 FormValue.dump(OS, DumpOpts); 743 } 744 } else if (DWARFAttribute::mayHaveLocationList(Attr) && 745 FormValue.isFormClass(DWARFFormValue::FC_SectionOffset)) 746 dumpLocationList(OS, FormValue, U, sizeof(BaseIndent) + Indent + 4, 747 DumpOpts); 748 else if (FormValue.isFormClass(DWARFFormValue::FC_Exprloc) || 749 (DWARFAttribute::mayHaveLocationExpr(Attr) && 750 FormValue.isFormClass(DWARFFormValue::FC_Block))) 751 dumpLocationExpr(OS, FormValue, U, sizeof(BaseIndent) + Indent + 4, 752 DumpOpts); 753 else 754 FormValue.dump(OS, DumpOpts); 755 756 std::string Space = DumpOpts.ShowAddresses ? " " : ""; 757 758 // We have dumped the attribute raw value. For some attributes 759 // having both the raw value and the pretty-printed value is 760 // interesting. These attributes are handled below. 761 if (Attr == DW_AT_specification || Attr == DW_AT_abstract_origin) { 762 if (const char *Name = 763 Die.getAttributeValueAsReferencedDie(FormValue).getName( 764 DINameKind::LinkageName)) 765 OS << Space << "\"" << Name << '\"'; 766 } else if (Attr == DW_AT_type) { 767 DWARFDie D = resolveReferencedType(Die, FormValue); 768 if (D && !D.isNULL()) { 769 OS << Space << "\""; 770 DWARFTypePrinter(OS).appendQualifiedName(D); 771 OS << '"'; 772 } 773 } else if (Attr == DW_AT_APPLE_property_attribute) { 774 if (Optional<uint64_t> OptVal = FormValue.getAsUnsignedConstant()) 775 dumpApplePropertyAttribute(OS, *OptVal); 776 } else if (Attr == DW_AT_ranges) { 777 const DWARFObject &Obj = Die.getDwarfUnit()->getContext().getDWARFObj(); 778 // For DW_FORM_rnglistx we need to dump the offset separately, since 779 // we have only dumped the index so far. 780 if (FormValue.getForm() == DW_FORM_rnglistx) 781 if (auto RangeListOffset = 782 U->getRnglistOffset(*FormValue.getAsSectionOffset())) { 783 DWARFFormValue FV = DWARFFormValue::createFromUValue( 784 dwarf::DW_FORM_sec_offset, *RangeListOffset); 785 FV.dump(OS, DumpOpts); 786 } 787 if (auto RangesOrError = Die.getAddressRanges()) 788 dumpRanges(Obj, OS, RangesOrError.get(), U->getAddressByteSize(), 789 sizeof(BaseIndent) + Indent + 4, DumpOpts); 790 else 791 DumpOpts.RecoverableErrorHandler(createStringError( 792 errc::invalid_argument, "decoding address ranges: %s", 793 toString(RangesOrError.takeError()).c_str())); 794 } 795 796 OS << ")\n"; 797 } 798 799 void DWARFDie::getFullName(raw_string_ostream &OS, 800 std::string *OriginalFullName) const { 801 const char *NamePtr = getShortName(); 802 if (!NamePtr) 803 return; 804 DWARFTypePrinter(OS).appendUnqualifiedName(*this, OriginalFullName); 805 } 806 807 bool DWARFDie::isSubprogramDIE() const { return getTag() == DW_TAG_subprogram; } 808 809 bool DWARFDie::isSubroutineDIE() const { 810 auto Tag = getTag(); 811 return Tag == DW_TAG_subprogram || Tag == DW_TAG_inlined_subroutine; 812 } 813 814 Optional<DWARFFormValue> DWARFDie::find(dwarf::Attribute Attr) const { 815 if (!isValid()) 816 return None; 817 auto AbbrevDecl = getAbbreviationDeclarationPtr(); 818 if (AbbrevDecl) 819 return AbbrevDecl->getAttributeValue(getOffset(), Attr, *U); 820 return None; 821 } 822 823 Optional<DWARFFormValue> 824 DWARFDie::find(ArrayRef<dwarf::Attribute> Attrs) const { 825 if (!isValid()) 826 return None; 827 auto AbbrevDecl = getAbbreviationDeclarationPtr(); 828 if (AbbrevDecl) { 829 for (auto Attr : Attrs) { 830 if (auto Value = AbbrevDecl->getAttributeValue(getOffset(), Attr, *U)) 831 return Value; 832 } 833 } 834 return None; 835 } 836 837 Optional<DWARFFormValue> 838 DWARFDie::findRecursively(ArrayRef<dwarf::Attribute> Attrs) const { 839 SmallVector<DWARFDie, 3> Worklist; 840 Worklist.push_back(*this); 841 842 // Keep track if DIEs already seen to prevent infinite recursion. 843 // Empirically we rarely see a depth of more than 3 when dealing with valid 844 // DWARF. This corresponds to following the DW_AT_abstract_origin and 845 // DW_AT_specification just once. 846 SmallSet<DWARFDie, 3> Seen; 847 Seen.insert(*this); 848 849 while (!Worklist.empty()) { 850 DWARFDie Die = Worklist.pop_back_val(); 851 852 if (!Die.isValid()) 853 continue; 854 855 if (auto Value = Die.find(Attrs)) 856 return Value; 857 858 if (auto D = Die.getAttributeValueAsReferencedDie(DW_AT_abstract_origin)) 859 if (Seen.insert(D).second) 860 Worklist.push_back(D); 861 862 if (auto D = Die.getAttributeValueAsReferencedDie(DW_AT_specification)) 863 if (Seen.insert(D).second) 864 Worklist.push_back(D); 865 } 866 867 return None; 868 } 869 870 DWARFDie 871 DWARFDie::getAttributeValueAsReferencedDie(dwarf::Attribute Attr) const { 872 if (Optional<DWARFFormValue> F = find(Attr)) 873 return getAttributeValueAsReferencedDie(*F); 874 return DWARFDie(); 875 } 876 877 DWARFDie 878 DWARFDie::getAttributeValueAsReferencedDie(const DWARFFormValue &V) const { 879 DWARFDie Result; 880 if (auto SpecRef = V.getAsRelativeReference()) { 881 if (SpecRef->Unit) 882 Result = SpecRef->Unit->getDIEForOffset(SpecRef->Unit->getOffset() + 883 SpecRef->Offset); 884 else if (auto SpecUnit = 885 U->getUnitVector().getUnitForOffset(SpecRef->Offset)) 886 Result = SpecUnit->getDIEForOffset(SpecRef->Offset); 887 } 888 return Result; 889 } 890 891 DWARFDie DWARFDie::resolveTypeUnitReference() const { 892 if (auto Attr = find(DW_AT_signature)) { 893 if (Optional<uint64_t> Sig = Attr->getAsReferenceUVal()) { 894 if (DWARFTypeUnit *TU = U->getContext().getTypeUnitForHash( 895 U->getVersion(), *Sig, U->isDWOUnit())) 896 return TU->getDIEForOffset(TU->getTypeOffset() + TU->getOffset()); 897 } 898 } 899 return *this; 900 } 901 902 Optional<uint64_t> DWARFDie::getRangesBaseAttribute() const { 903 return toSectionOffset(find({DW_AT_rnglists_base, DW_AT_GNU_ranges_base})); 904 } 905 906 Optional<uint64_t> DWARFDie::getLocBaseAttribute() const { 907 return toSectionOffset(find(DW_AT_loclists_base)); 908 } 909 910 Optional<uint64_t> DWARFDie::getHighPC(uint64_t LowPC) const { 911 uint64_t Tombstone = dwarf::computeTombstoneAddress(U->getAddressByteSize()); 912 if (LowPC == Tombstone) 913 return None; 914 if (auto FormValue = find(DW_AT_high_pc)) { 915 if (auto Address = FormValue->getAsAddress()) { 916 // High PC is an address. 917 return Address; 918 } 919 if (auto Offset = FormValue->getAsUnsignedConstant()) { 920 // High PC is an offset from LowPC. 921 return LowPC + *Offset; 922 } 923 } 924 return None; 925 } 926 927 bool DWARFDie::getLowAndHighPC(uint64_t &LowPC, uint64_t &HighPC, 928 uint64_t &SectionIndex) const { 929 auto F = find(DW_AT_low_pc); 930 auto LowPcAddr = toSectionedAddress(F); 931 if (!LowPcAddr) 932 return false; 933 if (auto HighPcAddr = getHighPC(LowPcAddr->Address)) { 934 LowPC = LowPcAddr->Address; 935 HighPC = *HighPcAddr; 936 SectionIndex = LowPcAddr->SectionIndex; 937 return true; 938 } 939 return false; 940 } 941 942 Expected<DWARFAddressRangesVector> DWARFDie::getAddressRanges() const { 943 if (isNULL()) 944 return DWARFAddressRangesVector(); 945 // Single range specified by low/high PC. 946 uint64_t LowPC, HighPC, Index; 947 if (getLowAndHighPC(LowPC, HighPC, Index)) 948 return DWARFAddressRangesVector{{LowPC, HighPC, Index}}; 949 950 Optional<DWARFFormValue> Value = find(DW_AT_ranges); 951 if (Value) { 952 if (Value->getForm() == DW_FORM_rnglistx) 953 return U->findRnglistFromIndex(*Value->getAsSectionOffset()); 954 return U->findRnglistFromOffset(*Value->getAsSectionOffset()); 955 } 956 return DWARFAddressRangesVector(); 957 } 958 959 bool DWARFDie::addressRangeContainsAddress(const uint64_t Address) const { 960 auto RangesOrError = getAddressRanges(); 961 if (!RangesOrError) { 962 llvm::consumeError(RangesOrError.takeError()); 963 return false; 964 } 965 966 for (const auto &R : RangesOrError.get()) 967 if (R.LowPC <= Address && Address < R.HighPC) 968 return true; 969 return false; 970 } 971 972 Expected<DWARFLocationExpressionsVector> 973 DWARFDie::getLocations(dwarf::Attribute Attr) const { 974 Optional<DWARFFormValue> Location = find(Attr); 975 if (!Location) 976 return createStringError(inconvertibleErrorCode(), "No %s", 977 dwarf::AttributeString(Attr).data()); 978 979 if (Optional<uint64_t> Off = Location->getAsSectionOffset()) { 980 uint64_t Offset = *Off; 981 982 if (Location->getForm() == DW_FORM_loclistx) { 983 if (auto LoclistOffset = U->getLoclistOffset(Offset)) 984 Offset = *LoclistOffset; 985 else 986 return createStringError(inconvertibleErrorCode(), 987 "Loclist table not found"); 988 } 989 return U->findLoclistFromOffset(Offset); 990 } 991 992 if (Optional<ArrayRef<uint8_t>> Expr = Location->getAsBlock()) { 993 return DWARFLocationExpressionsVector{ 994 DWARFLocationExpression{None, to_vector<4>(*Expr)}}; 995 } 996 997 return createStringError( 998 inconvertibleErrorCode(), "Unsupported %s encoding: %s", 999 dwarf::AttributeString(Attr).data(), 1000 dwarf::FormEncodingString(Location->getForm()).data()); 1001 } 1002 1003 const char *DWARFDie::getSubroutineName(DINameKind Kind) const { 1004 if (!isSubroutineDIE()) 1005 return nullptr; 1006 return getName(Kind); 1007 } 1008 1009 const char *DWARFDie::getName(DINameKind Kind) const { 1010 if (!isValid() || Kind == DINameKind::None) 1011 return nullptr; 1012 // Try to get mangled name only if it was asked for. 1013 if (Kind == DINameKind::LinkageName) { 1014 if (auto Name = getLinkageName()) 1015 return Name; 1016 } 1017 return getShortName(); 1018 } 1019 1020 const char *DWARFDie::getShortName() const { 1021 if (!isValid()) 1022 return nullptr; 1023 1024 return dwarf::toString(findRecursively(dwarf::DW_AT_name), nullptr); 1025 } 1026 1027 const char *DWARFDie::getLinkageName() const { 1028 if (!isValid()) 1029 return nullptr; 1030 1031 return dwarf::toString(findRecursively({dwarf::DW_AT_MIPS_linkage_name, 1032 dwarf::DW_AT_linkage_name}), 1033 nullptr); 1034 } 1035 1036 uint64_t DWARFDie::getDeclLine() const { 1037 return toUnsigned(findRecursively(DW_AT_decl_line), 0); 1038 } 1039 1040 std::string 1041 DWARFDie::getDeclFile(DILineInfoSpecifier::FileLineInfoKind Kind) const { 1042 if (auto FormValue = findRecursively(DW_AT_decl_file)) 1043 if (auto OptString = FormValue->getAsFile(Kind)) 1044 return *OptString; 1045 return {}; 1046 } 1047 1048 void DWARFDie::getCallerFrame(uint32_t &CallFile, uint32_t &CallLine, 1049 uint32_t &CallColumn, 1050 uint32_t &CallDiscriminator) const { 1051 CallFile = toUnsigned(find(DW_AT_call_file), 0); 1052 CallLine = toUnsigned(find(DW_AT_call_line), 0); 1053 CallColumn = toUnsigned(find(DW_AT_call_column), 0); 1054 CallDiscriminator = toUnsigned(find(DW_AT_GNU_discriminator), 0); 1055 } 1056 1057 /// Helper to dump a DIE with all of its parents, but no siblings. 1058 static unsigned dumpParentChain(DWARFDie Die, raw_ostream &OS, unsigned Indent, 1059 DIDumpOptions DumpOpts, unsigned Depth = 0) { 1060 if (!Die) 1061 return Indent; 1062 if (DumpOpts.ParentRecurseDepth > 0 && Depth >= DumpOpts.ParentRecurseDepth) 1063 return Indent; 1064 Indent = dumpParentChain(Die.getParent(), OS, Indent, DumpOpts, Depth + 1); 1065 Die.dump(OS, Indent, DumpOpts); 1066 return Indent + 2; 1067 } 1068 1069 void DWARFDie::dump(raw_ostream &OS, unsigned Indent, 1070 DIDumpOptions DumpOpts) const { 1071 if (!isValid()) 1072 return; 1073 DWARFDataExtractor debug_info_data = U->getDebugInfoExtractor(); 1074 const uint64_t Offset = getOffset(); 1075 uint64_t offset = Offset; 1076 if (DumpOpts.ShowParents) { 1077 DIDumpOptions ParentDumpOpts = DumpOpts; 1078 ParentDumpOpts.ShowParents = false; 1079 ParentDumpOpts.ShowChildren = false; 1080 Indent = dumpParentChain(getParent(), OS, Indent, ParentDumpOpts); 1081 } 1082 1083 if (debug_info_data.isValidOffset(offset)) { 1084 uint32_t abbrCode = debug_info_data.getULEB128(&offset); 1085 if (DumpOpts.ShowAddresses) 1086 WithColor(OS, HighlightColor::Address).get() 1087 << format("\n0x%8.8" PRIx64 ": ", Offset); 1088 1089 if (abbrCode) { 1090 auto AbbrevDecl = getAbbreviationDeclarationPtr(); 1091 if (AbbrevDecl) { 1092 WithColor(OS, HighlightColor::Tag).get().indent(Indent) 1093 << formatv("{0}", getTag()); 1094 if (DumpOpts.Verbose) { 1095 OS << format(" [%u] %c", abbrCode, 1096 AbbrevDecl->hasChildren() ? '*' : ' '); 1097 if (Optional<uint32_t> ParentIdx = Die->getParentIdx()) 1098 OS << format(" (0x%8.8" PRIx64 ")", 1099 U->getDIEAtIndex(*ParentIdx).getOffset()); 1100 } 1101 OS << '\n'; 1102 1103 // Dump all data in the DIE for the attributes. 1104 for (const DWARFAttribute &AttrValue : attributes()) 1105 dumpAttribute(OS, *this, AttrValue, Indent, DumpOpts); 1106 1107 if (DumpOpts.ShowChildren && DumpOpts.ChildRecurseDepth > 0) { 1108 DWARFDie Child = getFirstChild(); 1109 DumpOpts.ChildRecurseDepth--; 1110 DIDumpOptions ChildDumpOpts = DumpOpts; 1111 ChildDumpOpts.ShowParents = false; 1112 while (Child) { 1113 Child.dump(OS, Indent + 2, ChildDumpOpts); 1114 Child = Child.getSibling(); 1115 } 1116 } 1117 } else { 1118 OS << "Abbreviation code not found in 'debug_abbrev' class for code: " 1119 << abbrCode << '\n'; 1120 } 1121 } else { 1122 OS.indent(Indent) << "NULL\n"; 1123 } 1124 } 1125 } 1126 1127 LLVM_DUMP_METHOD void DWARFDie::dump() const { dump(llvm::errs(), 0); } 1128 1129 DWARFDie DWARFDie::getParent() const { 1130 if (isValid()) 1131 return U->getParent(Die); 1132 return DWARFDie(); 1133 } 1134 1135 DWARFDie DWARFDie::getSibling() const { 1136 if (isValid()) 1137 return U->getSibling(Die); 1138 return DWARFDie(); 1139 } 1140 1141 DWARFDie DWARFDie::getPreviousSibling() const { 1142 if (isValid()) 1143 return U->getPreviousSibling(Die); 1144 return DWARFDie(); 1145 } 1146 1147 DWARFDie DWARFDie::getFirstChild() const { 1148 if (isValid()) 1149 return U->getFirstChild(Die); 1150 return DWARFDie(); 1151 } 1152 1153 DWARFDie DWARFDie::getLastChild() const { 1154 if (isValid()) 1155 return U->getLastChild(Die); 1156 return DWARFDie(); 1157 } 1158 1159 iterator_range<DWARFDie::attribute_iterator> DWARFDie::attributes() const { 1160 return make_range(attribute_iterator(*this, false), 1161 attribute_iterator(*this, true)); 1162 } 1163 1164 DWARFDie::attribute_iterator::attribute_iterator(DWARFDie D, bool End) 1165 : Die(D), Index(0) { 1166 auto AbbrDecl = Die.getAbbreviationDeclarationPtr(); 1167 assert(AbbrDecl && "Must have abbreviation declaration"); 1168 if (End) { 1169 // This is the end iterator so we set the index to the attribute count. 1170 Index = AbbrDecl->getNumAttributes(); 1171 } else { 1172 // This is the begin iterator so we extract the value for this->Index. 1173 AttrValue.Offset = D.getOffset() + AbbrDecl->getCodeByteSize(); 1174 updateForIndex(*AbbrDecl, 0); 1175 } 1176 } 1177 1178 void DWARFDie::attribute_iterator::updateForIndex( 1179 const DWARFAbbreviationDeclaration &AbbrDecl, uint32_t I) { 1180 Index = I; 1181 // AbbrDecl must be valid before calling this function. 1182 auto NumAttrs = AbbrDecl.getNumAttributes(); 1183 if (Index < NumAttrs) { 1184 AttrValue.Attr = AbbrDecl.getAttrByIndex(Index); 1185 // Add the previous byte size of any previous attribute value. 1186 AttrValue.Offset += AttrValue.ByteSize; 1187 uint64_t ParseOffset = AttrValue.Offset; 1188 if (AbbrDecl.getAttrIsImplicitConstByIndex(Index)) 1189 AttrValue.Value = DWARFFormValue::createFromSValue( 1190 AbbrDecl.getFormByIndex(Index), 1191 AbbrDecl.getAttrImplicitConstValueByIndex(Index)); 1192 else { 1193 auto U = Die.getDwarfUnit(); 1194 assert(U && "Die must have valid DWARF unit"); 1195 AttrValue.Value = DWARFFormValue::createFromUnit( 1196 AbbrDecl.getFormByIndex(Index), U, &ParseOffset); 1197 } 1198 AttrValue.ByteSize = ParseOffset - AttrValue.Offset; 1199 } else { 1200 assert(Index == NumAttrs && "Indexes should be [0, NumAttrs) only"); 1201 AttrValue = {}; 1202 } 1203 } 1204 1205 DWARFDie::attribute_iterator &DWARFDie::attribute_iterator::operator++() { 1206 if (auto AbbrDecl = Die.getAbbreviationDeclarationPtr()) 1207 updateForIndex(*AbbrDecl, Index + 1); 1208 return *this; 1209 } 1210 1211 bool DWARFAttribute::mayHaveLocationList(dwarf::Attribute Attr) { 1212 switch(Attr) { 1213 case DW_AT_location: 1214 case DW_AT_string_length: 1215 case DW_AT_return_addr: 1216 case DW_AT_data_member_location: 1217 case DW_AT_frame_base: 1218 case DW_AT_static_link: 1219 case DW_AT_segment: 1220 case DW_AT_use_location: 1221 case DW_AT_vtable_elem_location: 1222 return true; 1223 default: 1224 return false; 1225 } 1226 } 1227 1228 bool DWARFAttribute::mayHaveLocationExpr(dwarf::Attribute Attr) { 1229 switch (Attr) { 1230 // From the DWARF v5 specification. 1231 case DW_AT_location: 1232 case DW_AT_byte_size: 1233 case DW_AT_bit_offset: 1234 case DW_AT_bit_size: 1235 case DW_AT_string_length: 1236 case DW_AT_lower_bound: 1237 case DW_AT_return_addr: 1238 case DW_AT_bit_stride: 1239 case DW_AT_upper_bound: 1240 case DW_AT_count: 1241 case DW_AT_data_member_location: 1242 case DW_AT_frame_base: 1243 case DW_AT_segment: 1244 case DW_AT_static_link: 1245 case DW_AT_use_location: 1246 case DW_AT_vtable_elem_location: 1247 case DW_AT_allocated: 1248 case DW_AT_associated: 1249 case DW_AT_data_location: 1250 case DW_AT_byte_stride: 1251 case DW_AT_rank: 1252 case DW_AT_call_value: 1253 case DW_AT_call_origin: 1254 case DW_AT_call_target: 1255 case DW_AT_call_target_clobbered: 1256 case DW_AT_call_data_location: 1257 case DW_AT_call_data_value: 1258 // Extensions. 1259 case DW_AT_GNU_call_site_value: 1260 case DW_AT_GNU_call_site_target: 1261 return true; 1262 default: 1263 return false; 1264 } 1265 } 1266