LLVM  16.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 (Optional<uint64_t> Val = FormValue.getAsUnsignedConstant()) {
141  if (LT->getFileNameByIndex(
142  *Val, U->getCompilationDir(),
144  File)) {
145  File = '"' + File + '"';
146  Name = File;
147  }
148  }
149  }
150  } else if (Optional<uint64_t> Val = FormValue.getAsUnsignedConstant())
151  Name = AttributeValueString(Attr, *Val);
152 
153  if (!Name.empty())
154  WithColor(OS, Color) << Name;
155  else if (Attr == DW_AT_decl_line || Attr == DW_AT_call_line) {
156  if (Optional<uint64_t> Val = FormValue.getAsUnsignedConstant())
157  OS << *Val;
158  else
159  FormValue.dump(OS, DumpOpts);
160  } else if (Attr == DW_AT_low_pc &&
161  (FormValue.getAsAddress() ==
163  if (DumpOpts.Verbose) {
164  FormValue.dump(OS, DumpOpts);
165  OS << " (";
166  }
167  OS << "dead code";
168  if (DumpOpts.Verbose)
169  OS << ')';
170  } else if (Attr == DW_AT_high_pc && !DumpOpts.ShowForm && !DumpOpts.Verbose &&
171  FormValue.getAsUnsignedConstant()) {
172  if (DumpOpts.ShowAddresses) {
173  // Print the actual address rather than the offset.
174  uint64_t LowPC, HighPC, Index;
175  if (Die.getLowAndHighPC(LowPC, HighPC, Index))
177  else
178  FormValue.dump(OS, DumpOpts);
179  }
180  } else if (DWARFAttribute::mayHaveLocationList(Attr) &&
182  dumpLocationList(OS, FormValue, U, sizeof(BaseIndent) + Indent + 4,
183  DumpOpts);
184  else if (FormValue.isFormClass(DWARFFormValue::FC_Exprloc) ||
187  dumpLocationExpr(OS, FormValue, U, sizeof(BaseIndent) + Indent + 4,
188  DumpOpts);
189  else
190  FormValue.dump(OS, DumpOpts);
191 
192  std::string Space = DumpOpts.ShowAddresses ? " " : "";
193 
194  // We have dumped the attribute raw value. For some attributes
195  // having both the raw value and the pretty-printed value is
196  // interesting. These attributes are handled below.
197  if (Attr == DW_AT_specification || Attr == DW_AT_abstract_origin) {
198  if (const char *Name =
201  OS << Space << "\"" << Name << '\"';
202  } else if (Attr == DW_AT_type || Attr == DW_AT_containing_type) {
203  DWARFDie D = resolveReferencedType(Die, FormValue);
204  if (D && !D.isNULL()) {
205  OS << Space << "\"";
207  OS << '"';
208  }
209  } else if (Attr == DW_AT_APPLE_property_attribute) {
210  if (Optional<uint64_t> OptVal = FormValue.getAsUnsignedConstant())
211  dumpApplePropertyAttribute(OS, *OptVal);
212  } else if (Attr == DW_AT_ranges) {
213  const DWARFObject &Obj = Die.getDwarfUnit()->getContext().getDWARFObj();
214  // For DW_FORM_rnglistx we need to dump the offset separately, since
215  // we have only dumped the index so far.
216  if (FormValue.getForm() == DW_FORM_rnglistx)
217  if (auto RangeListOffset =
218  U->getRnglistOffset(*FormValue.getAsSectionOffset())) {
220  dwarf::DW_FORM_sec_offset, *RangeListOffset);
221  FV.dump(OS, DumpOpts);
222  }
223  if (auto RangesOrError = Die.getAddressRanges())
224  dumpRanges(Obj, OS, RangesOrError.get(), U->getAddressByteSize(),
225  sizeof(BaseIndent) + Indent + 4, DumpOpts);
226  else
228  errc::invalid_argument, "decoding address ranges: %s",
229  toString(RangesOrError.takeError()).c_str()));
230  }
231 
232  OS << ")\n";
233 }
234 
236  std::string *OriginalFullName) const {
237  const char *NamePtr = getShortName();
238  if (!NamePtr)
239  return;
240  if (getTag() == DW_TAG_GNU_template_parameter_pack)
241  return;
242  dumpTypeUnqualifiedName(*this, OS, OriginalFullName);
243 }
244 
245 bool DWARFDie::isSubprogramDIE() const { return getTag() == DW_TAG_subprogram; }
246 
248  auto Tag = getTag();
249  return Tag == DW_TAG_subprogram || Tag == DW_TAG_inlined_subroutine;
250 }
251 
253  if (!isValid())
254  return None;
255  auto AbbrevDecl = getAbbreviationDeclarationPtr();
256  if (AbbrevDecl)
257  return AbbrevDecl->getAttributeValue(getOffset(), Attr, *U);
258  return None;
259 }
260 
263  if (!isValid())
264  return None;
265  auto AbbrevDecl = getAbbreviationDeclarationPtr();
266  if (AbbrevDecl) {
267  for (auto Attr : Attrs) {
268  if (auto Value = AbbrevDecl->getAttributeValue(getOffset(), Attr, *U))
269  return Value;
270  }
271  }
272  return None;
273 }
274 
277  SmallVector<DWARFDie, 3> Worklist;
278  Worklist.push_back(*this);
279 
280  // Keep track if DIEs already seen to prevent infinite recursion.
281  // Empirically we rarely see a depth of more than 3 when dealing with valid
282  // DWARF. This corresponds to following the DW_AT_abstract_origin and
283  // DW_AT_specification just once.
285  Seen.insert(*this);
286 
287  while (!Worklist.empty()) {
288  DWARFDie Die = Worklist.pop_back_val();
289 
290  if (!Die.isValid())
291  continue;
292 
293  if (auto Value = Die.find(Attrs))
294  return Value;
295 
296  if (auto D = Die.getAttributeValueAsReferencedDie(DW_AT_abstract_origin))
297  if (Seen.insert(D).second)
298  Worklist.push_back(D);
299 
300  if (auto D = Die.getAttributeValueAsReferencedDie(DW_AT_specification))
301  if (Seen.insert(D).second)
302  Worklist.push_back(D);
303  }
304 
305  return None;
306 }
307 
308 DWARFDie
310  if (Optional<DWARFFormValue> F = find(Attr))
311  return getAttributeValueAsReferencedDie(*F);
312  return DWARFDie();
313 }
314 
315 DWARFDie
317  DWARFDie Result;
318  if (auto SpecRef = V.getAsRelativeReference()) {
319  if (SpecRef->Unit)
320  Result = SpecRef->Unit->getDIEForOffset(SpecRef->Unit->getOffset() +
321  SpecRef->Offset);
322  else if (auto SpecUnit =
323  U->getUnitVector().getUnitForOffset(SpecRef->Offset))
324  Result = SpecUnit->getDIEForOffset(SpecRef->Offset);
325  }
326  return Result;
327 }
328 
330  if (auto Attr = find(DW_AT_signature)) {
331  if (Optional<uint64_t> Sig = Attr->getAsReferenceUVal()) {
333  U->getVersion(), *Sig, U->isDWOUnit()))
334  return TU->getDIEForOffset(TU->getTypeOffset() + TU->getOffset());
335  }
336  }
337  return *this;
338 }
339 
341  return toSectionOffset(find({DW_AT_rnglists_base, DW_AT_GNU_ranges_base}));
342 }
343 
345  return toSectionOffset(find(DW_AT_loclists_base));
346 }
347 
349  uint64_t Tombstone = dwarf::computeTombstoneAddress(U->getAddressByteSize());
350  if (LowPC == Tombstone)
351  return None;
352  if (auto FormValue = find(DW_AT_high_pc)) {
353  if (auto Address = FormValue->getAsAddress()) {
354  // High PC is an address.
355  return Address;
356  }
357  if (auto Offset = FormValue->getAsUnsignedConstant()) {
358  // High PC is an offset from LowPC.
359  return LowPC + *Offset;
360  }
361  }
362  return None;
363 }
364 
366  uint64_t &SectionIndex) const {
367  auto F = find(DW_AT_low_pc);
368  auto LowPcAddr = toSectionedAddress(F);
369  if (!LowPcAddr)
370  return false;
371  if (auto HighPcAddr = getHighPC(LowPcAddr->Address)) {
372  LowPC = LowPcAddr->Address;
373  HighPC = *HighPcAddr;
374  SectionIndex = LowPcAddr->SectionIndex;
375  return true;
376  }
377  return false;
378 }
379 
381  if (isNULL())
382  return DWARFAddressRangesVector();
383  // Single range specified by low/high PC.
384  uint64_t LowPC, HighPC, Index;
385  if (getLowAndHighPC(LowPC, HighPC, Index))
386  return DWARFAddressRangesVector{{LowPC, HighPC, Index}};
387 
388  Optional<DWARFFormValue> Value = find(DW_AT_ranges);
389  if (Value) {
390  if (Value->getForm() == DW_FORM_rnglistx)
391  return U->findRnglistFromIndex(*Value->getAsSectionOffset());
392  return U->findRnglistFromOffset(*Value->getAsSectionOffset());
393  }
394  return DWARFAddressRangesVector();
395 }
396 
398  auto RangesOrError = getAddressRanges();
399  if (!RangesOrError) {
400  llvm::consumeError(RangesOrError.takeError());
401  return false;
402  }
403 
404  for (const auto &R : RangesOrError.get())
405  if (R.LowPC <= Address && Address < R.HighPC)
406  return true;
407  return false;
408 }
409 
412  Optional<DWARFFormValue> Location = find(Attr);
413  if (!Location)
414  return createStringError(inconvertibleErrorCode(), "No %s",
415  dwarf::AttributeString(Attr).data());
416 
417  if (Optional<uint64_t> Off = Location->getAsSectionOffset()) {
418  uint64_t Offset = *Off;
419 
420  if (Location->getForm() == DW_FORM_loclistx) {
421  if (auto LoclistOffset = U->getLoclistOffset(Offset))
422  Offset = *LoclistOffset;
423  else
425  "Loclist table not found");
426  }
427  return U->findLoclistFromOffset(Offset);
428  }
429 
430  if (Optional<ArrayRef<uint8_t>> Expr = Location->getAsBlock()) {
432  DWARFLocationExpression{None, to_vector<4>(*Expr)}};
433  }
434 
435  return createStringError(
436  inconvertibleErrorCode(), "Unsupported %s encoding: %s",
437  dwarf::AttributeString(Attr).data(),
438  dwarf::FormEncodingString(Location->getForm()).data());
439 }
440 
441 const char *DWARFDie::getSubroutineName(DINameKind Kind) const {
442  if (!isSubroutineDIE())
443  return nullptr;
444  return getName(Kind);
445 }
446 
447 const char *DWARFDie::getName(DINameKind Kind) const {
448  if (!isValid() || Kind == DINameKind::None)
449  return nullptr;
450  // Try to get mangled name only if it was asked for.
451  if (Kind == DINameKind::LinkageName) {
452  if (auto Name = getLinkageName())
453  return Name;
454  }
455  return getShortName();
456 }
457 
458 const char *DWARFDie::getShortName() const {
459  if (!isValid())
460  return nullptr;
461 
462  return dwarf::toString(findRecursively(dwarf::DW_AT_name), nullptr);
463 }
464 
465 const char *DWARFDie::getLinkageName() const {
466  if (!isValid())
467  return nullptr;
468 
469  return dwarf::toString(findRecursively({dwarf::DW_AT_MIPS_linkage_name,
470  dwarf::DW_AT_linkage_name}),
471  nullptr);
472 }
473 
475  return toUnsigned(findRecursively(DW_AT_decl_line), 0);
476 }
477 
478 std::string
480  if (auto FormValue = findRecursively(DW_AT_decl_file))
481  if (auto OptString = FormValue->getAsFile(Kind))
482  return *OptString;
483  return {};
484 }
485 
486 void DWARFDie::getCallerFrame(uint32_t &CallFile, uint32_t &CallLine,
487  uint32_t &CallColumn,
488  uint32_t &CallDiscriminator) const {
489  CallFile = toUnsigned(find(DW_AT_call_file), 0);
490  CallLine = toUnsigned(find(DW_AT_call_line), 0);
491  CallColumn = toUnsigned(find(DW_AT_call_column), 0);
492  CallDiscriminator = toUnsigned(find(DW_AT_GNU_discriminator), 0);
493 }
494 
496  if (auto SizeAttr = find(DW_AT_byte_size))
497  if (Optional<uint64_t> Size = SizeAttr->getAsUnsignedConstant())
498  return Size;
499 
500  switch (getTag()) {
501  case DW_TAG_pointer_type:
502  case DW_TAG_reference_type:
503  case DW_TAG_rvalue_reference_type:
504  return PointerSize;
505  case DW_TAG_ptr_to_member_type: {
506  if (DWARFDie BaseType = getAttributeValueAsReferencedDie(DW_AT_type))
507  if (BaseType.getTag() == DW_TAG_subroutine_type)
508  return 2 * PointerSize;
509  return PointerSize;
510  }
511  case DW_TAG_const_type:
512  case DW_TAG_immutable_type:
513  case DW_TAG_volatile_type:
514  case DW_TAG_restrict_type:
515  case DW_TAG_typedef: {
516  if (DWARFDie BaseType = getAttributeValueAsReferencedDie(DW_AT_type))
517  return BaseType.getTypeSize(PointerSize);
518  break;
519  }
520  case DW_TAG_array_type: {
521  DWARFDie BaseType = getAttributeValueAsReferencedDie(DW_AT_type);
522  if (!BaseType)
523  return None;
524  Optional<uint64_t> BaseSize = BaseType.getTypeSize(PointerSize);
525  if (!BaseSize)
526  return None;
527  uint64_t Size = *BaseSize;
528  for (DWARFDie Child : *this) {
529  if (Child.getTag() != DW_TAG_subrange_type)
530  continue;
531 
532  if (auto ElemCountAttr = Child.find(DW_AT_count))
533  if (Optional<uint64_t> ElemCount =
534  ElemCountAttr->getAsUnsignedConstant())
535  Size *= *ElemCount;
536  if (auto UpperBoundAttr = Child.find(DW_AT_upper_bound))
537  if (Optional<int64_t> UpperBound =
538  UpperBoundAttr->getAsSignedConstant()) {
539  int64_t LowerBound = 0;
540  if (auto LowerBoundAttr = Child.find(DW_AT_lower_bound))
541  LowerBound = LowerBoundAttr->getAsSignedConstant().value_or(0);
542  Size *= *UpperBound - LowerBound + 1;
543  }
544  }
545  return Size;
546  }
547  default:
548  if (DWARFDie BaseType = getAttributeValueAsReferencedDie(DW_AT_type))
549  return BaseType.getTypeSize(PointerSize);
550  break;
551  }
552  return None;
553 }
554 
555 /// Helper to dump a DIE with all of its parents, but no siblings.
556 static unsigned dumpParentChain(DWARFDie Die, raw_ostream &OS, unsigned Indent,
557  DIDumpOptions DumpOpts, unsigned Depth = 0) {
558  if (!Die)
559  return Indent;
560  if (DumpOpts.ParentRecurseDepth > 0 && Depth >= DumpOpts.ParentRecurseDepth)
561  return Indent;
562  Indent = dumpParentChain(Die.getParent(), OS, Indent, DumpOpts, Depth + 1);
563  Die.dump(OS, Indent, DumpOpts);
564  return Indent + 2;
565 }
566 
567 void DWARFDie::dump(raw_ostream &OS, unsigned Indent,
568  DIDumpOptions DumpOpts) const {
569  if (!isValid())
570  return;
571  DWARFDataExtractor debug_info_data = U->getDebugInfoExtractor();
572  const uint64_t Offset = getOffset();
573  uint64_t offset = Offset;
574  if (DumpOpts.ShowParents) {
575  DIDumpOptions ParentDumpOpts = DumpOpts;
576  ParentDumpOpts.ShowParents = false;
577  ParentDumpOpts.ShowChildren = false;
578  Indent = dumpParentChain(getParent(), OS, Indent, ParentDumpOpts);
579  }
580 
581  if (debug_info_data.isValidOffset(offset)) {
582  uint32_t abbrCode = debug_info_data.getULEB128(&offset);
583  if (DumpOpts.ShowAddresses)
585  << format("\n0x%8.8" PRIx64 ": ", Offset);
586 
587  if (abbrCode) {
588  auto AbbrevDecl = getAbbreviationDeclarationPtr();
589  if (AbbrevDecl) {
590  WithColor(OS, HighlightColor::Tag).get().indent(Indent)
591  << formatv("{0}", getTag());
592  if (DumpOpts.Verbose) {
593  OS << format(" [%u] %c", abbrCode,
594  AbbrevDecl->hasChildren() ? '*' : ' ');
595  if (Optional<uint32_t> ParentIdx = Die->getParentIdx())
596  OS << format(" (0x%8.8" PRIx64 ")",
597  U->getDIEAtIndex(*ParentIdx).getOffset());
598  }
599  OS << '\n';
600 
601  // Dump all data in the DIE for the attributes.
602  for (const DWARFAttribute &AttrValue : attributes())
603  dumpAttribute(OS, *this, AttrValue, Indent, DumpOpts);
604 
605  if (DumpOpts.ShowChildren && DumpOpts.ChildRecurseDepth > 0) {
606  DWARFDie Child = getFirstChild();
607  DumpOpts.ChildRecurseDepth--;
608  DIDumpOptions ChildDumpOpts = DumpOpts;
609  ChildDumpOpts.ShowParents = false;
610  while (Child) {
611  Child.dump(OS, Indent + 2, ChildDumpOpts);
612  Child = Child.getSibling();
613  }
614  }
615  } else {
616  OS << "Abbreviation code not found in 'debug_abbrev' class for code: "
617  << abbrCode << '\n';
618  }
619  } else {
620  OS.indent(Indent) << "NULL\n";
621  }
622  }
623 }
624 
626 
628  if (isValid())
629  return U->getParent(Die);
630  return DWARFDie();
631 }
632 
634  if (isValid())
635  return U->getSibling(Die);
636  return DWARFDie();
637 }
638 
640  if (isValid())
641  return U->getPreviousSibling(Die);
642  return DWARFDie();
643 }
644 
646  if (isValid())
647  return U->getFirstChild(Die);
648  return DWARFDie();
649 }
650 
652  if (isValid())
653  return U->getLastChild(Die);
654  return DWARFDie();
655 }
656 
658  return make_range(attribute_iterator(*this, false),
659  attribute_iterator(*this, true));
660 }
661 
663  : Die(D), Index(0) {
664  auto AbbrDecl = Die.getAbbreviationDeclarationPtr();
665  assert(AbbrDecl && "Must have abbreviation declaration");
666  if (End) {
667  // This is the end iterator so we set the index to the attribute count.
668  Index = AbbrDecl->getNumAttributes();
669  } else {
670  // This is the begin iterator so we extract the value for this->Index.
671  AttrValue.Offset = D.getOffset() + AbbrDecl->getCodeByteSize();
672  updateForIndex(*AbbrDecl, 0);
673  }
674 }
675 
676 void DWARFDie::attribute_iterator::updateForIndex(
677  const DWARFAbbreviationDeclaration &AbbrDecl, uint32_t I) {
678  Index = I;
679  // AbbrDecl must be valid before calling this function.
680  auto NumAttrs = AbbrDecl.getNumAttributes();
681  if (Index < NumAttrs) {
682  AttrValue.Attr = AbbrDecl.getAttrByIndex(Index);
683  // Add the previous byte size of any previous attribute value.
684  AttrValue.Offset += AttrValue.ByteSize;
685  uint64_t ParseOffset = AttrValue.Offset;
686  if (AbbrDecl.getAttrIsImplicitConstByIndex(Index))
687  AttrValue.Value = DWARFFormValue::createFromSValue(
688  AbbrDecl.getFormByIndex(Index),
690  else {
691  auto U = Die.getDwarfUnit();
692  assert(U && "Die must have valid DWARF unit");
693  AttrValue.Value = DWARFFormValue::createFromUnit(
694  AbbrDecl.getFormByIndex(Index), U, &ParseOffset);
695  }
696  AttrValue.ByteSize = ParseOffset - AttrValue.Offset;
697  } else {
698  assert(Index == NumAttrs && "Indexes should be [0, NumAttrs) only");
699  AttrValue = {};
700  }
701 }
702 
704  if (auto AbbrDecl = Die.getAbbreviationDeclarationPtr())
705  updateForIndex(*AbbrDecl, Index + 1);
706  return *this;
707 }
708 
710  switch(Attr) {
711  case DW_AT_location:
712  case DW_AT_string_length:
713  case DW_AT_return_addr:
714  case DW_AT_data_member_location:
715  case DW_AT_frame_base:
716  case DW_AT_static_link:
717  case DW_AT_segment:
718  case DW_AT_use_location:
719  case DW_AT_vtable_elem_location:
720  return true;
721  default:
722  return false;
723  }
724 }
725 
727  switch (Attr) {
728  // From the DWARF v5 specification.
729  case DW_AT_location:
730  case DW_AT_byte_size:
731  case DW_AT_bit_offset:
732  case DW_AT_bit_size:
733  case DW_AT_string_length:
734  case DW_AT_lower_bound:
735  case DW_AT_return_addr:
736  case DW_AT_bit_stride:
737  case DW_AT_upper_bound:
738  case DW_AT_count:
739  case DW_AT_data_member_location:
740  case DW_AT_frame_base:
741  case DW_AT_segment:
742  case DW_AT_static_link:
743  case DW_AT_use_location:
744  case DW_AT_vtable_elem_location:
745  case DW_AT_allocated:
746  case DW_AT_associated:
747  case DW_AT_data_location:
748  case DW_AT_byte_stride:
749  case DW_AT_rank:
750  case DW_AT_call_value:
751  case DW_AT_call_origin:
752  case DW_AT_call_target:
753  case DW_AT_call_target_clobbered:
754  case DW_AT_call_data_location:
755  case DW_AT_call_data_value:
756  // Extensions.
757  case DW_AT_GNU_call_site_value:
758  case DW_AT_GNU_call_site_target:
759  return true;
760  default:
761  return false;
762  }
763 }
764 
765 namespace llvm {
766 
769 }
770 
772  std::string *OriginalFullName) {
773  DWARFTypePrinter(OS).appendUnqualifiedName(DIE, OriginalFullName);
774 }
775 
776 } // 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:20
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:492
MathExtras.h
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
llvm::DWARFDie::getPreviousSibling
DWARFDie getPreviousSibling() const
Get the previous sibling of this DIE object.
Definition: DWARFDie.cpp:639
llvm::DWARFDie::getRangesBaseAttribute
Optional< uint64_t > getRangesBaseAttribute() const
Extract the range base attribute from this DIE as absolute section offset.
Definition: DWARFDie.cpp:340
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:465
llvm::DWARFUnit::getRnglistOffset
Optional< uint64_t > getRnglistOffset(uint32_t Index)
Return a rangelist's offset based on an index.
Definition: DWARFUnit.cpp:1186
llvm::DWARFDie::dump
LLVM_DUMP_METHOD void dump() const
Convenience zero-argument overload for debugging.
Definition: DWARFDie.cpp:625
llvm::DWARFDie::resolveTypeUnitReference
DWARFDie resolveTypeUnitReference() const
Definition: DWARFDie.cpp:329
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:629
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:458
llvm::SmallVector
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Definition: SmallVector.h:1199
llvm::dwarf::Form
Form
Definition: Dwarf.h:132
llvm::DWARFFormValue::getAsAddress
Optional< uint64_t > getAsAddress() const
Definition: DWARFFormValue.cpp:669
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:88
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:728
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:397
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:891
llvm::DWARFExpression::print
void print(raw_ostream &OS, DIDumpOptions DumpOpts, const MCRegisterInfo *RegInfo, DWARFUnit *U, bool IsEH=false) const
Definition: DWARFExpression.cpp:324
attributes
Deduce and propagate attributes
Definition: Attributor.cpp:3590
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::DWARFUnit::getFormParams
const dwarf::FormParams & getFormParams() const
Definition: DWARFUnit.h:315
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:1042
llvm::Data
@ Data
Definition: SIMachineScheduler.h:55
llvm::getOffset
static Error getOffset(const SymbolRef &Sym, SectionRef Sec, uint64_t &Result)
Definition: RuntimeDyld.cpp:172
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:1197
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:651
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:84
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:247
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:409
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:722
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:486
llvm::DIDumpOptions::ChildRecurseDepth
unsigned ChildRecurseDepth
Definition: DIContext.h:190
llvm::DWARFDie::getDeclFile
std::string getDeclFile(DILineInfoSpecifier::FileLineInfoKind Kind) const
Definition: DWARFDie.cpp:479
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:53
llvm::DWARFObject
Definition: DWARFObject.h:26
llvm::DWARFFormValue
Definition: DWARFFormValue.h:28
llvm::StringRef::data
const char * data() const
data - Get a pointer to the start of the string (which may not be null terminated).
Definition: StringRef.h:131
llvm::DWARFDie::attribute_iterator
Definition: DWARFDie.h:301
FormatVariadic.h
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:567
llvm::DWARFFormValue::getAsRelativeReference
Optional< UnitOffset > getAsRelativeReference() const
Definition: DWARFFormValue.cpp:701
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:3124
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:474
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:1729
llvm::DWARFDie::getAddressRanges
Expected< DWARFAddressRangesVector > getAddressRanges() const
Get the address ranges for this DIE.
Definition: DWARFDie.cpp:380
llvm::dumpTypeUnqualifiedName
void dumpTypeUnqualifiedName(const DWARFDie &DIE, raw_ostream &OS, std::string *OriginalFullName=nullptr)
Definition: DWARFDie.cpp:771
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:252
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:276
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:365
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:411
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:152
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:50
Dwarf.h
llvm::DWARFUnit::getContext
DWARFContext & getContext() const
Definition: DWARFUnit.h:312
llvm::DWARFDie::getDwarfUnit
DWARFUnit * getDwarfUnit() const
Definition: DWARFDie.h:54
getParent
static const Function * getParent(const Value *V)
Definition: BasicAliasAnalysis.cpp:805
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:447
llvm::DWARFDie::getLocBaseAttribute
Optional< uint64_t > getLocBaseAttribute() const
Definition: DWARFDie.cpp:344
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:633
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::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:726
MRI
unsigned const MachineRegisterInfo * MRI
Definition: AArch64AdvSIMDScalarPass.cpp:105
llvm::DWARFDie::attribute_iterator::operator++
attribute_iterator & operator++()
Definition: DWARFDie.cpp:703
llvm::HighlightColor::Attribute
@ Attribute
WithColor.h
llvm::DWARFDie::getParent
DWARFDie getParent() const
Get the parent of this DIE object.
Definition: DWARFDie.cpp:627
llvm::DWARFUnit::getAddressByteSize
uint8_t getAddressByteSize() const
Definition: DWARFUnit.h:319
llvm::createStringError
Error createStringError(std::error_code EC, char const *Fmt, const Ts &... Vals)
Create formatted StringError object.
Definition: Error.h:1238
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::dumpTypeQualifiedName
void dumpTypeQualifiedName(const DWARFDie &DIE, raw_ostream &OS)
Definition: DWARFDie.cpp:767
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:79
llvm::None
constexpr std::nullopt_t None
Definition: None.h:27
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:754
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:235
llvm::SmallSet::insert
std::pair< const_iterator, bool > insert(const T &V)
insert - Insert an element into the set if it isn't already there.
Definition: SmallSet.h:178
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:309
isValid
static bool isValid(const char C)
Returns true if C is a valid mangled character: <0-9a-zA-Z_>.
Definition: RustDemangle.cpp:184
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:1047
llvm::DWARFDie::attributes
iterator_range< attribute_iterator > attributes() const
Get an iterator range to all attributes in the current DIE only.
Definition: DWARFDie.cpp:657
llvm::DINameKind::None
@ None
llvm::raw_ostream::indent
raw_ostream & indent(unsigned NumSpaces)
indent - Insert 'NumSpaces' spaces.
Definition: raw_ostream.cpp:494
llvm::DWARFFormValue::isFormClass
bool isFormClass(FormClass FC) const
Definition: DWARFFormValue.cpp:216
llvm::DWARFDie::getTypeSize
Optional< uint64_t > getTypeSize(uint64_t PointerSize)
Gets the type size (in bytes) for this DIE.
Definition: DWARFDie.cpp:495
llvm::DWARFContext::getDWARFObj
const DWARFObject & getDWARFObj() const
Definition: DWARFContext.h:126
llvm::SmallVectorImpl::pop_back_val
T pop_back_val()
Definition: SmallVector.h:677
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::DWARFDie::getHighPC
Optional< uint64_t > getHighPC(uint64_t LowPC) const
Get the DW_AT_high_pc attribute value as an address.
Definition: DWARFDie.cpp:348
llvm::DWARFAttribute::mayHaveLocationList
static bool mayHaveLocationList(dwarf::Attribute Attr)
Identify DWARF attributes that may contain a pointer to a location list.
Definition: DWARFDie.cpp:709
llvm::DWARFFormValue::createFromUnit
static DWARFFormValue createFromUnit(dwarf::Form F, const DWARFUnit *Unit, uint64_t *OffsetPtr)
Definition: DWARFFormValue.cpp:104
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:245
raw_ostream.h
llvm::DWARFUnit::getLocationTable
const DWARFLocationTable & getLocationTable()
Definition: DWARFUnit.h:378
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:556
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:645
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:441
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