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 } 93 94 static void dumpLocationExpr(raw_ostream &OS, const DWARFFormValue &FormValue, 95 DWARFUnit *U, unsigned Indent, 96 DIDumpOptions DumpOpts) { 97 assert((FormValue.isFormClass(DWARFFormValue::FC_Block) || 98 FormValue.isFormClass(DWARFFormValue::FC_Exprloc)) && 99 "bad FORM for location expression"); 100 DWARFContext &Ctx = U->getContext(); 101 const MCRegisterInfo *MRI = Ctx.getRegisterInfo(); 102 ArrayRef<uint8_t> Expr = *FormValue.getAsBlock(); 103 DataExtractor Data(StringRef((const char *)Expr.data(), Expr.size()), 104 Ctx.isLittleEndian(), 0); 105 DWARFExpression(Data, U->getAddressByteSize(), U->getFormParams().Format) 106 .print(OS, DumpOpts, MRI, U); 107 } 108 109 static DWARFDie resolveReferencedType(DWARFDie D, 110 dwarf::Attribute Attr = DW_AT_type) { 111 return D.getAttributeValueAsReferencedDie(Attr).resolveTypeUnitReference(); 112 } 113 static DWARFDie resolveReferencedType(DWARFDie D, DWARFFormValue F) { 114 return D.getAttributeValueAsReferencedDie(F).resolveTypeUnitReference(); 115 } 116 117 namespace { 118 119 // FIXME: We should have pretty printers per language. Currently we print 120 // everything as if it was C++ and fall back to the TAG type name. 121 struct DWARFTypePrinter { 122 raw_ostream &OS; 123 bool Word = true; 124 bool EndedWithTemplate = false; 125 126 DWARFTypePrinter(raw_ostream &OS) : OS(OS) {} 127 128 /// Dump the name encoded in the type tag. 129 void appendTypeTagName(dwarf::Tag T) { 130 StringRef TagStr = TagString(T); 131 static constexpr StringRef Prefix = "DW_TAG_"; 132 static constexpr StringRef Suffix = "_type"; 133 if (!TagStr.startswith(Prefix) || !TagStr.endswith(Suffix)) 134 return; 135 OS << TagStr.substr(Prefix.size(), 136 TagStr.size() - (Prefix.size() + Suffix.size())) 137 << " "; 138 } 139 140 void appendArrayType(const DWARFDie &D) { 141 for (const DWARFDie &C : D.children()) { 142 if (C.getTag() != DW_TAG_subrange_type) 143 continue; 144 Optional<uint64_t> LB; 145 Optional<uint64_t> Count; 146 Optional<uint64_t> UB; 147 Optional<unsigned> DefaultLB; 148 if (Optional<DWARFFormValue> L = C.find(DW_AT_lower_bound)) 149 LB = L->getAsUnsignedConstant(); 150 if (Optional<DWARFFormValue> CountV = C.find(DW_AT_count)) 151 Count = CountV->getAsUnsignedConstant(); 152 if (Optional<DWARFFormValue> UpperV = C.find(DW_AT_upper_bound)) 153 UB = UpperV->getAsUnsignedConstant(); 154 if (Optional<DWARFFormValue> LV = 155 D.getDwarfUnit()->getUnitDIE().find(DW_AT_language)) 156 if (Optional<uint64_t> LC = LV->getAsUnsignedConstant()) 157 if ((DefaultLB = 158 LanguageLowerBound(static_cast<dwarf::SourceLanguage>(*LC)))) 159 if (LB && *LB == *DefaultLB) 160 LB = None; 161 if (!LB && !Count && !UB) 162 OS << "[]"; 163 else if (!LB && (Count || UB) && DefaultLB) 164 OS << '[' << (Count ? *Count : *UB - *DefaultLB + 1) << ']'; 165 else { 166 OS << "[["; 167 if (LB) 168 OS << *LB; 169 else 170 OS << '?'; 171 OS << ", "; 172 if (Count) 173 if (LB) 174 OS << *LB + *Count; 175 else 176 OS << "? + " << *Count; 177 else if (UB) 178 OS << *UB + 1; 179 else 180 OS << '?'; 181 OS << ")]"; 182 } 183 } 184 EndedWithTemplate = false; 185 } 186 187 DWARFDie skipQualifiers(DWARFDie D) { 188 while (D && (D.getTag() == DW_TAG_const_type || 189 D.getTag() == DW_TAG_volatile_type)) 190 D = resolveReferencedType(D); 191 return D; 192 } 193 194 bool needsParens(DWARFDie D) { 195 D = skipQualifiers(D); 196 return D && (D.getTag() == DW_TAG_subroutine_type || D.getTag() == DW_TAG_array_type); 197 } 198 199 void appendPointerLikeTypeBefore(DWARFDie D, DWARFDie Inner, StringRef Ptr) { 200 appendQualifiedNameBefore(Inner); 201 if (Word) 202 OS << ' '; 203 if (needsParens(Inner)) 204 OS << '('; 205 OS << Ptr; 206 Word = false; 207 EndedWithTemplate = false; 208 } 209 210 DWARFDie 211 appendUnqualifiedNameBefore(DWARFDie D, 212 std::string *OriginalFullName = nullptr) { 213 Word = true; 214 if (!D) { 215 OS << "void"; 216 return DWARFDie(); 217 } 218 DWARFDie Inner = resolveReferencedType(D); 219 const dwarf::Tag T = D.getTag(); 220 switch (T) { 221 case DW_TAG_pointer_type: { 222 appendPointerLikeTypeBefore(D, Inner, "*"); 223 break; 224 } 225 case DW_TAG_subroutine_type: { 226 appendQualifiedNameBefore(Inner); 227 if (Word) { 228 OS << ' '; 229 } 230 Word = false; 231 break; 232 } 233 case DW_TAG_array_type: { 234 appendQualifiedNameBefore(Inner); 235 break; 236 } 237 case DW_TAG_reference_type: 238 appendPointerLikeTypeBefore(D, Inner, "&"); 239 break; 240 case DW_TAG_rvalue_reference_type: 241 appendPointerLikeTypeBefore(D, Inner, "&&"); 242 break; 243 case DW_TAG_ptr_to_member_type: { 244 appendQualifiedNameBefore(Inner); 245 if (needsParens(Inner)) 246 OS << '('; 247 else if (Word) 248 OS << ' '; 249 if (DWARFDie Cont = resolveReferencedType(D, DW_AT_containing_type)) { 250 appendQualifiedName(Cont); 251 OS << "::"; 252 } 253 OS << "*"; 254 Word = false; 255 break; 256 } 257 case DW_TAG_const_type: 258 case DW_TAG_volatile_type: 259 appendConstVolatileQualifierBefore(D); 260 break; 261 case DW_TAG_namespace: { 262 if (const char *Name = dwarf::toString(D.find(DW_AT_name), nullptr)) 263 OS << Name; 264 else 265 OS << "(anonymous namespace)"; 266 break; 267 } 268 case DW_TAG_unspecified_type: { 269 StringRef TypeName = D.getShortName(); 270 if (TypeName == "decltype(nullptr)") 271 TypeName = "std::nullptr_t"; 272 Word = true; 273 OS << TypeName; 274 EndedWithTemplate = false; 275 break; 276 } 277 /* 278 case DW_TAG_structure_type: 279 case DW_TAG_class_type: 280 case DW_TAG_enumeration_type: 281 case DW_TAG_base_type: 282 */ 283 default: { 284 const char *NamePtr = dwarf::toString(D.find(DW_AT_name), nullptr); 285 if (!NamePtr) { 286 appendTypeTagName(D.getTag()); 287 return Inner; 288 } 289 Word = true; 290 StringRef Name = NamePtr; 291 static constexpr StringRef MangledPrefix = "_STN"; 292 if (Name.startswith(MangledPrefix)) { 293 Name = Name.drop_front(MangledPrefix.size()); 294 auto Separator = Name.find('|'); 295 assert(Separator != StringRef::npos); 296 StringRef BaseName = Name.substr(0, Separator); 297 StringRef TemplateArgs = Name.substr(Separator + 1); 298 if (OriginalFullName) 299 *OriginalFullName = (BaseName + TemplateArgs).str(); 300 Name = BaseName; 301 } else 302 EndedWithTemplate = Name.endswith(">"); 303 OS << Name; 304 // This check would be insufficient for operator overloads like 305 // "operator>>" - but for now Clang doesn't try to simplify them, so this 306 // is OK. Add more nuanced operator overload handling here if/when needed. 307 if (Name.endswith(">")) 308 break; 309 if (!appendTemplateParameters(D)) 310 break; 311 312 if (EndedWithTemplate) 313 OS << ' '; 314 OS << '>'; 315 EndedWithTemplate = true; 316 Word = true; 317 break; 318 } 319 } 320 return Inner; 321 } 322 323 void appendUnqualifiedNameAfter(DWARFDie D, DWARFDie Inner, 324 bool SkipFirstParamIfArtificial = false) { 325 if (!D) 326 return; 327 switch (D.getTag()) { 328 case DW_TAG_subroutine_type: { 329 appendSubroutineNameAfter(D, Inner, SkipFirstParamIfArtificial, false, 330 false); 331 break; 332 } 333 case DW_TAG_array_type: { 334 appendArrayType(D); 335 break; 336 } 337 case DW_TAG_const_type: 338 case DW_TAG_volatile_type: 339 appendConstVolatileQualifierAfter(D); 340 break; 341 case DW_TAG_ptr_to_member_type: 342 case DW_TAG_reference_type: 343 case DW_TAG_rvalue_reference_type: 344 case DW_TAG_pointer_type: { 345 if (needsParens(Inner)) 346 OS << ')'; 347 appendUnqualifiedNameAfter(Inner, resolveReferencedType(Inner), 348 /*SkipFirstParamIfArtificial=*/D.getTag() == 349 DW_TAG_ptr_to_member_type); 350 break; 351 } 352 /* 353 case DW_TAG_structure_type: 354 case DW_TAG_class_type: 355 case DW_TAG_enumeration_type: 356 case DW_TAG_base_type: 357 case DW_TAG_namespace: 358 */ 359 default: 360 break; 361 } 362 } 363 364 void appendQualifiedName(DWARFDie D) { 365 if (D) 366 appendScopes(D.getParent()); 367 appendUnqualifiedName(D); 368 } 369 DWARFDie appendQualifiedNameBefore(DWARFDie D) { 370 if (D) 371 appendScopes(D.getParent()); 372 return appendUnqualifiedNameBefore(D); 373 } 374 bool appendTemplateParameters(DWARFDie D, bool *FirstParameter = nullptr) { 375 bool FirstParameterValue = true; 376 bool IsTemplate = false; 377 if (!FirstParameter) 378 FirstParameter = &FirstParameterValue; 379 for (const DWARFDie &C : D) { 380 auto Sep = [&] { 381 if (*FirstParameter) 382 OS << '<'; 383 else 384 OS << ", "; 385 IsTemplate = true; 386 EndedWithTemplate = false; 387 *FirstParameter = false; 388 }; 389 if (C.getTag() == dwarf::DW_TAG_GNU_template_parameter_pack) { 390 IsTemplate = true; 391 appendTemplateParameters(C, FirstParameter); 392 } 393 if (C.getTag() == dwarf::DW_TAG_template_value_parameter) { 394 DWARFDie T = resolveReferencedType(C); 395 Sep(); 396 if (T.getTag() == DW_TAG_enumeration_type) { 397 auto V = C.find(DW_AT_const_value); 398 bool FoundEnumerator = false; 399 for (const DWARFDie &Enumerator : T) { 400 auto EV = Enumerator.find(DW_AT_const_value); 401 if (V && EV && 402 V->getAsSignedConstant() == EV->getAsSignedConstant()) { 403 if (T.find(DW_AT_enum_class)) { 404 appendQualifiedName(T); 405 OS << "::"; 406 } else 407 appendScopes(T.getParent()); 408 OS << Enumerator.getShortName(); 409 FoundEnumerator = true; 410 break; 411 } 412 } 413 if (FoundEnumerator) 414 continue; 415 OS << '('; 416 appendQualifiedName(T); 417 OS << ')'; 418 OS << to_string(*V->getAsSignedConstant()); 419 continue; 420 } 421 // /Maybe/ we could do pointer type parameters, looking for the 422 // symbol in the ELF symbol table to get back to the variable... 423 // but probably not worth it. 424 if (T.getTag() == DW_TAG_pointer_type) 425 continue; 426 const char *RawName = dwarf::toString(T.find(DW_AT_name), nullptr); 427 assert(RawName); 428 StringRef Name = RawName; 429 auto V = C.find(DW_AT_const_value); 430 bool IsQualifiedChar = false; 431 if (Name == "bool") { 432 OS << (*V->getAsUnsignedConstant() ? "true" : "false"); 433 } else if (Name == "short") { 434 OS << "(short)"; 435 OS << to_string(*V->getAsSignedConstant()); 436 } else if (Name == "unsigned short") { 437 OS << "(unsigned short)"; 438 OS << to_string(*V->getAsSignedConstant()); 439 } else if (Name == "int") 440 OS << to_string(*V->getAsSignedConstant()); 441 else if (Name == "long") { 442 OS << to_string(*V->getAsSignedConstant()); 443 OS << "L"; 444 } else if (Name == "long long") { 445 OS << to_string(*V->getAsSignedConstant()); 446 OS << "LL"; 447 } else if (Name == "unsigned int") { 448 OS << to_string(*V->getAsUnsignedConstant()); 449 OS << "U"; 450 } else if (Name == "unsigned long") { 451 OS << to_string(*V->getAsUnsignedConstant()); 452 OS << "UL"; 453 } else if (Name == "unsigned long long") { 454 OS << to_string(*V->getAsUnsignedConstant()); 455 OS << "ULL"; 456 } else if (Name == "char" || 457 (IsQualifiedChar = 458 (Name == "unsigned char" || Name == "signed char"))) { 459 // FIXME: check T's DW_AT_type to see if it's signed or not (since 460 // char signedness is implementation defined). 461 auto Val = *V->getAsSignedConstant(); 462 // Copied/hacked up from Clang's CharacterLiteral::print - incomplete 463 // (doesn't actually support different character types/widths, sign 464 // handling's not done, and doesn't correctly test if a character is 465 // printable or needs to use a numeric escape sequence instead) 466 if (IsQualifiedChar) { 467 OS << '('; 468 OS << Name; 469 OS << ')'; 470 } 471 switch (Val) { 472 case '\\': 473 OS << "'\\\\'"; 474 break; 475 case '\'': 476 OS << "'\\''"; 477 break; 478 case '\a': 479 // TODO: K&R: the meaning of '\\a' is different in traditional C 480 OS << "'\\a'"; 481 break; 482 case '\b': 483 OS << "'\\b'"; 484 break; 485 case '\f': 486 OS << "'\\f'"; 487 break; 488 case '\n': 489 OS << "'\\n'"; 490 break; 491 case '\r': 492 OS << "'\\r'"; 493 break; 494 case '\t': 495 OS << "'\\t'"; 496 break; 497 case '\v': 498 OS << "'\\v'"; 499 break; 500 default: 501 if ((Val & ~0xFFu) == ~0xFFu) 502 Val &= 0xFFu; 503 if (Val < 127 && Val >= 32) { 504 OS << "'"; 505 OS << (char)Val; 506 OS << "'"; 507 } else if (Val < 256) 508 OS << to_string(llvm::format("'\\x%02x'", Val)); 509 else if (Val <= 0xFFFF) 510 OS << to_string(llvm::format("'\\u%04x'", Val)); 511 else 512 OS << to_string(llvm::format("'\\U%08x'", Val)); 513 } 514 } 515 continue; 516 } 517 if (C.getTag() == dwarf::DW_TAG_GNU_template_template_param) { 518 const char *RawName = 519 dwarf::toString(C.find(DW_AT_GNU_template_name), nullptr); 520 assert(RawName); 521 StringRef Name = RawName; 522 Sep(); 523 OS << Name; 524 continue; 525 } 526 if (C.getTag() != dwarf::DW_TAG_template_type_parameter) 527 continue; 528 auto TypeAttr = C.find(DW_AT_type); 529 Sep(); 530 appendQualifiedName(TypeAttr ? resolveReferencedType(C, *TypeAttr) 531 : DWARFDie()); 532 } 533 if (IsTemplate && *FirstParameter && FirstParameter == &FirstParameterValue) 534 OS << '<'; 535 return IsTemplate; 536 } 537 void decomposeConstVolatile(DWARFDie &N, DWARFDie &T, DWARFDie &C, 538 DWARFDie &V) { 539 (N.getTag() == DW_TAG_const_type ? C : V) = N; 540 T = resolveReferencedType(N); 541 if (T) { 542 auto Tag = T.getTag(); 543 if (Tag == DW_TAG_const_type) { 544 C = T; 545 T = resolveReferencedType(T); 546 } else if (Tag == DW_TAG_volatile_type) { 547 V = T; 548 T = resolveReferencedType(T); 549 } 550 } 551 } 552 void appendConstVolatileQualifierAfter(DWARFDie N) { 553 DWARFDie C; 554 DWARFDie V; 555 DWARFDie T; 556 decomposeConstVolatile(N, T, C, V); 557 if (T && T.getTag() == DW_TAG_subroutine_type) 558 appendSubroutineNameAfter(T, resolveReferencedType(T), false, C.isValid(), 559 V.isValid()); 560 else 561 appendUnqualifiedNameAfter(T, resolveReferencedType(T)); 562 } 563 void appendConstVolatileQualifierBefore(DWARFDie N) { 564 DWARFDie C; 565 DWARFDie V; 566 DWARFDie T; 567 decomposeConstVolatile(N, T, C, V); 568 bool Subroutine = T && T.getTag() == DW_TAG_subroutine_type; 569 DWARFDie A = T; 570 while (A && A.getTag() == DW_TAG_array_type) 571 A = resolveReferencedType(A); 572 bool Leading = 573 (!A || (A.getTag() != DW_TAG_pointer_type && 574 A.getTag() != llvm::dwarf::DW_TAG_ptr_to_member_type)) && 575 !Subroutine; 576 if (Leading) { 577 if (C) 578 OS << "const "; 579 if (V) 580 OS << "volatile "; 581 } 582 appendQualifiedNameBefore(T); 583 if (!Leading && !Subroutine) { 584 Word = true; 585 if (C) 586 OS << "const"; 587 if (V) { 588 if (C) 589 OS << ' '; 590 OS << "volatile"; 591 } 592 } 593 } 594 595 /// Recursively append the DIE type name when applicable. 596 void appendUnqualifiedName(DWARFDie D, 597 std::string *OriginalFullName = nullptr) { 598 // FIXME: We should have pretty printers per language. Currently we print 599 // everything as if it was C++ and fall back to the TAG type name. 600 DWARFDie Inner = appendUnqualifiedNameBefore(D, OriginalFullName); 601 appendUnqualifiedNameAfter(D, Inner); 602 } 603 604 void appendSubroutineNameAfter(DWARFDie D, DWARFDie Inner, 605 bool SkipFirstParamIfArtificial, bool Const, 606 bool Volatile) { 607 DWARFDie FirstParamIfArtificial; 608 OS << '('; 609 EndedWithTemplate = false; 610 bool First = true; 611 bool RealFirst = true; 612 for (DWARFDie P : D) { 613 if (P.getTag() != DW_TAG_formal_parameter) 614 return; 615 DWARFDie T = resolveReferencedType(P); 616 if (SkipFirstParamIfArtificial && RealFirst && P.find(DW_AT_artificial)) { 617 FirstParamIfArtificial = T; 618 RealFirst = false; 619 continue; 620 } 621 if (!First) { 622 OS << ", "; 623 } 624 First = false; 625 appendQualifiedName(T); 626 } 627 EndedWithTemplate = false; 628 OS << ')'; 629 if (FirstParamIfArtificial) { 630 if (DWARFDie P = FirstParamIfArtificial) { 631 if (P.getTag() == DW_TAG_pointer_type) { 632 DWARFDie C; 633 DWARFDie V; 634 auto CVStep = [&](DWARFDie CV) { 635 if (DWARFDie U = resolveReferencedType(CV)) { 636 if (U.getTag() == DW_TAG_const_type) 637 return C = U; 638 if (U.getTag() == DW_TAG_volatile_type) 639 return V = U; 640 } 641 return DWARFDie(); 642 }; 643 if (DWARFDie CV = CVStep(P)) { 644 CVStep(CV); 645 } 646 if (C) 647 OS << " const"; 648 if (V) 649 OS << " volatile"; 650 } 651 } 652 } else { 653 if (Const) 654 OS << " const"; 655 if (Volatile) 656 OS << " volatile"; 657 } 658 if (D.find(DW_AT_reference)) 659 OS << " &"; 660 if (D.find(DW_AT_rvalue_reference)) 661 OS << " &&"; 662 appendUnqualifiedNameAfter(Inner, resolveReferencedType(Inner)); 663 } 664 void appendScopes(DWARFDie D) { 665 if (D.getTag() == DW_TAG_compile_unit) 666 return; 667 if (D.getTag() == DW_TAG_type_unit) 668 return; 669 if (D.getTag() == DW_TAG_skeleton_unit) 670 return; 671 if (D.getTag() == DW_TAG_subprogram) 672 return; 673 if (D.getTag() == DW_TAG_lexical_block) 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