LLVM  15.0.0git
DWARFDie.cpp
Go to the documentation of this file.
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 
10 #include "llvm/ADT/None.h"
11 #include "llvm/ADT/Optional.h"
12 #include "llvm/ADT/SmallSet.h"
13 #include "llvm/ADT/StringRef.h"
24 #include "llvm/Object/ObjectFile.h"
26 #include "llvm/Support/Format.h"
29 #include "llvm/Support/WithColor.h"
31 #include <cassert>
32 #include <cinttypes>
33 #include <cstdint>
34 #include <string>
35 #include <utility>
36 
37 using namespace llvm;
38 using namespace dwarf;
39 using namespace object;
40 
42  OS << " (";
43  do {
45  assert(Shift < 64 && "undefined behavior");
46  uint64_t Bit = 1ULL << Shift;
47  auto PropName = ApplePropertyString(Bit);
48  if (!PropName.empty())
49  OS << PropName;
50  else
51  OS << format("DW_APPLE_PROPERTY_0x%" PRIx64, Bit);
52  if (!(Val ^= Bit))
53  break;
54  OS << ", ";
55  } while (true);
56  OS << ")";
57 }
58 
59 static void dumpRanges(const DWARFObject &Obj, raw_ostream &OS,
60  const DWARFAddressRangesVector &Ranges,
61  unsigned AddressSize, unsigned Indent,
62  const DIDumpOptions &DumpOpts) {
63  if (!DumpOpts.ShowAddresses)
64  return;
65 
66  for (const DWARFAddressRange &R : Ranges) {
67  OS << '\n';
68  OS.indent(Indent);
69  R.dump(OS, AddressSize, DumpOpts, &Obj);
70  }
71 }
72 
73 static void dumpLocationList(raw_ostream &OS, const DWARFFormValue &FormValue,
74  DWARFUnit *U, unsigned Indent,
75  DIDumpOptions DumpOpts) {
77  "bad FORM for location list");
78  DWARFContext &Ctx = U->getContext();
79  const MCRegisterInfo *MRI = Ctx.getRegisterInfo();
80  uint64_t Offset = *FormValue.getAsSectionOffset();
81 
82  if (FormValue.getForm() == DW_FORM_loclistx) {
83  FormValue.dump(OS, DumpOpts);
84 
85  if (auto LoclistOffset = U->getLoclistOffset(Offset))
86  Offset = *LoclistOffset;
87  else
88  return;
89  }
90  U->getLocationTable().dumpLocationList(&Offset, OS, U->getBaseAddress(), MRI,
91  Ctx.getDWARFObj(), U, DumpOpts,
92  Indent);
93 }
94 
95 static void dumpLocationExpr(raw_ostream &OS, const DWARFFormValue &FormValue,
96  DWARFUnit *U, unsigned Indent,
97  DIDumpOptions DumpOpts) {
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);
107  .print(OS, DumpOpts, MRI, U);
108 }
109 
111  return D.getAttributeValueAsReferencedDie(F).resolveTypeUnitReference();
112 }
113 
114 static void dumpAttribute(raw_ostream &OS, const DWARFDie &Die,
115  const DWARFAttribute &AttrValue, unsigned Indent,
116  DIDumpOptions DumpOpts) {
117  if (!Die.isValid())
118  return;
119  const char BaseIndent[] = " ";
120  OS << BaseIndent;
121  OS.indent(Indent + 2);
122  dwarf::Attribute Attr = AttrValue.Attr;
123  WithColor(OS, HighlightColor::Attribute) << formatv("{0}", Attr);
124 
125  dwarf::Form Form = AttrValue.Value.getForm();
126  if (DumpOpts.Verbose || DumpOpts.ShowForm)
127  OS << formatv(" [{0}]", Form);
128 
129  DWARFUnit *U = Die.getDwarfUnit();
130  const DWARFFormValue &FormValue = AttrValue.Value;
131 
132  OS << "\t(";
133 
134  StringRef Name;
135  std::string File;
136  auto Color = HighlightColor::Enumerator;
137  if (Attr == DW_AT_decl_file || Attr == DW_AT_call_file) {
138  Color = HighlightColor::String;
139  if (const auto *LT = U->getContext().getLineTableForUnit(U))
140  if (LT->getFileNameByIndex(
141  *FormValue.getAsUnsignedConstant(), U->getCompilationDir(),
143  File = '"' + File + '"';
144  Name = File;
145  }
146  } else if (Optional<uint64_t> Val = FormValue.getAsUnsignedConstant())
147  Name = AttributeValueString(Attr, *Val);
148 
149  if (!Name.empty())
150  WithColor(OS, Color) << Name;
151  else if (Attr == DW_AT_decl_line || Attr == DW_AT_call_line)
152  OS << *FormValue.getAsUnsignedConstant();
153  else if (Attr == DW_AT_low_pc &&
154  (FormValue.getAsAddress() ==
156  if (DumpOpts.Verbose) {
157  FormValue.dump(OS, DumpOpts);
158  OS << " (";
159  }
160  OS << "dead code";
161  if (DumpOpts.Verbose)
162  OS << ')';
163  } else if (Attr == DW_AT_high_pc && !DumpOpts.ShowForm && !DumpOpts.Verbose &&
164  FormValue.getAsUnsignedConstant()) {
165  if (DumpOpts.ShowAddresses) {
166  // Print the actual address rather than the offset.
167  uint64_t LowPC, HighPC, Index;
168  if (Die.getLowAndHighPC(LowPC, HighPC, Index))
170  else
171  FormValue.dump(OS, DumpOpts);
172  }
173  } else if (DWARFAttribute::mayHaveLocationList(Attr) &&
175  dumpLocationList(OS, FormValue, U, sizeof(BaseIndent) + Indent + 4,
176  DumpOpts);
177  else if (FormValue.isFormClass(DWARFFormValue::FC_Exprloc) ||
180  dumpLocationExpr(OS, FormValue, U, sizeof(BaseIndent) + Indent + 4,
181  DumpOpts);
182  else
183  FormValue.dump(OS, DumpOpts);
184 
185  std::string Space = DumpOpts.ShowAddresses ? " " : "";
186 
187  // We have dumped the attribute raw value. For some attributes
188  // having both the raw value and the pretty-printed value is
189  // interesting. These attributes are handled below.
190  if (Attr == DW_AT_specification || Attr == DW_AT_abstract_origin) {
191  if (const char *Name =
194  OS << Space << "\"" << Name << '\"';
195  } else if (Attr == DW_AT_type || Attr == DW_AT_containing_type) {
196  DWARFDie D = resolveReferencedType(Die, FormValue);
197  if (D && !D.isNULL()) {
198  OS << Space << "\"";
200  OS << '"';
201  }
202  } else if (Attr == DW_AT_APPLE_property_attribute) {
203  if (Optional<uint64_t> OptVal = FormValue.getAsUnsignedConstant())
204  dumpApplePropertyAttribute(OS, *OptVal);
205  } else if (Attr == DW_AT_ranges) {
206  const DWARFObject &Obj = Die.getDwarfUnit()->getContext().getDWARFObj();
207  // For DW_FORM_rnglistx we need to dump the offset separately, since
208  // we have only dumped the index so far.
209  if (FormValue.getForm() == DW_FORM_rnglistx)
210  if (auto RangeListOffset =
211  U->getRnglistOffset(*FormValue.getAsSectionOffset())) {
213  dwarf::DW_FORM_sec_offset, *RangeListOffset);
214  FV.dump(OS, DumpOpts);
215  }
216  if (auto RangesOrError = Die.getAddressRanges())
217  dumpRanges(Obj, OS, RangesOrError.get(), U->getAddressByteSize(),
218  sizeof(BaseIndent) + Indent + 4, DumpOpts);
219  else
221  errc::invalid_argument, "decoding address ranges: %s",
222  toString(RangesOrError.takeError()).c_str()));
223  }
224 
225  OS << ")\n";
226 }
227 
229  std::string *OriginalFullName) const {
230  const char *NamePtr = getShortName();
231  if (!NamePtr)
232  return;
233  if (getTag() == DW_TAG_GNU_template_parameter_pack)
234  return;
235  dumpTypeUnqualifiedName(*this, OS, OriginalFullName);
236 }
237 
238 bool DWARFDie::isSubprogramDIE() const { return getTag() == DW_TAG_subprogram; }
239 
241  auto Tag = getTag();
242  return Tag == DW_TAG_subprogram || Tag == DW_TAG_inlined_subroutine;
243 }
244 
246  if (!isValid())
247  return None;
248  auto AbbrevDecl = getAbbreviationDeclarationPtr();
249  if (AbbrevDecl)
250  return AbbrevDecl->getAttributeValue(getOffset(), Attr, *U);
251  return None;
252 }
253 
256  if (!isValid())
257  return None;
258  auto AbbrevDecl = getAbbreviationDeclarationPtr();
259  if (AbbrevDecl) {
260  for (auto Attr : Attrs) {
261  if (auto Value = AbbrevDecl->getAttributeValue(getOffset(), Attr, *U))
262  return Value;
263  }
264  }
265  return None;
266 }
267 
270  SmallVector<DWARFDie, 3> Worklist;
271  Worklist.push_back(*this);
272 
273  // Keep track if DIEs already seen to prevent infinite recursion.
274  // Empirically we rarely see a depth of more than 3 when dealing with valid
275  // DWARF. This corresponds to following the DW_AT_abstract_origin and
276  // DW_AT_specification just once.
278  Seen.insert(*this);
279 
280  while (!Worklist.empty()) {
281  DWARFDie Die = Worklist.pop_back_val();
282 
283  if (!Die.isValid())
284  continue;
285 
286  if (auto Value = Die.find(Attrs))
287  return Value;
288 
289  if (auto D = Die.getAttributeValueAsReferencedDie(DW_AT_abstract_origin))
290  if (Seen.insert(D).second)
291  Worklist.push_back(D);
292 
293  if (auto D = Die.getAttributeValueAsReferencedDie(DW_AT_specification))
294  if (Seen.insert(D).second)
295  Worklist.push_back(D);
296  }
297 
298  return None;
299 }
300 
301 DWARFDie
303  if (Optional<DWARFFormValue> F = find(Attr))
304  return getAttributeValueAsReferencedDie(*F);
305  return DWARFDie();
306 }
307 
308 DWARFDie
310  DWARFDie Result;
311  if (auto SpecRef = V.getAsRelativeReference()) {
312  if (SpecRef->Unit)
313  Result = SpecRef->Unit->getDIEForOffset(SpecRef->Unit->getOffset() +
314  SpecRef->Offset);
315  else if (auto SpecUnit =
316  U->getUnitVector().getUnitForOffset(SpecRef->Offset))
317  Result = SpecUnit->getDIEForOffset(SpecRef->Offset);
318  }
319  return Result;
320 }
321 
323  if (auto Attr = find(DW_AT_signature)) {
324  if (Optional<uint64_t> Sig = Attr->getAsReferenceUVal()) {
326  U->getVersion(), *Sig, U->isDWOUnit()))
327  return TU->getDIEForOffset(TU->getTypeOffset() + TU->getOffset());
328  }
329  }
330  return *this;
331 }
332 
334  return toSectionOffset(find({DW_AT_rnglists_base, DW_AT_GNU_ranges_base}));
335 }
336 
338  return toSectionOffset(find(DW_AT_loclists_base));
339 }
340 
342  uint64_t Tombstone = dwarf::computeTombstoneAddress(U->getAddressByteSize());
343  if (LowPC == Tombstone)
344  return None;
345  if (auto FormValue = find(DW_AT_high_pc)) {
346  if (auto Address = FormValue->getAsAddress()) {
347  // High PC is an address.
348  return Address;
349  }
350  if (auto Offset = FormValue->getAsUnsignedConstant()) {
351  // High PC is an offset from LowPC.
352  return LowPC + *Offset;
353  }
354  }
355  return None;
356 }
357 
359  uint64_t &SectionIndex) const {
360  auto F = find(DW_AT_low_pc);
361  auto LowPcAddr = toSectionedAddress(F);
362  if (!LowPcAddr)
363  return false;
364  if (auto HighPcAddr = getHighPC(LowPcAddr->Address)) {
365  LowPC = LowPcAddr->Address;
366  HighPC = *HighPcAddr;
367  SectionIndex = LowPcAddr->SectionIndex;
368  return true;
369  }
370  return false;
371 }
372 
374  if (isNULL())
375  return DWARFAddressRangesVector();
376  // Single range specified by low/high PC.
377  uint64_t LowPC, HighPC, Index;
378  if (getLowAndHighPC(LowPC, HighPC, Index))
379  return DWARFAddressRangesVector{{LowPC, HighPC, Index}};
380 
381  Optional<DWARFFormValue> Value = find(DW_AT_ranges);
382  if (Value) {
383  if (Value->getForm() == DW_FORM_rnglistx)
384  return U->findRnglistFromIndex(*Value->getAsSectionOffset());
385  return U->findRnglistFromOffset(*Value->getAsSectionOffset());
386  }
387  return DWARFAddressRangesVector();
388 }
389 
391  auto RangesOrError = getAddressRanges();
392  if (!RangesOrError) {
393  llvm::consumeError(RangesOrError.takeError());
394  return false;
395  }
396 
397  for (const auto &R : RangesOrError.get())
398  if (R.LowPC <= Address && Address < R.HighPC)
399  return true;
400  return false;
401 }
402 
405  Optional<DWARFFormValue> Location = find(Attr);
406  if (!Location)
407  return createStringError(inconvertibleErrorCode(), "No %s",
408  dwarf::AttributeString(Attr).data());
409 
410  if (Optional<uint64_t> Off = Location->getAsSectionOffset()) {
411  uint64_t Offset = *Off;
412 
413  if (Location->getForm() == DW_FORM_loclistx) {
414  if (auto LoclistOffset = U->getLoclistOffset(Offset))
415  Offset = *LoclistOffset;
416  else
418  "Loclist table not found");
419  }
420  return U->findLoclistFromOffset(Offset);
421  }
422 
423  if (Optional<ArrayRef<uint8_t>> Expr = Location->getAsBlock()) {
425  DWARFLocationExpression{None, to_vector<4>(*Expr)}};
426  }
427 
428  return createStringError(
429  inconvertibleErrorCode(), "Unsupported %s encoding: %s",
430  dwarf::AttributeString(Attr).data(),
431  dwarf::FormEncodingString(Location->getForm()).data());
432 }
433 
435  if (!isSubroutineDIE())
436  return nullptr;
437  return getName(Kind);
438 }
439 
440 const char *DWARFDie::getName(DINameKind Kind) const {
441  if (!isValid() || Kind == DINameKind::None)
442  return nullptr;
443  // Try to get mangled name only if it was asked for.
444  if (Kind == DINameKind::LinkageName) {
445  if (auto Name = getLinkageName())
446  return Name;
447  }
448  return getShortName();
449 }
450 
451 const char *DWARFDie::getShortName() const {
452  if (!isValid())
453  return nullptr;
454 
455  return dwarf::toString(findRecursively(dwarf::DW_AT_name), nullptr);
456 }
457 
458 const char *DWARFDie::getLinkageName() const {
459  if (!isValid())
460  return nullptr;
461 
462  return dwarf::toString(findRecursively({dwarf::DW_AT_MIPS_linkage_name,
463  dwarf::DW_AT_linkage_name}),
464  nullptr);
465 }
466 
468  return toUnsigned(findRecursively(DW_AT_decl_line), 0);
469 }
470 
471 std::string
473  if (auto FormValue = findRecursively(DW_AT_decl_file))
474  if (auto OptString = FormValue->getAsFile(Kind))
475  return *OptString;
476  return {};
477 }
478 
479 void DWARFDie::getCallerFrame(uint32_t &CallFile, uint32_t &CallLine,
480  uint32_t &CallColumn,
481  uint32_t &CallDiscriminator) const {
482  CallFile = toUnsigned(find(DW_AT_call_file), 0);
483  CallLine = toUnsigned(find(DW_AT_call_line), 0);
484  CallColumn = toUnsigned(find(DW_AT_call_column), 0);
485  CallDiscriminator = toUnsigned(find(DW_AT_GNU_discriminator), 0);
486 }
487 
489  if (auto SizeAttr = find(DW_AT_byte_size))
490  if (Optional<uint64_t> Size = SizeAttr->getAsUnsignedConstant())
491  return Size;
492 
493  switch (getTag()) {
494  case DW_TAG_pointer_type:
495  case DW_TAG_reference_type:
496  case DW_TAG_rvalue_reference_type:
497  return PointerSize;
498  case DW_TAG_ptr_to_member_type: {
499  if (DWARFDie BaseType = getAttributeValueAsReferencedDie(DW_AT_type))
500  if (BaseType.getTag() == DW_TAG_subroutine_type)
501  return 2 * PointerSize;
502  return PointerSize;
503  }
504  case DW_TAG_const_type:
505  case DW_TAG_immutable_type:
506  case DW_TAG_volatile_type:
507  case DW_TAG_restrict_type:
508  case DW_TAG_typedef: {
509  if (DWARFDie BaseType = getAttributeValueAsReferencedDie(DW_AT_type))
510  return BaseType.getTypeSize(PointerSize);
511  break;
512  }
513  case DW_TAG_array_type: {
514  DWARFDie BaseType = getAttributeValueAsReferencedDie(DW_AT_type);
515  if (!BaseType)
516  return None;
517  Optional<uint64_t> BaseSize = BaseType.getTypeSize(PointerSize);
518  if (!BaseSize)
519  return None;
520  uint64_t Size = *BaseSize;
521  for (DWARFDie Child : *this) {
522  if (Child.getTag() != DW_TAG_subrange_type)
523  continue;
524 
525  if (auto ElemCountAttr = Child.find(DW_AT_count))
526  if (Optional<uint64_t> ElemCount =
527  ElemCountAttr->getAsUnsignedConstant())
528  Size *= *ElemCount;
529  if (auto UpperBoundAttr = Child.find(DW_AT_upper_bound))
530  if (Optional<int64_t> UpperBound =
531  UpperBoundAttr->getAsSignedConstant()) {
532  int64_t LowerBound = 0;
533  if (auto LowerBoundAttr = Child.find(DW_AT_lower_bound))
534  LowerBound = LowerBoundAttr->getAsSignedConstant().value_or(0);
535  Size *= *UpperBound - LowerBound + 1;
536  }
537  }
538  return Size;
539  }
540  default:
541  if (DWARFDie BaseType = getAttributeValueAsReferencedDie(DW_AT_type))
542  return BaseType.getTypeSize(PointerSize);
543  break;
544  }
545  return None;
546 }
547 
548 /// Helper to dump a DIE with all of its parents, but no siblings.
549 static unsigned dumpParentChain(DWARFDie Die, raw_ostream &OS, unsigned Indent,
550  DIDumpOptions DumpOpts, unsigned Depth = 0) {
551  if (!Die)
552  return Indent;
553  if (DumpOpts.ParentRecurseDepth > 0 && Depth >= DumpOpts.ParentRecurseDepth)
554  return Indent;
555  Indent = dumpParentChain(Die.getParent(), OS, Indent, DumpOpts, Depth + 1);
556  Die.dump(OS, Indent, DumpOpts);
557  return Indent + 2;
558 }
559 
560 void DWARFDie::dump(raw_ostream &OS, unsigned Indent,
561  DIDumpOptions DumpOpts) const {
562  if (!isValid())
563  return;
564  DWARFDataExtractor debug_info_data = U->getDebugInfoExtractor();
565  const uint64_t Offset = getOffset();
566  uint64_t offset = Offset;
567  if (DumpOpts.ShowParents) {
568  DIDumpOptions ParentDumpOpts = DumpOpts;
569  ParentDumpOpts.ShowParents = false;
570  ParentDumpOpts.ShowChildren = false;
571  Indent = dumpParentChain(getParent(), OS, Indent, ParentDumpOpts);
572  }
573 
574  if (debug_info_data.isValidOffset(offset)) {
575  uint32_t abbrCode = debug_info_data.getULEB128(&offset);
576  if (DumpOpts.ShowAddresses)
578  << format("\n0x%8.8" PRIx64 ": ", Offset);
579 
580  if (abbrCode) {
581  auto AbbrevDecl = getAbbreviationDeclarationPtr();
582  if (AbbrevDecl) {
583  WithColor(OS, HighlightColor::Tag).get().indent(Indent)
584  << formatv("{0}", getTag());
585  if (DumpOpts.Verbose) {
586  OS << format(" [%u] %c", abbrCode,
587  AbbrevDecl->hasChildren() ? '*' : ' ');
588  if (Optional<uint32_t> ParentIdx = Die->getParentIdx())
589  OS << format(" (0x%8.8" PRIx64 ")",
590  U->getDIEAtIndex(*ParentIdx).getOffset());
591  }
592  OS << '\n';
593 
594  // Dump all data in the DIE for the attributes.
595  for (const DWARFAttribute &AttrValue : attributes())
596  dumpAttribute(OS, *this, AttrValue, Indent, DumpOpts);
597 
598  if (DumpOpts.ShowChildren && DumpOpts.ChildRecurseDepth > 0) {
599  DWARFDie Child = getFirstChild();
600  DumpOpts.ChildRecurseDepth--;
601  DIDumpOptions ChildDumpOpts = DumpOpts;
602  ChildDumpOpts.ShowParents = false;
603  while (Child) {
604  Child.dump(OS, Indent + 2, ChildDumpOpts);
605  Child = Child.getSibling();
606  }
607  }
608  } else {
609  OS << "Abbreviation code not found in 'debug_abbrev' class for code: "
610  << abbrCode << '\n';
611  }
612  } else {
613  OS.indent(Indent) << "NULL\n";
614  }
615  }
616 }
617 
619 
621  if (isValid())
622  return U->getParent(Die);
623  return DWARFDie();
624 }
625 
627  if (isValid())
628  return U->getSibling(Die);
629  return DWARFDie();
630 }
631 
633  if (isValid())
634  return U->getPreviousSibling(Die);
635  return DWARFDie();
636 }
637 
639  if (isValid())
640  return U->getFirstChild(Die);
641  return DWARFDie();
642 }
643 
645  if (isValid())
646  return U->getLastChild(Die);
647  return DWARFDie();
648 }
649 
651  return make_range(attribute_iterator(*this, false),
652  attribute_iterator(*this, true));
653 }
654 
656  : Die(D), Index(0) {
657  auto AbbrDecl = Die.getAbbreviationDeclarationPtr();
658  assert(AbbrDecl && "Must have abbreviation declaration");
659  if (End) {
660  // This is the end iterator so we set the index to the attribute count.
661  Index = AbbrDecl->getNumAttributes();
662  } else {
663  // This is the begin iterator so we extract the value for this->Index.
664  AttrValue.Offset = D.getOffset() + AbbrDecl->getCodeByteSize();
665  updateForIndex(*AbbrDecl, 0);
666  }
667 }
668 
669 void DWARFDie::attribute_iterator::updateForIndex(
670  const DWARFAbbreviationDeclaration &AbbrDecl, uint32_t I) {
671  Index = I;
672  // AbbrDecl must be valid before calling this function.
673  auto NumAttrs = AbbrDecl.getNumAttributes();
674  if (Index < NumAttrs) {
675  AttrValue.Attr = AbbrDecl.getAttrByIndex(Index);
676  // Add the previous byte size of any previous attribute value.
677  AttrValue.Offset += AttrValue.ByteSize;
678  uint64_t ParseOffset = AttrValue.Offset;
679  if (AbbrDecl.getAttrIsImplicitConstByIndex(Index))
680  AttrValue.Value = DWARFFormValue::createFromSValue(
681  AbbrDecl.getFormByIndex(Index),
683  else {
684  auto U = Die.getDwarfUnit();
685  assert(U && "Die must have valid DWARF unit");
686  AttrValue.Value = DWARFFormValue::createFromUnit(
687  AbbrDecl.getFormByIndex(Index), U, &ParseOffset);
688  }
689  AttrValue.ByteSize = ParseOffset - AttrValue.Offset;
690  } else {
691  assert(Index == NumAttrs && "Indexes should be [0, NumAttrs) only");
692  AttrValue = {};
693  }
694 }
695 
697  if (auto AbbrDecl = Die.getAbbreviationDeclarationPtr())
698  updateForIndex(*AbbrDecl, Index + 1);
699  return *this;
700 }
701 
703  switch(Attr) {
704  case DW_AT_location:
705  case DW_AT_string_length:
706  case DW_AT_return_addr:
707  case DW_AT_data_member_location:
708  case DW_AT_frame_base:
709  case DW_AT_static_link:
710  case DW_AT_segment:
711  case DW_AT_use_location:
712  case DW_AT_vtable_elem_location:
713  return true;
714  default:
715  return false;
716  }
717 }
718 
720  switch (Attr) {
721  // From the DWARF v5 specification.
722  case DW_AT_location:
723  case DW_AT_byte_size:
724  case DW_AT_bit_offset:
725  case DW_AT_bit_size:
726  case DW_AT_string_length:
727  case DW_AT_lower_bound:
728  case DW_AT_return_addr:
729  case DW_AT_bit_stride:
730  case DW_AT_upper_bound:
731  case DW_AT_count:
732  case DW_AT_data_member_location:
733  case DW_AT_frame_base:
734  case DW_AT_segment:
735  case DW_AT_static_link:
736  case DW_AT_use_location:
737  case DW_AT_vtable_elem_location:
738  case DW_AT_allocated:
739  case DW_AT_associated:
740  case DW_AT_data_location:
741  case DW_AT_byte_stride:
742  case DW_AT_rank:
743  case DW_AT_call_value:
744  case DW_AT_call_origin:
745  case DW_AT_call_target:
746  case DW_AT_call_target_clobbered:
747  case DW_AT_call_data_location:
748  case DW_AT_call_data_value:
749  // Extensions.
750  case DW_AT_GNU_call_site_value:
751  case DW_AT_GNU_call_site_target:
752  return true;
753  default:
754  return false;
755  }
756 }
757 
758 namespace llvm {
759 
762 }
763 
765  std::string *OriginalFullName) {
766  DWARFTypePrinter(OS).appendUnqualifiedName(DIE, OriginalFullName);
767 }
768 
769 } // namespace llvm
llvm::DWARFLocationExpressionsVector
std::vector< DWARFLocationExpression > DWARFLocationExpressionsVector
Represents a set of absolute location expressions.
Definition: DWARFLocationExpression.h:45
DWARFFormValue.h
llvm::errc::invalid_argument
@ invalid_argument
llvm::DWARFContext::getLineTableForUnit
const DWARFDebugLine::LineTable * getLineTableForUnit(DWARFUnit *U)
Get a pointer to a parsed line table corresponding to a compile unit.
Definition: DWARFContext.cpp:967
Attrs
Function Attrs
Definition: README_ALTIVEC.txt:215
getName
static StringRef getName(Value *V)
Definition: ProvenanceAnalysisEvaluator.cpp:42
llvm::DIDumpOptions::ShowForm
bool ShowForm
Definition: DIContext.h:197
llvm::DWARFDie::isValid
bool isValid() const
Definition: DWARFDie.h:51
LLVM_DUMP_METHOD
#define LLVM_DUMP_METHOD
Mark debug helper function definitions like dump() that should not be stripped from debug builds.
Definition: Compiler.h:494
MathExtras.h
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:17
llvm::DWARFDie::getPreviousSibling
DWARFDie getPreviousSibling() const
Get the previous sibling of this DIE object.
Definition: DWARFDie.cpp:632
llvm::DWARFDie::getRangesBaseAttribute
Optional< uint64_t > getRangesBaseAttribute() const
Extract the range base attribute from this DIE as absolute section offset.
Definition: DWARFDie.cpp:333
llvm::make_range
iterator_range< T > make_range(T x, T y)
Convenience function for iterating over sub-ranges.
Definition: iterator_range.h:53
Optional.h
dumpAttribute
static void dumpAttribute(raw_ostream &OS, const DWARFDie &Die, const DWARFAttribute &AttrValue, unsigned Indent, DIDumpOptions DumpOpts)
Definition: DWARFDie.cpp:114
llvm::DWARFAttribute::Value
DWARFFormValue Value
The form and value for this attribute.
Definition: DWARFAttribute.h:32
llvm::DWARFDie::getLinkageName
const char * getLinkageName() const
Return the DIE linkage name resolving DW_AT_specification or DW_AT_abstract_origin references if nece...
Definition: DWARFDie.cpp:458
llvm::DWARFUnit::getRnglistOffset
Optional< uint64_t > getRnglistOffset(uint32_t Index)
Return a rangelist's offset based on an index.
Definition: DWARFUnit.cpp:1124
llvm::DWARFDie::dump
LLVM_DUMP_METHOD void dump() const
Convenience zero-argument overload for debugging.
Definition: DWARFDie.cpp:618
llvm::DWARFDie::resolveTypeUnitReference
DWARFDie resolveTypeUnitReference() const
Definition: DWARFDie.cpp:322
llvm::DWARFAttribute::Attr
dwarf::Attribute Attr
The attribute enumeration of this attribute.
Definition: DWARFAttribute.h:30
StringRef.h
llvm::DWARFTypePrinter
Definition: DWARFTypePrinter.h:24
llvm::DWARFAbbreviationDeclaration::getFormByIndex
dwarf::Form getFormByIndex(uint32_t idx) const
Definition: DWARFAbbreviationDeclaration.h:100
llvm::raw_string_ostream
A raw_ostream that writes to an std::string.
Definition: raw_ostream.h:632
llvm::DWARFDie::getShortName
const char * getShortName() const
Return the DIE short name resolving DW_AT_specification or DW_AT_abstract_origin references if necess...
Definition: DWARFDie.cpp:451
llvm::SmallVector
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Definition: SmallVector.h:1185
llvm::dwarf::Form
Form
Definition: Dwarf.h:132
llvm::DWARFFormValue::getAsAddress
Optional< uint64_t > getAsAddress() const
Definition: DWARFFormValue.cpp:668
DWARFDebugLine.h
DWARFContext.h
llvm::dwarf::toSectionedAddress
Optional< object::SectionedAddress > toSectionedAddress(const Optional< DWARFFormValue > &V)
Definition: DWARFFormValue.h:297
llvm::DWARFDie::getAbbreviationDeclarationPtr
const DWARFAbbreviationDeclaration * getAbbreviationDeclarationPtr() const
Get the abbreviation declaration for this DIE.
Definition: DWARFDie.h:59
llvm::DWARFTypePrinter::appendUnqualifiedName
void appendUnqualifiedName(DWARFDie D, std::string *OriginalFullName=nullptr)
Recursively append the DIE type name when applicable.
llvm::DWARFFormValue::createFromUValue
static DWARFFormValue createFromUValue(dwarf::Form F, uint64_t V)
Definition: DWARFFormValue.cpp:87
llvm::DWARFAbbreviationDeclaration::getAttrByIndex
dwarf::Attribute getAttrByIndex(uint32_t idx) const
Definition: DWARFAbbreviationDeclaration.h:109
llvm::DWARFFormValue::getAsUnsignedConstant
Optional< uint64_t > getAsUnsignedConstant() const
Definition: DWARFFormValue.cpp:727
llvm::Depth
@ Depth
Definition: SIMachineScheduler.h:36
dumpLocationList
static void dumpLocationList(raw_ostream &OS, const DWARFFormValue &FormValue, DWARFUnit *U, unsigned Indent, DIDumpOptions DumpOpts)
Definition: DWARFDie.cpp:73
Shift
bool Shift
Definition: README.txt:468
llvm::WithColor::get
raw_ostream & get()
Definition: WithColor.h:79
llvm::DWARFContext
DWARFContext This data structure is the top level entity that deals with dwarf debug information pars...
Definition: DWARFContext.h:47
llvm::DWARFFormValue::FC_Exprloc
@ FC_Exprloc
Definition: DWARFFormValue.h:40
llvm::DWARFLocationExpression
Represents a single DWARF expression, whose value is location-dependent.
Definition: DWARFLocationExpression.h:22
llvm::SmallSet
SmallSet - This maintains a set of unique values, optimizing for the case when the set is small (less...
Definition: SmallSet.h:136
llvm::WithColor
An RAII object that temporarily switches an output stream to a specific color.
Definition: WithColor.h:53
llvm::Optional< uint64_t >
llvm::DWARFDie::addressRangeContainsAddress
bool addressRangeContainsAddress(const uint64_t Address) const
Definition: DWARFDie.cpp:390
llvm::DIE
A structured debug information entry.
Definition: DIE.h:739
llvm::errs
raw_fd_ostream & errs()
This returns a reference to a raw_ostream for standard error.
Definition: raw_ostream.cpp:893
llvm::DWARFExpression::print
void print(raw_ostream &OS, DIDumpOptions DumpOpts, const MCRegisterInfo *RegInfo, DWARFUnit *U, bool IsEH=false) const
Definition: DWARFExpression.cpp:325
attributes
Deduce and propagate attributes
Definition: Attributor.cpp:3469
llvm::dump
void dump(const SparseBitVector< ElementSize > &LHS, raw_ostream &out)
Definition: SparseBitVector.h:877
llvm::Expected
Tagged union holding either a T or a Error.
Definition: APFloat.h:41
llvm::DWARFDebugInfoEntry::getAbbreviationDeclarationPtr
const DWARFAbbreviationDeclaration * getAbbreviationDeclarationPtr() const
Definition: DWARFDebugInfoEntry.h:72
llvm::SmallVectorImpl::pop_back_val
LLVM_NODISCARD T pop_back_val()
Definition: SmallVector.h:654
llvm::DWARFUnit::getFormParams
const dwarf::FormParams & getFormParams() const
Definition: DWARFUnit.h:291
llvm::DWARFDataExtractor
A DataExtractor (typically for an in-memory copy of an object-file section) plus a relocation map for...
Definition: DWARFDataExtractor.h:21
llvm::dwarf::Tag
Tag
Definition: Dwarf.h:105
llvm::DINameKind::LinkageName
@ LinkageName
BaseType
Format.h
llvm::dwarf::FormParams::Format
DwarfFormat Format
Definition: Dwarf.h:656
dumpLocationExpr
static void dumpLocationExpr(raw_ostream &OS, const DWARFFormValue &FormValue, DWARFUnit *U, unsigned Indent, DIDumpOptions DumpOpts)
Definition: DWARFDie.cpp:95
llvm::consumeError
void consumeError(Error Err)
Consume a Error without doing anything.
Definition: Error.h:1043
llvm::Data
@ Data
Definition: SIMachineScheduler.h:55
llvm::getOffset
static Error getOffset(const SymbolRef &Sym, SectionRef Sec, uint64_t &Result)
Definition: RuntimeDyld.cpp:174
llvm::dwarf::Attribute
Attribute
Attributes.
Definition: Dwarf.h:125
llvm::ArrayRef::data
const T * data() const
Definition: ArrayRef.h:161
F
#define F(x, y, z)
Definition: MD5.cpp:55
llvm::DWARFUnit::getLoclistOffset
Optional< uint64_t > getLoclistOffset(uint32_t Index)
Definition: DWARFUnit.cpp:1135
llvm::AArch64CC::LT
@ LT
Definition: AArch64BaseInfo.h:266
llvm::DWARFAttribute::Offset
uint64_t Offset
The debug info/types offset for this attribute.
Definition: DWARFAttribute.h:26
llvm::DWARFDie::getLastChild
DWARFDie getLastChild() const
Get the last child of this DIE object.
Definition: DWARFDie.cpp:644
llvm::DataExtractor::getULEB128
uint64_t getULEB128(uint64_t *offset_ptr, llvm::Error *Err=nullptr) const
Extract a unsigned LEB128 value from *offset_ptr.
Definition: DataExtractor.cpp:220
llvm::formatv
auto formatv(const char *Fmt, Ts &&... Vals) -> formatv_object< decltype(std::make_tuple(detail::build_format_adapter(std::forward< Ts >(Vals))...))>
Definition: FormatVariadic.h:251
llvm::DIDumpOptions::ShowAddresses
bool ShowAddresses
Definition: DIContext.h:194
llvm::DWARFAttribute
Encapsulates a DWARF attribute value and all of the data required to describe the attribute value.
Definition: DWARFAttribute.h:24
llvm::DWARFFormValue::createFromSValue
static DWARFFormValue createFromSValue(dwarf::Form F, int64_t V)
Definition: DWARFFormValue.cpp:83
llvm::HighlightColor::Tag
@ Tag
dumpRanges
static void dumpRanges(const DWARFObject &Obj, raw_ostream &OS, const DWARFAddressRangesVector &Ranges, unsigned AddressSize, unsigned Indent, const DIDumpOptions &DumpOpts)
Definition: DWARFDie.cpp:59
llvm::DIDumpOptions::Verbose
bool Verbose
Definition: DIContext.h:199
llvm::DINameKind
DINameKind
A DINameKind is passed to name search methods to specify a preference regarding the type of name reso...
Definition: DIContext.h:135
dumpApplePropertyAttribute
static void dumpApplePropertyAttribute(raw_ostream &OS, uint64_t Val)
Definition: DWARFDie.cpp:41
llvm::dwarf::computeTombstoneAddress
uint64_t computeTombstoneAddress(uint8_t AddressByteSize)
Definition: Dwarf.h:780
llvm::dwarf::AttributeValueString
StringRef AttributeValueString(uint16_t Attr, unsigned Val)
Returns the symbolic string representing Val when used as a value for attribute Attr.
Definition: Dwarf.cpp:639
llvm::DWARFDie::isSubroutineDIE
bool isSubroutineDIE() const
Returns true if DIE represents a subprogram or an inlined subroutine.
Definition: DWARFDie.cpp:240
llvm::HighlightColor::Enumerator
@ Enumerator
llvm::dwarf::getTag
unsigned getTag(StringRef TagString)
Definition: Dwarf.cpp:32
llvm::DWARFFormValue::FC_SectionOffset
@ FC_SectionOffset
Definition: DWARFFormValue.h:39
llvm::DWARFFormValue::dump
void dump(raw_ostream &OS, DIDumpOptions DumpOpts=DIDumpOptions()) const
Definition: DWARFFormValue.cpp:408
llvm::DWARFLocationTable::dumpLocationList
bool dumpLocationList(uint64_t *Offset, raw_ostream &OS, Optional< object::SectionedAddress > BaseAddr, const MCRegisterInfo *MRI, const DWARFObject &Obj, DWARFUnit *U, DIDumpOptions DumpOpts, unsigned Indent) const
Dump the location list at the given Offset.
Definition: DWARFDebugLoc.cpp:123
llvm::DIDumpOptions::ShowChildren
bool ShowChildren
Definition: DIContext.h:195
llvm::DWARFFormValue::getAsSectionOffset
Optional< uint64_t > getAsSectionOffset() const
Definition: DWARFFormValue.cpp:721
resolveReferencedType
static DWARFDie resolveReferencedType(DWARFDie D, DWARFFormValue F)
Definition: DWARFDie.cpp:110
DWARFDie.h
llvm::dwarf::Index
Index
Definition: Dwarf.h:472
DWARFDebugLoc.h
llvm::DWARFDie::getCallerFrame
void getCallerFrame(uint32_t &CallFile, uint32_t &CallLine, uint32_t &CallColumn, uint32_t &CallDiscriminator) const
Retrieves values of DW_AT_call_file, DW_AT_call_line and DW_AT_call_column from DIE (or zeroes if the...
Definition: DWARFDie.cpp:479
llvm::DIDumpOptions::ChildRecurseDepth
unsigned ChildRecurseDepth
Definition: DIContext.h:190
llvm::DWARFDie::getDeclFile
std::string getDeclFile(DILineInfoSpecifier::FileLineInfoKind Kind) const
Definition: DWARFDie.cpp:472
llvm::dwarf::toSectionOffset
Optional< uint64_t > toSectionOffset(const Optional< DWARFFormValue > &V)
Take an optional DWARFFormValue and try to extract an section offset.
Definition: DWARFFormValue.h:318
DWARFTypePrinter.h
llvm::raw_ostream
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition: raw_ostream.h:54
llvm::DWARFObject
Definition: DWARFObject.h:25
llvm::DWARFFormValue
Definition: DWARFFormValue.h:28
llvm::DWARFDie::attribute_iterator
Definition: DWARFDie.h:301
FormatVariadic.h
llvm::None
const NoneType None
Definition: None.h:24
llvm::lltok::Kind
Kind
Definition: LLToken.h:18
llvm::dwarf::FormEncodingString
StringRef FormEncodingString(unsigned Encoding)
Definition: Dwarf.cpp:105
llvm::DWARFDie::dump
void dump(raw_ostream &OS, unsigned indent=0, DIDumpOptions DumpOpts=DIDumpOptions()) const
Dump the DIE and all of its attributes to the supplied stream.
Definition: DWARFDie.cpp:560
llvm::DWARFFormValue::getAsRelativeReference
Optional< UnitOffset > getAsRelativeReference() const
Definition: DWARFFormValue.cpp:700
llvm::DIDumpOptions::ShowParents
bool ShowParents
Definition: DIContext.h:196
llvm::DWARFTypePrinter::appendQualifiedName
void appendQualifiedName(DWARFDie D)
getLinkageName
static std::string getLinkageName(GlobalValue::LinkageTypes LT)
Definition: AsmWriter.cpp:3113
llvm::DWARFContext::getTypeUnitForHash
DWARFTypeUnit * getTypeUnitForHash(uint16_t Version, uint64_t Hash, bool IsDWO)
Definition: DWARFContext.cpp:702
object
bar al al movzbl eax ret Missed when stored in a memory object
Definition: README.txt:1411
uint64_t
D
static GCRegistry::Add< StatepointGC > D("statepoint-example", "an example strategy for statepoint")
llvm::DWARFDie::getDeclLine
uint64_t getDeclLine() const
Returns the declaration line (start line) for a DIE, assuming it specifies a subprogram.
Definition: DWARFDie.cpp:467
llvm::find
auto find(R &&Range, const T &Val)
Provide wrappers to std::find which take ranges instead of having to pass begin/end explicitly.
Definition: STLExtras.h:1637
llvm::DWARFDie::getAddressRanges
Expected< DWARFAddressRangesVector > getAddressRanges() const
Get the address ranges for this DIE.
Definition: DWARFDie.cpp:373
llvm::dumpTypeUnqualifiedName
void dumpTypeUnqualifiedName(const DWARFDie &DIE, raw_ostream &OS, std::string *OriginalFullName=nullptr)
Definition: DWARFDie.cpp:764
I
#define I(x, y, z)
Definition: MD5.cpp:58
DWARFUnit.h
llvm::DWARFDie::find
Optional< DWARFFormValue > find(dwarf::Attribute Attr) const
Extract the specified attribute from this DIE.
Definition: DWARFDie.cpp:245
llvm::DILineInfoSpecifier::FileLineInfoKind
FileLineInfoKind
Definition: DIContext.h:140
llvm::DWARFExpression
Definition: DWARFExpression.h:24
llvm::HighlightColor::Address
@ Address
llvm::DataExtractor::isValidOffset
bool isValidOffset(uint64_t offset) const
Test the validity of offset.
Definition: DataExtractor.h:665
DWARFAbbreviationDeclaration.h
llvm::DWARFFormValue::FC_Block
@ FC_Block
Definition: DWARFFormValue.h:33
assert
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
ObjectFile.h
llvm::DWARFDie::findRecursively
Optional< DWARFFormValue > findRecursively(ArrayRef< dwarf::Attribute > Attrs) const
Extract the first value of any attribute in Attrs from this DIE and recurse into any DW_AT_specificat...
Definition: DWARFDie.cpp:269
llvm::DWARFDie::getLowAndHighPC
bool getLowAndHighPC(uint64_t &LowPC, uint64_t &HighPC, uint64_t &SectionIndex) const
Retrieves DW_AT_low_pc and DW_AT_high_pc from CU.
Definition: DWARFDie.cpp:358
llvm::dwarf::toString
Optional< const char * > toString(const Optional< DWARFFormValue > &V)
Take an optional DWARFFormValue and try to extract a string value from it.
Definition: DWARFFormValue.h:177
llvm::DWARFDie::getLocations
Expected< DWARFLocationExpressionsVector > getLocations(dwarf::Attribute Attr) const
Definition: DWARFDie.cpp:404
llvm::DWARFUnit::getCompilationDir
const char * getCompilationDir()
Definition: DWARFUnit.cpp:389
llvm::ArrayRef< uint8_t >
llvm::DWARFAbbreviationDeclaration::getNumAttributes
size_t getNumAttributes() const
Definition: DWARFAbbreviationDeclaration.h:105
llvm::DWARFContext::isLittleEndian
bool isLittleEndian() const
Definition: DWARFContext.h:379
None.h
llvm::DWARFFormValue::dumpAddress
void dumpAddress(raw_ostream &OS, uint64_t Address) const
llvm::HighlightColor::String
@ String
llvm::countTrailingZeros
unsigned countTrailingZeros(T Val, ZeroBehavior ZB=ZB_Width)
Count number of 0's from the least significant bit to the most stopping at the first 1.
Definition: MathExtras.h:156
llvm::DWARFAbbreviationDeclaration::getAttrIsImplicitConstByIndex
bool getAttrIsImplicitConstByIndex(uint32_t idx) const
Definition: DWARFAbbreviationDeclaration.h:114
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:58
Dwarf.h
llvm::DWARFUnit::getContext
DWARFContext & getContext() const
Definition: DWARFUnit.h:288
llvm::DWARFDie::getDwarfUnit
DWARFUnit * getDwarfUnit() const
Definition: DWARFDie.h:54
getParent
static const Function * getParent(const Value *V)
Definition: BasicAliasAnalysis.cpp:845
uint32_t
llvm::DWARFDie::getName
const char * getName(DINameKind Kind) const
Return the DIE name resolving DW_AT_specification or DW_AT_abstract_origin references if necessary.
Definition: DWARFDie.cpp:440
llvm::DWARFDie::getLocBaseAttribute
Optional< uint64_t > getLocBaseAttribute() const
Definition: DWARFDie.cpp:337
llvm::dwarf::ApplePropertyString
StringRef ApplePropertyString(unsigned)
Definition: Dwarf.cpp:565
llvm::DWARFDie::getSibling
DWARFDie getSibling() const
Get the sibling of this DIE object.
Definition: DWARFDie.cpp:626
llvm::format
format_object< Ts... > format(const char *Fmt, const Ts &... Vals)
These are helper functions used to produce formatted output.
Definition: Format.h:124
llvm::SmallSet::insert
std::pair< NoneType, bool > insert(const T &V)
insert - Insert an element into the set if it isn't already there.
Definition: SmallSet.h:182
llvm::MCRegisterInfo
MCRegisterInfo base class - We assume that the target defines a static array of MCRegisterDesc object...
Definition: MCRegisterInfo.h:135
llvm::DILineInfoSpecifier::FileLineInfoKind::AbsoluteFilePath
@ AbsoluteFilePath
llvm::DWARFAttribute::mayHaveLocationExpr
static bool mayHaveLocationExpr(dwarf::Attribute Attr)
Identifies DWARF attributes that may contain a reference to a DWARF expression.
Definition: DWARFDie.cpp:719
MRI
unsigned const MachineRegisterInfo * MRI
Definition: AArch64AdvSIMDScalarPass.cpp:105
llvm::DWARFDie::attribute_iterator::operator++
attribute_iterator & operator++()
Definition: DWARFDie.cpp:696
llvm::HighlightColor::Attribute
@ Attribute
WithColor.h
llvm::DWARFDie::getParent
DWARFDie getParent() const
Get the parent of this DIE object.
Definition: DWARFDie.cpp:620
llvm::DWARFUnit::getAddressByteSize
uint8_t getAddressByteSize() const
Definition: DWARFUnit.h:295
llvm::createStringError
Error createStringError(std::error_code EC, char const *Fmt, const Ts &... Vals)
Create formatted StringError object.
Definition: Error.h:1239
llvm::DWARFAddressRangesVector
std::vector< DWARFAddressRange > DWARFAddressRangesVector
DWARFAddressRangesVector - represents a set of absolute address ranges.
Definition: DWARFAddressRange.h:88
llvm::DWARFTypeUnit
Definition: DWARFTypeUnit.h:24
llvm::GraphProgram::Name
Name
Definition: GraphWriter.h:50
llvm::dumpTypeQualifiedName
void dumpTypeQualifiedName(const DWARFDie &DIE, raw_ostream &OS)
Definition: DWARFDie.cpp:760
llvm::inconvertibleErrorCode
std::error_code inconvertibleErrorCode()
The value returned by this function can be returned from convertToErrorCode for Error values where no...
Definition: Error.cpp:77
llvm::DWARFContext::getRegisterInfo
const MCRegisterInfo * getRegisterInfo() const
Definition: DWARFContext.h:411
llvm::DWARFAbbreviationDeclaration
Definition: DWARFAbbreviationDeclaration.h:27
llvm::DWARFUnit
Definition: DWARFUnit.h:207
llvm::DWARFFormValue::getAsBlock
Optional< ArrayRef< uint8_t > > getAsBlock() const
Definition: DWARFFormValue.cpp:753
DataExtractor.h
llvm::TargetStackID::Value
Value
Definition: TargetFrameLowering.h:27
DWARFExpression.h
DWARFTypeUnit.h
llvm::DWARFDie::getFullName
void getFullName(raw_string_ostream &, std::string *OriginalFullName=nullptr) const
Definition: DWARFDie.cpp:228
llvm::DWARFAbbreviationDeclaration::getAttrImplicitConstValueByIndex
int64_t getAttrImplicitConstValueByIndex(uint32_t idx) const
Definition: DWARFAbbreviationDeclaration.h:119
llvm::dwarf::toUnsigned
Optional< uint64_t > toUnsigned(const Optional< DWARFFormValue > &V)
Take an optional DWARFFormValue and try to extract an unsigned constant.
Definition: DWARFFormValue.h:225
llvm::DWARFDie::getAttributeValueAsReferencedDie
DWARFDie getAttributeValueAsReferencedDie(dwarf::Attribute Attr) const
Extract the specified attribute from this DIE as the referenced DIE.
Definition: DWARFDie.cpp:302
isValid
static bool isValid(const char C)
Returns true if C is a valid mangled character: <0-9a-zA-Z_>.
Definition: RustDemangle.cpp:187
llvm::DataExtractor
Definition: DataExtractor.h:41
llvm::DWARFDie::getTag
dwarf::Tag getTag() const
Definition: DWARFDie.h:72
llvm::DWARFUnit::getBaseAddress
llvm::Optional< object::SectionedAddress > getBaseAddress()
Definition: DWARFUnit.cpp:985
llvm::DWARFDie::attributes
iterator_range< attribute_iterator > attributes() const
Get an iterator range to all attributes in the current DIE only.
Definition: DWARFDie.cpp:650
llvm::DINameKind::None
@ None
llvm::raw_ostream::indent
raw_ostream & indent(unsigned NumSpaces)
indent - Insert 'NumSpaces' spaces.
Definition: raw_ostream.cpp:496
llvm::DWARFFormValue::isFormClass
bool isFormClass(FormClass FC) const
Definition: DWARFFormValue.cpp:215
llvm::DWARFDie::getTypeSize
Optional< uint64_t > getTypeSize(uint64_t PointerSize)
Gets the type size (in bytes) for this DIE.
Definition: DWARFDie.cpp:488
llvm::DWARFContext::getDWARFObj
const DWARFObject & getDWARFObj() const
Definition: DWARFContext.h:126
llvm::ArrayRef::size
size_t size() const
size - Get the array size.
Definition: ArrayRef.h:164
llvm::DWARFFormValue::getForm
dwarf::Form getForm() const
Definition: DWARFFormValue.h:79
llvm::iterator_range
A range adaptor for a pair of iterators.
Definition: iterator_range.h:30
llvm::tgtok::Bit
@ Bit
Definition: TGLexer.h:50
llvm::DWARFDie::attribute_iterator::attribute_iterator
attribute_iterator()=delete
llvm::StringRef::data
const LLVM_NODISCARD char * data() const
data - Get a pointer to the start of the string (which may not be null terminated).
Definition: StringRef.h:149
llvm::DWARFDie::getHighPC
Optional< uint64_t > getHighPC(uint64_t LowPC) const
Get the DW_AT_high_pc attribute value as an address.
Definition: DWARFDie.cpp:341
llvm::DWARFAttribute::mayHaveLocationList
static bool mayHaveLocationList(dwarf::Attribute Attr)
Identify DWARF attributes that may contain a pointer to a location list.
Definition: DWARFDie.cpp:702
llvm::DWARFFormValue::createFromUnit
static DWARFFormValue createFromUnit(dwarf::Form F, const DWARFUnit *Unit, uint64_t *OffsetPtr)
Definition: DWARFFormValue.cpp:103
llvm::DWARFDie
Utility class that carries the DWARF compile/type unit and the debug info entry in an object.
Definition: DWARFDie.h:43
llvm::DWARFAddressRange
Definition: DWARFAddressRange.h:25
llvm::DWARFDie::isSubprogramDIE
bool isSubprogramDIE() const
Returns true if DIE represents a subprogram (not inlined).
Definition: DWARFDie.cpp:238
raw_ostream.h
llvm::DWARFUnit::getLocationTable
const DWARFLocationTable & getLocationTable()
Definition: DWARFUnit.h:354
dumpParentChain
static unsigned dumpParentChain(DWARFDie Die, raw_ostream &OS, unsigned Indent, DIDumpOptions DumpOpts, unsigned Depth=0)
Helper to dump a DIE with all of its parents, but no siblings.
Definition: DWARFDie.cpp:549
llvm::Value
LLVM Value Representation.
Definition: Value.h:74
llvm::dwarf::AttributeString
StringRef AttributeString(unsigned Attribute)
Definition: Dwarf.cpp:72
llvm::DWARFDie::getFirstChild
DWARFDie getFirstChild() const
Get the first child of this DIE object.
Definition: DWARFDie.cpp:638
llvm::DIDumpOptions::ParentRecurseDepth
unsigned ParentRecurseDepth
Definition: DIContext.h:191
llvm::DWARFDie::getSubroutineName
const char * getSubroutineName(DINameKind Kind) const
If a DIE represents a subprogram (or inlined subroutine), returns its mangled name (or short name,...
Definition: DWARFDie.cpp:434
SmallSet.h
llvm::DIDumpOptions
Container for dump options that control which debug information will be dumped.
Definition: DIContext.h:188
llvm::DIDumpOptions::RecoverableErrorHandler
std::function< void(Error)> RecoverableErrorHandler
Definition: DIContext.h:220