LLVM  13.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"
21 #include "llvm/Object/ObjectFile.h"
23 #include "llvm/Support/Format.h"
27 #include "llvm/Support/WithColor.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 dumpLocation(raw_ostream &OS, const DWARFFormValue &FormValue,
73  DWARFUnit *U, unsigned Indent,
74  DIDumpOptions DumpOpts) {
75  DWARFContext &Ctx = U->getContext();
76  const MCRegisterInfo *MRI = Ctx.getRegisterInfo();
77  if (FormValue.isFormClass(DWARFFormValue::FC_Block) ||
79  ArrayRef<uint8_t> Expr = *FormValue.getAsBlock();
80  DataExtractor Data(StringRef((const char *)Expr.data(), Expr.size()),
81  Ctx.isLittleEndian(), 0);
83  .print(OS, DumpOpts, MRI, U);
84  return;
85  }
86 
88  uint64_t Offset = *FormValue.getAsSectionOffset();
89 
90  if (FormValue.getForm() == DW_FORM_loclistx) {
91  FormValue.dump(OS, DumpOpts);
92 
93  if (auto LoclistOffset = U->getLoclistOffset(Offset))
94  Offset = *LoclistOffset;
95  else
96  return;
97  }
99  MRI, Ctx.getDWARFObj(), U, DumpOpts,
100  Indent);
101  return;
102  }
103 
104  FormValue.dump(OS, DumpOpts);
105 }
106 
107 /// Dump the name encoded in the type tag.
109  StringRef TagStr = TagString(T);
110  if (!TagStr.startswith("DW_TAG_") || !TagStr.endswith("_type"))
111  return;
112  OS << TagStr.substr(7, TagStr.size() - 12) << " ";
113 }
114 
115 static void dumpArrayType(raw_ostream &OS, const DWARFDie &D) {
116  for (const DWARFDie &C : D.children())
117  if (C.getTag() == DW_TAG_subrange_type) {
119  Optional<uint64_t> Count;
121  Optional<unsigned> DefaultLB;
122  if (Optional<DWARFFormValue> L = C.find(DW_AT_lower_bound))
123  LB = L->getAsUnsignedConstant();
124  if (Optional<DWARFFormValue> CountV = C.find(DW_AT_count))
125  Count = CountV->getAsUnsignedConstant();
126  if (Optional<DWARFFormValue> UpperV = C.find(DW_AT_upper_bound))
127  UB = UpperV->getAsUnsignedConstant();
128  if (Optional<DWARFFormValue> LV =
129  D.getDwarfUnit()->getUnitDIE().find(DW_AT_language))
130  if (Optional<uint64_t> LC = LV->getAsUnsignedConstant())
131  if ((DefaultLB =
132  LanguageLowerBound(static_cast<dwarf::SourceLanguage>(*LC))))
133  if (LB && *LB == *DefaultLB)
134  LB = None;
135  if (!LB && !Count && !UB)
136  OS << "[]";
137  else if (!LB && (Count || UB) && DefaultLB)
138  OS << '[' << (Count ? *Count : *UB - *DefaultLB + 1) << ']';
139  else {
140  OS << "[[";
141  if (LB)
142  OS << *LB;
143  else
144  OS << '?';
145  OS << ", ";
146  if (Count)
147  if (LB)
148  OS << *LB + *Count;
149  else
150  OS << "? + " << *Count;
151  else if (UB)
152  OS << *UB + 1;
153  else
154  OS << '?';
155  OS << ")]";
156  }
157  }
158 }
159 
160 /// Recursively dump the DIE type name when applicable.
161 static void dumpTypeName(raw_ostream &OS, const DWARFDie &D) {
162  if (!D.isValid())
163  return;
164 
165  if (const char *Name = D.getName(DINameKind::LinkageName)) {
166  OS << Name;
167  return;
168  }
169 
170  // FIXME: We should have pretty printers per language. Currently we print
171  // everything as if it was C++ and fall back to the TAG type name.
172  const dwarf::Tag T = D.getTag();
173  switch (T) {
174  case DW_TAG_array_type:
175  case DW_TAG_pointer_type:
176  case DW_TAG_ptr_to_member_type:
177  case DW_TAG_reference_type:
178  case DW_TAG_rvalue_reference_type:
179  case DW_TAG_subroutine_type:
180  break;
181  default:
182  dumpTypeTagName(OS, T);
183  }
184 
185  // Follow the DW_AT_type if possible.
186  DWARFDie TypeDie = D.getAttributeValueAsReferencedDie(DW_AT_type);
187  dumpTypeName(OS, TypeDie);
188 
189  switch (T) {
190  case DW_TAG_subroutine_type: {
191  if (!TypeDie)
192  OS << "void";
193  OS << '(';
194  bool First = true;
195  for (const DWARFDie &C : D.children()) {
196  if (C.getTag() == DW_TAG_formal_parameter) {
197  if (!First)
198  OS << ", ";
199  First = false;
200  dumpTypeName(OS, C.getAttributeValueAsReferencedDie(DW_AT_type));
201  }
202  }
203  OS << ')';
204  break;
205  }
206  case DW_TAG_array_type: {
207  dumpArrayType(OS, D);
208  break;
209  }
210  case DW_TAG_pointer_type:
211  OS << '*';
212  break;
213  case DW_TAG_ptr_to_member_type:
214  if (DWARFDie Cont =
215  D.getAttributeValueAsReferencedDie(DW_AT_containing_type)) {
216  dumpTypeName(OS << ' ', Cont);
217  OS << "::";
218  }
219  OS << '*';
220  break;
221  case DW_TAG_reference_type:
222  OS << '&';
223  break;
224  case DW_TAG_rvalue_reference_type:
225  OS << "&&";
226  break;
227  default:
228  break;
229  }
230 }
231 
232 static void dumpAttribute(raw_ostream &OS, const DWARFDie &Die,
233  const DWARFAttribute &AttrValue, unsigned Indent,
234  DIDumpOptions DumpOpts) {
235  if (!Die.isValid())
236  return;
237  const char BaseIndent[] = " ";
238  OS << BaseIndent;
239  OS.indent(Indent + 2);
240  dwarf::Attribute Attr = AttrValue.Attr;
241  WithColor(OS, HighlightColor::Attribute) << formatv("{0}", Attr);
242 
243  dwarf::Form Form = AttrValue.Value.getForm();
244  if (DumpOpts.Verbose || DumpOpts.ShowForm)
245  OS << formatv(" [{0}]", Form);
246 
247  DWARFUnit *U = Die.getDwarfUnit();
248  const DWARFFormValue &FormValue = AttrValue.Value;
249 
250  OS << "\t(";
251 
252  StringRef Name;
253  std::string File;
254  auto Color = HighlightColor::Enumerator;
255  if (Attr == DW_AT_decl_file || Attr == DW_AT_call_file) {
256  Color = HighlightColor::String;
257  if (const auto *LT = U->getContext().getLineTableForUnit(U))
258  if (LT->getFileNameByIndex(
259  FormValue.getAsUnsignedConstant().getValue(),
260  U->getCompilationDir(),
262  File = '"' + File + '"';
263  Name = File;
264  }
265  } else if (Optional<uint64_t> Val = FormValue.getAsUnsignedConstant())
266  Name = AttributeValueString(Attr, *Val);
267 
268  if (!Name.empty())
269  WithColor(OS, Color) << Name;
270  else if (Attr == DW_AT_decl_line || Attr == DW_AT_call_line)
271  OS << *FormValue.getAsUnsignedConstant();
272  else if (Attr == DW_AT_low_pc &&
273  (FormValue.getAsAddress() ==
275  if (DumpOpts.Verbose) {
276  FormValue.dump(OS, DumpOpts);
277  OS << " (";
278  }
279  OS << "dead code";
280  if (DumpOpts.Verbose)
281  OS << ')';
282  } else if (Attr == DW_AT_high_pc && !DumpOpts.ShowForm && !DumpOpts.Verbose &&
283  FormValue.getAsUnsignedConstant()) {
284  if (DumpOpts.ShowAddresses) {
285  // Print the actual address rather than the offset.
286  uint64_t LowPC, HighPC, Index;
287  if (Die.getLowAndHighPC(LowPC, HighPC, Index))
289  else
290  FormValue.dump(OS, DumpOpts);
291  }
292  } else if (Form == dwarf::Form::DW_FORM_exprloc ||
294  dumpLocation(OS, FormValue, U, sizeof(BaseIndent) + Indent + 4, DumpOpts);
295  else
296  FormValue.dump(OS, DumpOpts);
297 
298  std::string Space = DumpOpts.ShowAddresses ? " " : "";
299 
300  // We have dumped the attribute raw value. For some attributes
301  // having both the raw value and the pretty-printed value is
302  // interesting. These attributes are handled below.
303  if (Attr == DW_AT_specification || Attr == DW_AT_abstract_origin) {
304  if (const char *Name =
307  OS << Space << "\"" << Name << '\"';
308  } else if (Attr == DW_AT_type) {
309  OS << Space << "\"";
310  dumpTypeName(OS, Die.getAttributeValueAsReferencedDie(FormValue));
311  OS << '"';
312  } else if (Attr == DW_AT_APPLE_property_attribute) {
313  if (Optional<uint64_t> OptVal = FormValue.getAsUnsignedConstant())
314  dumpApplePropertyAttribute(OS, *OptVal);
315  } else if (Attr == DW_AT_ranges) {
316  const DWARFObject &Obj = Die.getDwarfUnit()->getContext().getDWARFObj();
317  // For DW_FORM_rnglistx we need to dump the offset separately, since
318  // we have only dumped the index so far.
319  if (FormValue.getForm() == DW_FORM_rnglistx)
320  if (auto RangeListOffset =
321  U->getRnglistOffset(*FormValue.getAsSectionOffset())) {
323  dwarf::DW_FORM_sec_offset, *RangeListOffset);
324  FV.dump(OS, DumpOpts);
325  }
326  if (auto RangesOrError = Die.getAddressRanges())
327  dumpRanges(Obj, OS, RangesOrError.get(), U->getAddressByteSize(),
328  sizeof(BaseIndent) + Indent + 4, DumpOpts);
329  else
331  errc::invalid_argument, "decoding address ranges: %s",
332  toString(RangesOrError.takeError()).c_str()));
333  }
334 
335  OS << ")\n";
336 }
337 
338 bool DWARFDie::isSubprogramDIE() const { return getTag() == DW_TAG_subprogram; }
339 
340 bool DWARFDie::isSubroutineDIE() const {
341  auto Tag = getTag();
342  return Tag == DW_TAG_subprogram || Tag == DW_TAG_inlined_subroutine;
343 }
344 
346  if (!isValid())
347  return None;
348  auto AbbrevDecl = getAbbreviationDeclarationPtr();
349  if (AbbrevDecl)
350  return AbbrevDecl->getAttributeValue(getOffset(), Attr, *U);
351  return None;
352 }
353 
356  if (!isValid())
357  return None;
358  auto AbbrevDecl = getAbbreviationDeclarationPtr();
359  if (AbbrevDecl) {
360  for (auto Attr : Attrs) {
361  if (auto Value = AbbrevDecl->getAttributeValue(getOffset(), Attr, *U))
362  return Value;
363  }
364  }
365  return None;
366 }
367 
370  SmallVector<DWARFDie, 3> Worklist;
371  Worklist.push_back(*this);
372 
373  // Keep track if DIEs already seen to prevent infinite recursion.
374  // Empirically we rarely see a depth of more than 3 when dealing with valid
375  // DWARF. This corresponds to following the DW_AT_abstract_origin and
376  // DW_AT_specification just once.
378  Seen.insert(*this);
379 
380  while (!Worklist.empty()) {
381  DWARFDie Die = Worklist.pop_back_val();
382 
383  if (!Die.isValid())
384  continue;
385 
386  if (auto Value = Die.find(Attrs))
387  return Value;
388 
389  if (auto D = Die.getAttributeValueAsReferencedDie(DW_AT_abstract_origin))
390  if (Seen.insert(D).second)
391  Worklist.push_back(D);
392 
393  if (auto D = Die.getAttributeValueAsReferencedDie(DW_AT_specification))
394  if (Seen.insert(D).second)
395  Worklist.push_back(D);
396  }
397 
398  return None;
399 }
400 
401 DWARFDie
403  if (Optional<DWARFFormValue> F = find(Attr))
404  return getAttributeValueAsReferencedDie(*F);
405  return DWARFDie();
406 }
407 
408 DWARFDie
410  if (auto SpecRef = V.getAsRelativeReference()) {
411  if (SpecRef->Unit)
412  return SpecRef->Unit->getDIEForOffset(SpecRef->Unit->getOffset() + SpecRef->Offset);
413  if (auto SpecUnit = U->getUnitVector().getUnitForOffset(SpecRef->Offset))
414  return SpecUnit->getDIEForOffset(SpecRef->Offset);
415  }
416  return DWARFDie();
417 }
418 
420  return toSectionOffset(find({DW_AT_rnglists_base, DW_AT_GNU_ranges_base}));
421 }
422 
424  return toSectionOffset(find(DW_AT_loclists_base));
425 }
426 
427 Optional<uint64_t> DWARFDie::getHighPC(uint64_t LowPC) const {
428  uint64_t Tombstone = dwarf::computeTombstoneAddress(U->getAddressByteSize());
429  if (LowPC == Tombstone)
430  return None;
431  if (auto FormValue = find(DW_AT_high_pc)) {
432  if (auto Address = FormValue->getAsAddress()) {
433  // High PC is an address.
434  return Address;
435  }
436  if (auto Offset = FormValue->getAsUnsignedConstant()) {
437  // High PC is an offset from LowPC.
438  return LowPC + *Offset;
439  }
440  }
441  return None;
442 }
443 
444 bool DWARFDie::getLowAndHighPC(uint64_t &LowPC, uint64_t &HighPC,
445  uint64_t &SectionIndex) const {
446  auto F = find(DW_AT_low_pc);
447  auto LowPcAddr = toSectionedAddress(F);
448  if (!LowPcAddr)
449  return false;
450  if (auto HighPcAddr = getHighPC(LowPcAddr->Address)) {
451  LowPC = LowPcAddr->Address;
452  HighPC = *HighPcAddr;
453  SectionIndex = LowPcAddr->SectionIndex;
454  return true;
455  }
456  return false;
457 }
458 
460  if (isNULL())
461  return DWARFAddressRangesVector();
462  // Single range specified by low/high PC.
463  uint64_t LowPC, HighPC, Index;
464  if (getLowAndHighPC(LowPC, HighPC, Index))
465  return DWARFAddressRangesVector{{LowPC, HighPC, Index}};
466 
467  Optional<DWARFFormValue> Value = find(DW_AT_ranges);
468  if (Value) {
469  if (Value->getForm() == DW_FORM_rnglistx)
470  return U->findRnglistFromIndex(*Value->getAsSectionOffset());
471  return U->findRnglistFromOffset(*Value->getAsSectionOffset());
472  }
473  return DWARFAddressRangesVector();
474 }
475 
477  DWARFAddressRangesVector &Ranges) const {
478  if (isNULL())
479  return;
480  if (isSubprogramDIE()) {
481  if (auto DIERangesOrError = getAddressRanges())
482  llvm::append_range(Ranges, DIERangesOrError.get());
483  else
484  llvm::consumeError(DIERangesOrError.takeError());
485  }
486 
487  for (auto Child : children())
488  Child.collectChildrenAddressRanges(Ranges);
489 }
490 
491 bool DWARFDie::addressRangeContainsAddress(const uint64_t Address) const {
492  auto RangesOrError = getAddressRanges();
493  if (!RangesOrError) {
494  llvm::consumeError(RangesOrError.takeError());
495  return false;
496  }
497 
498  for (const auto &R : RangesOrError.get())
499  if (R.LowPC <= Address && Address < R.HighPC)
500  return true;
501  return false;
502 }
503 
506  Optional<DWARFFormValue> Location = find(Attr);
507  if (!Location)
508  return createStringError(inconvertibleErrorCode(), "No %s",
509  dwarf::AttributeString(Attr).data());
510 
511  if (Optional<uint64_t> Off = Location->getAsSectionOffset()) {
512  uint64_t Offset = *Off;
513 
514  if (Location->getForm() == DW_FORM_loclistx) {
515  if (auto LoclistOffset = U->getLoclistOffset(Offset))
516  Offset = *LoclistOffset;
517  else
519  "Loclist table not found");
520  }
521  return U->findLoclistFromOffset(Offset);
522  }
523 
524  if (Optional<ArrayRef<uint8_t>> Expr = Location->getAsBlock()) {
526  DWARFLocationExpression{None, to_vector<4>(*Expr)}};
527  }
528 
529  return createStringError(
530  inconvertibleErrorCode(), "Unsupported %s encoding: %s",
531  dwarf::AttributeString(Attr).data(),
532  dwarf::FormEncodingString(Location->getForm()).data());
533 }
534 
535 const char *DWARFDie::getSubroutineName(DINameKind Kind) const {
536  if (!isSubroutineDIE())
537  return nullptr;
538  return getName(Kind);
539 }
540 
541 const char *DWARFDie::getName(DINameKind Kind) const {
542  if (!isValid() || Kind == DINameKind::None)
543  return nullptr;
544  // Try to get mangled name only if it was asked for.
545  if (Kind == DINameKind::LinkageName) {
546  if (auto Name = getLinkageName())
547  return Name;
548  }
549  return getShortName();
550 }
551 
552 const char *DWARFDie::getShortName() const {
553  if (!isValid())
554  return nullptr;
555 
556  return dwarf::toString(findRecursively(dwarf::DW_AT_name), nullptr);
557 }
558 
559 const char *DWARFDie::getLinkageName() const {
560  if (!isValid())
561  return nullptr;
562 
563  return dwarf::toString(findRecursively({dwarf::DW_AT_MIPS_linkage_name,
564  dwarf::DW_AT_linkage_name}),
565  nullptr);
566 }
567 
568 uint64_t DWARFDie::getDeclLine() const {
569  return toUnsigned(findRecursively(DW_AT_decl_line), 0);
570 }
571 
572 std::string
574  std::string FileName;
575  if (auto DeclFile = toUnsigned(findRecursively(DW_AT_decl_file))) {
576  if (const auto *LT = U->getContext().getLineTableForUnit(U)) {
577  LT->getFileNameByIndex(*DeclFile, U->getCompilationDir(), Kind, FileName);
578  }
579  }
580  return FileName;
581 }
582 
583 void DWARFDie::getCallerFrame(uint32_t &CallFile, uint32_t &CallLine,
584  uint32_t &CallColumn,
585  uint32_t &CallDiscriminator) const {
586  CallFile = toUnsigned(find(DW_AT_call_file), 0);
587  CallLine = toUnsigned(find(DW_AT_call_line), 0);
588  CallColumn = toUnsigned(find(DW_AT_call_column), 0);
589  CallDiscriminator = toUnsigned(find(DW_AT_GNU_discriminator), 0);
590 }
591 
592 /// Helper to dump a DIE with all of its parents, but no siblings.
593 static unsigned dumpParentChain(DWARFDie Die, raw_ostream &OS, unsigned Indent,
594  DIDumpOptions DumpOpts, unsigned Depth = 0) {
595  if (!Die)
596  return Indent;
597  if (DumpOpts.ParentRecurseDepth > 0 && Depth >= DumpOpts.ParentRecurseDepth)
598  return Indent;
599  Indent = dumpParentChain(Die.getParent(), OS, Indent, DumpOpts, Depth + 1);
600  Die.dump(OS, Indent, DumpOpts);
601  return Indent + 2;
602 }
603 
604 void DWARFDie::dump(raw_ostream &OS, unsigned Indent,
605  DIDumpOptions DumpOpts) const {
606  if (!isValid())
607  return;
608  DWARFDataExtractor debug_info_data = U->getDebugInfoExtractor();
609  const uint64_t Offset = getOffset();
610  uint64_t offset = Offset;
611  if (DumpOpts.ShowParents) {
612  DIDumpOptions ParentDumpOpts = DumpOpts;
613  ParentDumpOpts.ShowParents = false;
614  ParentDumpOpts.ShowChildren = false;
615  Indent = dumpParentChain(getParent(), OS, Indent, ParentDumpOpts);
616  }
617 
618  if (debug_info_data.isValidOffset(offset)) {
619  uint32_t abbrCode = debug_info_data.getULEB128(&offset);
620  if (DumpOpts.ShowAddresses)
622  << format("\n0x%8.8" PRIx64 ": ", Offset);
623 
624  if (abbrCode) {
625  auto AbbrevDecl = getAbbreviationDeclarationPtr();
626  if (AbbrevDecl) {
627  WithColor(OS, HighlightColor::Tag).get().indent(Indent)
628  << formatv("{0}", getTag());
629  if (DumpOpts.Verbose)
630  OS << format(" [%u] %c", abbrCode,
631  AbbrevDecl->hasChildren() ? '*' : ' ');
632  OS << '\n';
633 
634  // Dump all data in the DIE for the attributes.
635  for (const DWARFAttribute &AttrValue : attributes())
636  dumpAttribute(OS, *this, AttrValue, Indent, DumpOpts);
637 
638  if (DumpOpts.ShowChildren && DumpOpts.ChildRecurseDepth > 0) {
639  DWARFDie Child = getFirstChild();
640  DumpOpts.ChildRecurseDepth--;
641  DIDumpOptions ChildDumpOpts = DumpOpts;
642  ChildDumpOpts.ShowParents = false;
643  while (Child) {
644  Child.dump(OS, Indent + 2, ChildDumpOpts);
645  Child = Child.getSibling();
646  }
647  }
648  } else {
649  OS << "Abbreviation code not found in 'debug_abbrev' class for code: "
650  << abbrCode << '\n';
651  }
652  } else {
653  OS.indent(Indent) << "NULL\n";
654  }
655  }
656 }
657 
658 LLVM_DUMP_METHOD void DWARFDie::dump() const { dump(llvm::errs(), 0); }
659 
661  if (isValid())
662  return U->getParent(Die);
663  return DWARFDie();
664 }
665 
667  if (isValid())
668  return U->getSibling(Die);
669  return DWARFDie();
670 }
671 
673  if (isValid())
674  return U->getPreviousSibling(Die);
675  return DWARFDie();
676 }
677 
679  if (isValid())
680  return U->getFirstChild(Die);
681  return DWARFDie();
682 }
683 
685  if (isValid())
686  return U->getLastChild(Die);
687  return DWARFDie();
688 }
689 
691  return make_range(attribute_iterator(*this, false),
692  attribute_iterator(*this, true));
693 }
694 
696  : Die(D), Index(0) {
697  auto AbbrDecl = Die.getAbbreviationDeclarationPtr();
698  assert(AbbrDecl && "Must have abbreviation declaration");
699  if (End) {
700  // This is the end iterator so we set the index to the attribute count.
701  Index = AbbrDecl->getNumAttributes();
702  } else {
703  // This is the begin iterator so we extract the value for this->Index.
704  AttrValue.Offset = D.getOffset() + AbbrDecl->getCodeByteSize();
705  updateForIndex(*AbbrDecl, 0);
706  }
707 }
708 
709 void DWARFDie::attribute_iterator::updateForIndex(
710  const DWARFAbbreviationDeclaration &AbbrDecl, uint32_t I) {
711  Index = I;
712  // AbbrDecl must be valid before calling this function.
713  auto NumAttrs = AbbrDecl.getNumAttributes();
714  if (Index < NumAttrs) {
715  AttrValue.Attr = AbbrDecl.getAttrByIndex(Index);
716  // Add the previous byte size of any previous attribute value.
717  AttrValue.Offset += AttrValue.ByteSize;
718  uint64_t ParseOffset = AttrValue.Offset;
719  if (AbbrDecl.getAttrIsImplicitConstByIndex(Index))
721  AbbrDecl.getFormByIndex(Index),
723  else {
724  auto U = Die.getDwarfUnit();
725  assert(U && "Die must have valid DWARF unit");
727  AbbrDecl.getFormByIndex(Index), U, &ParseOffset);
728  }
729  AttrValue.ByteSize = ParseOffset - AttrValue.Offset;
730  } else {
731  assert(Index == NumAttrs && "Indexes should be [0, NumAttrs) only");
732  AttrValue = {};
733  }
734 }
735 
737  if (auto AbbrDecl = Die.getAbbreviationDeclarationPtr())
738  updateForIndex(*AbbrDecl, Index + 1);
739  return *this;
740 }
741 
743  switch (Attr) {
744  // From the DWARF v5 specification.
745  case DW_AT_location:
746  case DW_AT_byte_size:
747  case DW_AT_bit_size:
748  case DW_AT_string_length:
749  case DW_AT_lower_bound:
750  case DW_AT_return_addr:
751  case DW_AT_bit_stride:
752  case DW_AT_upper_bound:
753  case DW_AT_count:
754  case DW_AT_data_member_location:
755  case DW_AT_frame_base:
756  case DW_AT_segment:
757  case DW_AT_static_link:
758  case DW_AT_use_location:
759  case DW_AT_vtable_elem_location:
760  case DW_AT_allocated:
761  case DW_AT_associated:
762  case DW_AT_byte_stride:
763  case DW_AT_rank:
764  case DW_AT_call_value:
765  case DW_AT_call_origin:
766  case DW_AT_call_target:
767  case DW_AT_call_target_clobbered:
768  case DW_AT_call_data_location:
769  case DW_AT_call_data_value:
770  // Extensions.
771  case DW_AT_GNU_call_site_value:
772  case DW_AT_GNU_call_site_target:
773  return true;
774  default:
775  return false;
776  }
777 }
llvm::DWARFLocationExpressionsVector
std::vector< DWARFLocationExpression > DWARFLocationExpressionsVector
Represents a set of absolute location expressions.
Definition: DWARFLocationExpression.h:45
llvm::EngineKind::Kind
Kind
Definition: ExecutionEngine.h:524
DWARFFormValue.h
llvm::errc::invalid_argument
@ invalid_argument
llvm::StringRef::startswith
LLVM_NODISCARD bool startswith(StringRef Prefix) const
Check if this string starts with the given Prefix.
Definition: StringRef.h:289
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:929
Attrs
Function Attrs
Definition: README_ALTIVEC.txt:215
getName
static StringRef getName(Value *V)
Definition: ProvenanceAnalysisEvaluator.cpp:42
llvm::DWARFUnit::findRnglistFromIndex
Expected< DWARFAddressRangesVector > findRnglistFromIndex(uint32_t Index)
Return a vector of address ranges retrieved from an encoded range list whose offset is found via a ta...
Definition: DWARFUnit.cpp:588
llvm::DIDumpOptions::ShowForm
bool ShowForm
Definition: DIContext.h:196
llvm::DWARFDie::isValid
bool isValid() const
Definition: DWARFDie.h:51
llvm::DWARFUnit::getFirstChild
DWARFDie getFirstChild(const DWARFDebugInfoEntry *Die)
Definition: DWARFUnit.cpp:769
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:499
MathExtras.h
llvm
Definition: AllocatorList.h:23
llvm::DWARFDie::getAttributeValueAsReferencedDie
DWARFDie getAttributeValueAsReferencedDie(dwarf::Attribute Attr) const
Extract the specified attribute from this DIE as the referenced DIE.
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
llvm::DWARFDie::attribute_iterator::operator++
attribute_iterator & operator++()
llvm::DWARFAttribute::Value
DWARFFormValue Value
The form and value for this attribute.
Definition: DWARFAttribute.h:32
llvm::DWARFUnit::getRnglistOffset
Optional< uint64_t > getRnglistOffset(uint32_t Index)
Return a rangelist's offset based on an index.
Definition: DWARFUnit.cpp:940
llvm::StringRef::endswith
LLVM_NODISCARD bool endswith(StringRef Suffix) const
Check if this string ends with the given Suffix.
Definition: StringRef.h:300
llvm::DWARFAttribute::Attr
dwarf::Attribute Attr
The attribute enumeration of this attribute.
Definition: DWARFAttribute.h:30
StringRef.h
dumpTypeTagName
static void dumpTypeTagName(raw_ostream &OS, dwarf::Tag T)
Dump the name encoded in the type tag.
Definition: DWARFDie.cpp:108
llvm::DWARFAbbreviationDeclaration::getFormByIndex
dwarf::Form getFormByIndex(uint32_t idx) const
Definition: DWARFAbbreviationDeclaration.h:100
llvm::SmallVector
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Definition: SmallVector.h:1168
llvm::dwarf::Form
Form
Definition: Dwarf.h:131
llvm::DWARFFormValue::getAsAddress
Optional< uint64_t > getAsAddress() const
Definition: DWARFFormValue.cpp:662
llvm::DWARFDie::getLocations
Expected< DWARFLocationExpressionsVector > getLocations(dwarf::Attribute Attr) const
DWARFContext.h
llvm::dwarf::toSectionedAddress
Optional< object::SectionedAddress > toSectionedAddress(const Optional< DWARFFormValue > &V)
Definition: DWARFFormValue.h:273
llvm::DWARFDie::getAbbreviationDeclarationPtr
const DWARFAbbreviationDeclaration * getAbbreviationDeclarationPtr() const
Get the abbreviation declaration for this DIE.
Definition: DWARFDie.h:59
llvm::DWARFDie::getDeclLine
uint64_t getDeclLine() const
Returns the declaration line (start line) for a DIE, assuming it specifies a subprogram.
llvm::DWARFFormValue::createFromUValue
static DWARFFormValue createFromUValue(dwarf::Form F, uint64_t V)
Definition: DWARFFormValue.cpp:84
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:721
llvm::DWARFAttribute::ByteSize
uint32_t ByteSize
The debug info/types section byte size of the data for this attribute.
Definition: DWARFAttribute.h:28
llvm::Depth
@ Depth
Definition: SIMachineScheduler.h:34
llvm::DWARFAttribute::mayHaveLocationDescription
static bool mayHaveLocationDescription(dwarf::Attribute Attr)
Identifies DWARF attributes that may contain a reference to a DWARF expression.
Shift
bool Shift
Definition: README.txt:468
llvm::WithColor::get
raw_ostream & get()
Definition: WithColor.h:80
llvm::DWARFContext
DWARFContext This data structure is the top level entity that deals with dwarf debug information pars...
Definition: DWARFContext.h:53
llvm::DWARFDie::getAddressRanges
Expected< DWARFAddressRangesVector > getAddressRanges() const
Get the address ranges for this DIE.
llvm::DWARFFormValue::FC_Exprloc
@ FC_Exprloc
Definition: DWARFFormValue.h:38
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:134
llvm::WithColor
An RAII object that temporarily switches an output stream to a specific color.
Definition: WithColor.h:53
llvm::Optional< uint64_t >
T
#define T
Definition: Mips16ISelLowering.cpp:341
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.
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,...
Offset
uint64_t Offset
Definition: ELFObjHandler.cpp:81
llvm::errs
raw_fd_ostream & errs()
This returns a reference to a raw_ostream for standard error.
Definition: raw_ostream.cpp:892
llvm::DWARFExpression::print
void print(raw_ostream &OS, DIDumpOptions DumpOpts, const MCRegisterInfo *RegInfo, DWARFUnit *U, bool IsEH=false) const
Definition: DWARFExpression.cpp:324
llvm::DWARFDie::attributes
iterator_range< attribute_iterator > attributes() const
Get an iterator range to all attributes in the current DIE only.
attributes
Deduce and propagate attributes
Definition: Attributor.cpp:2605
llvm::dump
void dump(const SparseBitVector< ElementSize > &LHS, raw_ostream &out)
Definition: SparseBitVector.h:876
llvm::Expected
Tagged union holding either a T or a Error.
Definition: APFloat.h:42
llvm::DWARFUnit::getUnitVector
const DWARFUnitVector & getUnitVector() const
Return the DWARFUnitVector containing this unit.
Definition: DWARFUnit.h:435
llvm::SmallVectorImpl::pop_back_val
LLVM_NODISCARD T pop_back_val()
Definition: SmallVector.h:635
llvm::DWARFUnit::getFormParams
const dwarf::FormParams & getFormParams() const
Definition: DWARFUnit.h:281
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:104
llvm::DINameKind::LinkageName
@ LinkageName
Format.h
llvm::dwarf::FormParams::Format
DwarfFormat Format
Definition: Dwarf.h:651
llvm::consumeError
void consumeError(Error Err)
Consume a Error without doing anything.
Definition: Error.h:1006
llvm::Data
@ Data
Definition: SIMachineScheduler.h:56
llvm::getOffset
static Error getOffset(const SymbolRef &Sym, SectionRef Sec, uint64_t &Result)
Definition: RuntimeDyld.cpp:170
llvm::DWARFDie::addressRangeContainsAddress
bool addressRangeContainsAddress(const uint64_t Address) const
llvm::dwarf::Attribute
Attribute
Attributes.
Definition: Dwarf.h:124
llvm::ArrayRef::data
const T * data() const
Definition: ArrayRef.h:160
F
#define F(x, y, z)
Definition: MD5.cpp:56
llvm::RISCVFenceField::R
@ R
Definition: RISCVBaseInfo.h:129
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.
llvm::DWARFUnit::getLoclistOffset
Optional< uint64_t > getLoclistOffset(uint32_t Index)
Definition: DWARFUnit.cpp:951
llvm::AArch64CC::LT
@ LT
Definition: AArch64BaseInfo.h:247
llvm::StringRef::substr
LLVM_NODISCARD StringRef substr(size_t Start, size_t N=npos) const
Return a reference to the substring from [Start, Start + N).
Definition: StringRef.h:612
llvm::DWARFAttribute::Offset
uint64_t Offset
The debug info/types offset for this attribute.
Definition: DWARFAttribute.h:26
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:221
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:250
llvm::DIDumpOptions::ShowAddresses
bool ShowAddresses
Definition: DIContext.h:193
llvm::DWARFDie::collectChildrenAddressRanges
void collectChildrenAddressRanges(DWARFAddressRangesVector &Ranges) const
Get all address ranges for any DW_TAG_subprogram DIEs in this DIE or any of its children.
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:80
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:58
DWARFDebugRangeList.h
llvm::DIDumpOptions::Verbose
bool Verbose
Definition: DIContext.h:198
llvm::DINameKind
DINameKind
A DINameKind is passed to name search methods to specify a preference regarding the type of name reso...
Definition: DIContext.h:138
dumpApplePropertyAttribute
static void dumpApplePropertyAttribute(raw_ostream &OS, uint64_t Val)
Definition: DWARFDie.cpp:40
llvm::dwarf::computeTombstoneAddress
uint64_t computeTombstoneAddress(uint8_t AddressByteSize)
Definition: Dwarf.h:772
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::getHighPC
Optional< uint64_t > getHighPC(uint64_t LowPC) const
Get the DW_AT_high_pc attribute value as an address.
C
(vector float) vec_cmpeq(*A, *B) C
Definition: README_ALTIVEC.txt:86
llvm::HighlightColor::Enumerator
@ Enumerator
llvm::DWARFDie::getDeclFile
std::string getDeclFile(DILineInfoSpecifier::FileLineInfoKind Kind) const
llvm::dwarf::getTag
unsigned getTag(StringRef TagString)
Definition: Dwarf.cpp:32
llvm::DWARFFormValue::FC_SectionOffset
@ FC_SectionOffset
Definition: DWARFFormValue.h:37
llvm::DWARFFormValue::dump
void dump(raw_ostream &OS, DIDumpOptions DumpOpts=DIDumpOptions()) const
Definition: DWARFFormValue.cpp:405
llvm::dwarf::LanguageLowerBound
Optional< unsigned > LanguageLowerBound(SourceLanguage L)
Definition: Dwarf.cpp:368
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:121
llvm::DIDumpOptions::ShowChildren
bool ShowChildren
Definition: DIContext.h:194
llvm::DWARFFormValue::getAsSectionOffset
Optional< uint64_t > getAsSectionOffset() const
Definition: DWARFFormValue.cpp:715
DWARFDie.h
llvm::dwarf::Index
Index
Definition: Dwarf.h:467
First
into llvm powi allowing the code generator to produce balanced multiplication trees First
Definition: README.txt:54
llvm::DIDumpOptions::ChildRecurseDepth
unsigned ChildRecurseDepth
Definition: DIContext.h:189
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:294
llvm::DWARFDie::getLastChild
DWARFDie getLastChild() const
Get the last child of this DIE object.
llvm::raw_ostream
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition: raw_ostream.h:50
llvm::DWARFObject
Definition: DWARFObject.h:25
llvm::DWARFFormValue
Definition: DWARFFormValue.h:26
llvm::DWARFDie::getParent
DWARFDie getParent() const
Get the parent of this DIE object.
llvm::DWARFDie::isSubroutineDIE
bool isSubroutineDIE() const
Returns true if DIE represents a subprogram or an inlined subroutine.
llvm::DWARFDie::attribute_iterator
Definition: DWARFDie.h:300
FormatVariadic.h
llvm::None
const NoneType None
Definition: None.h:23
llvm::dwarf::FormEncodingString
StringRef FormEncodingString(unsigned Encoding)
Definition: Dwarf.cpp:105
llvm::DWARFUnit::getParent
DWARFDie getParent(const DWARFDebugInfoEntry *Die)
Definition: DWARFUnit.cpp:711
llvm::DWARFFormValue::getAsRelativeReference
Optional< UnitOffset > getAsRelativeReference() const
Definition: DWARFFormValue.cpp:694
llvm::DIDumpOptions::ShowParents
bool ShowParents
Definition: DIContext.h:195
getLinkageName
static std::string getLinkageName(GlobalValue::LinkageTypes LT)
Definition: AsmWriter.cpp:3153
llvm::DWARFUnit::getDebugInfoExtractor
DWARFDataExtractor getDebugInfoExtractor() const
Definition: DWARFUnit.cpp:188
object
bar al al movzbl eax ret Missed when stored in a memory object
Definition: README.txt:1411
llvm::DWARFUnit::findLoclistFromOffset
Expected< DWARFLocationExpressionsVector > findLoclistFromOffset(uint64_t Offset)
Definition: DWARFUnit.cpp:613
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...
llvm::DWARFDie::getSibling
DWARFDie getSibling() const
Get the sibling of this DIE object.
D
static GCRegistry::Add< StatepointGC > D("statepoint-example", "an example strategy for statepoint")
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:1525
llvm::DWARFDie::find
Optional< DWARFFormValue > find(dwarf::Attribute Attr) const
Extract the specified attribute from this DIE.
I
#define I(x, y, z)
Definition: MD5.cpp:59
DWARFUnit.h
llvm::DWARFUnit::getSibling
DWARFDie getSibling(const DWARFDebugInfoEntry *Die)
Definition: DWARFUnit.cpp:730
llvm::DILineInfoSpecifier::FileLineInfoKind
FileLineInfoKind
Definition: DIContext.h:143
llvm::DWARFDie::isSubprogramDIE
bool isSubprogramDIE() const
Returns true if DIE represents a subprogram (not inlined).
llvm::DWARFExpression
Definition: DWARFExpression.h:25
llvm::HighlightColor::Address
@ Address
llvm::DWARFDie::getPreviousSibling
DWARFDie getPreviousSibling() const
Get the previous sibling of this DIE object.
llvm::DataExtractor::isValidOffset
bool isValidOffset(uint64_t offset) const
Test the validity of offset.
Definition: DataExtractor.h:662
DWARFAbbreviationDeclaration.h
llvm::DWARFFormValue::FC_Block
@ FC_Block
Definition: DWARFFormValue.h:31
assert
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
ObjectFile.h
llvm::children
iterator_range< typename GraphTraits< GraphType >::ChildIteratorType > children(const typename GraphTraits< GraphType >::NodeRef &G)
Definition: GraphTraits.h:121
llvm::AMDGPU::IsaInfo::TargetIDSetting::Off
@ Off
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:166
llvm::dwarf::SourceLanguage
SourceLanguage
Definition: Dwarf.h:200
llvm::DWARFDie::getFirstChild
DWARFDie getFirstChild() const
Get the first child of this DIE object.
llvm::DWARFUnit::getCompilationDir
const char * getCompilationDir()
Definition: DWARFUnit.cpp:348
llvm::ArrayRef< uint8_t >
llvm::DWARFAbbreviationDeclaration::getNumAttributes
size_t getNumAttributes() const
Definition: DWARFAbbreviationDeclaration.h:105
llvm::DWARFContext::isLittleEndian
bool isLittleEndian() const
Definition: DWARFContext.h:366
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:57
Dwarf.h
llvm::DWARFUnit::getContext
DWARFContext & getContext() const
Definition: DWARFUnit.h:278
dumpArrayType
static void dumpArrayType(raw_ostream &OS, const DWARFDie &D)
Definition: DWARFDie.cpp:115
dumpLocation
static void dumpLocation(raw_ostream &OS, const DWARFFormValue &FormValue, DWARFUnit *U, unsigned Indent, DIDumpOptions DumpOpts)
Definition: DWARFDie.cpp:72
llvm::DWARFUnitVector::getUnitForOffset
DWARFUnit * getUnitForOffset(uint64_t Offset) const
Definition: DWARFUnit.cpp:131
llvm::DWARFDie::getDwarfUnit
DWARFUnit * getDwarfUnit() const
Definition: DWARFDie.h:54
getParent
static const Function * getParent(const Value *V)
Definition: BasicAliasAnalysis.cpp:759
uint32_t
llvm::append_range
void append_range(Container &C, Range &&R)
Wrapper function to append a range to a container.
Definition: STLExtras.h:1690
llvm::dwarf::ApplePropertyString
StringRef ApplePropertyString(unsigned)
Definition: Dwarf.cpp:565
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:180
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::DWARFDie::dump
LLVM_DUMP_METHOD void dump() const
Convenience zero-argument overload for debugging.
MRI
unsigned const MachineRegisterInfo * MRI
Definition: AArch64AdvSIMDScalarPass.cpp:105
llvm::DWARFUnit::findRnglistFromOffset
Expected< DWARFAddressRangesVector > findRnglistFromOffset(uint64_t Offset)
Return a vector of address ranges resulting from a (possibly encoded) range list starting at a given ...
Definition: DWARFUnit.cpp:571
llvm::HighlightColor::Attribute
@ Attribute
WithColor.h
llvm::DWARFDie::getLocBaseAttribute
Optional< uint64_t > getLocBaseAttribute() const
llvm::DWARFUnit::getAddressByteSize
uint8_t getAddressByteSize() const
Definition: DWARFUnit.h:285
llvm::DWARFUnit::getLastChild
DWARFDie getLastChild(const DWARFDebugInfoEntry *Die)
Definition: DWARFUnit.cpp:780
llvm::createStringError
Error createStringError(std::error_code EC, char const *Fmt, const Ts &... Vals)
Create formatted StringError object.
Definition: Error.h:1202
llvm::DWARFAddressRangesVector
std::vector< DWARFAddressRange > DWARFAddressRangesVector
DWARFAddressRangesVector - represents a set of absolute address ranges.
Definition: DWARFAddressRange.h:83
llvm::GraphProgram::Name
Name
Definition: GraphWriter.h:52
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:377
llvm::DWARFAbbreviationDeclaration
Definition: DWARFAbbreviationDeclaration.h:27
llvm::DWARFUnit
Definition: DWARFUnit.h:203
llvm::DWARFUnit::getPreviousSibling
DWARFDie getPreviousSibling(const DWARFDebugInfoEntry *Die)
Definition: DWARFUnit.cpp:750
llvm::DWARFFormValue::getAsBlock
Optional< ArrayRef< uint8_t > > getAsBlock() const
Definition: DWARFFormValue.cpp:747
DataExtractor.h
llvm::TargetStackID::Value
Value
Definition: TargetFrameLowering.h:27
DWARFExpression.h
llvm::DWARFDie::getRangesBaseAttribute
Optional< uint64_t > getRangesBaseAttribute() const
Extract the range base attribute from this DIE as absolute section offset.
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:201
FormatAdapters.h
llvm::DataExtractor
Definition: DataExtractor.h:41
llvm::DWARFUnit::getBaseAddress
llvm::Optional< object::SectionedAddress > getBaseAddress()
Definition: DWARFUnit.cpp:801
llvm::DINameKind::None
@ None
llvm::raw_ostream::indent
raw_ostream & indent(unsigned NumSpaces)
indent - Insert 'NumSpaces' spaces.
Definition: raw_ostream.cpp:497
llvm::DWARFFormValue::isFormClass
bool isFormClass(FormClass FC) const
Definition: DWARFFormValue.cpp:212
llvm::DWARFContext::getDWARFObj
const DWARFObject & getDWARFObj() const
Definition: DWARFContext.h:130
llvm::ArrayRef::size
size_t size() const
size - Get the array size.
Definition: ArrayRef.h:163
llvm::DWARFFormValue::getForm
dwarf::Form getForm() const
Definition: DWARFFormValue.h:77
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:152
llvm::DWARFFormValue::createFromUnit
static DWARFFormValue createFromUnit(dwarf::Form F, const DWARFUnit *Unit, uint64_t *OffsetPtr)
Definition: DWARFFormValue.cpp:100
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:22
llvm::DWARFDie::getLinkageName
const char * getLinkageName() const
Return the DIE linkage name resolving DW_AT_specification or DW_AT_abstract_origin references if nece...
llvm::DWARFDie::getShortName
const char * getShortName() const
Return the DIE short name resolving DW_AT_specification or DW_AT_abstract_origin references if necess...
llvm::dwarf::TagString
StringRef TagString(unsigned Tag)
Definition: Dwarf.cpp:21
raw_ostream.h
llvm::DWARFUnit::getLocationTable
const DWARFLocationTable & getLocationTable()
Definition: DWARFUnit.h:335
llvm::StringRef::size
LLVM_NODISCARD size_t size() const
size - Get the string size.
Definition: StringRef.h:160
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.
llvm::Value
LLVM Value Representation.
Definition: Value.h:75
File
Instrumentation for Order File
Definition: InstrOrderFile.cpp:206
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...
llvm::dwarf::AttributeString
StringRef AttributeString(unsigned Attribute)
Definition: Dwarf.cpp:72
llvm::DIDumpOptions::ParentRecurseDepth
unsigned ParentRecurseDepth
Definition: DIContext.h:190
llvm::Optional::getValue
constexpr const T & getValue() const LLVM_LVALUE_FUNCTION
Definition: Optional.h:280
SmallSet.h
llvm::DIDumpOptions
Container for dump options that control which debug information will be dumped.
Definition: DIContext.h:187
llvm::DIDumpOptions::RecoverableErrorHandler
std::function< void(Error)> RecoverableErrorHandler
Definition: DIContext.h:219