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