LLVM  16.0.0git
DWARFUnit.cpp
Go to the documentation of this file.
1 //===- DWARFUnit.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/SmallString.h"
11 #include "llvm/ADT/StringRef.h"
28 #include "llvm/Object/ObjectFile.h"
30 #include "llvm/Support/Errc.h"
31 #include "llvm/Support/Path.h"
32 #include <algorithm>
33 #include <cassert>
34 #include <cstddef>
35 #include <cstdint>
36 #include <utility>
37 #include <vector>
38 
39 using namespace llvm;
40 using namespace dwarf;
41 
43  const DWARFSection &Section,
45  const DWARFObject &D = C.getDWARFObj();
46  addUnitsImpl(C, D, Section, C.getDebugAbbrev(), &D.getRangesSection(),
47  &D.getLocSection(), D.getStrSection(),
48  D.getStrOffsetsSection(), &D.getAddrSection(),
49  D.getLineSection(), D.isLittleEndian(), false, false,
50  SectionKind);
51 }
52 
54  const DWARFSection &DWOSection,
56  bool Lazy) {
57  const DWARFObject &D = C.getDWARFObj();
58  addUnitsImpl(C, D, DWOSection, C.getDebugAbbrevDWO(), &D.getRangesDWOSection(),
59  &D.getLocDWOSection(), D.getStrDWOSection(),
60  D.getStrOffsetsDWOSection(), &D.getAddrSection(),
61  D.getLineDWOSection(), C.isLittleEndian(), true, Lazy,
62  SectionKind);
63 }
64 
65 void DWARFUnitVector::addUnitsImpl(
66  DWARFContext &Context, const DWARFObject &Obj, const DWARFSection &Section,
67  const DWARFDebugAbbrev *DA, const DWARFSection *RS,
68  const DWARFSection *LocSection, StringRef SS, const DWARFSection &SOS,
69  const DWARFSection *AOS, const DWARFSection &LS, bool LE, bool IsDWO,
70  bool Lazy, DWARFSectionKind SectionKind) {
71  DWARFDataExtractor Data(Obj, Section, LE, 0);
72  // Lazy initialization of Parser, now that we have all section info.
73  if (!Parser) {
74  Parser = [=, &Context, &Obj, &Section, &SOS,
76  const DWARFSection *CurSection,
77  const DWARFUnitIndex::Entry *IndexEntry)
78  -> std::unique_ptr<DWARFUnit> {
79  const DWARFSection &InfoSection = CurSection ? *CurSection : Section;
80  DWARFDataExtractor Data(Obj, InfoSection, LE, 0);
81  if (!Data.isValidOffset(Offset))
82  return nullptr;
83  DWARFUnitHeader Header;
84  if (!Header.extract(Context, Data, &Offset, SectionKind))
85  return nullptr;
86  if (!IndexEntry && IsDWO) {
88  Context, Header.isTypeUnit() ? DW_SECT_EXT_TYPES : DW_SECT_INFO);
89  if (Index) {
90  if (Header.isTypeUnit())
91  IndexEntry = Index.getFromHash(Header.getTypeHash());
92  else if (auto DWOId = Header.getDWOId())
93  IndexEntry = Index.getFromHash(*DWOId);
94  }
95  if (!IndexEntry)
96  IndexEntry = Index.getFromOffset(Header.getOffset());
97  }
98  if (IndexEntry && !Header.applyIndexEntry(IndexEntry))
99  return nullptr;
100  std::unique_ptr<DWARFUnit> U;
101  if (Header.isTypeUnit())
102  U = std::make_unique<DWARFTypeUnit>(Context, InfoSection, Header, DA,
103  RS, LocSection, SS, SOS, AOS, LS,
104  LE, IsDWO, *this);
105  else
106  U = std::make_unique<DWARFCompileUnit>(Context, InfoSection, Header,
107  DA, RS, LocSection, SS, SOS,
108  AOS, LS, LE, IsDWO, *this);
109  return U;
110  };
111  }
112  if (Lazy)
113  return;
114  // Find a reasonable insertion point within the vector. We skip over
115  // (a) units from a different section, (b) units from the same section
116  // but with lower offset-within-section. This keeps units in order
117  // within a section, although not necessarily within the object file,
118  // even if we do lazy parsing.
119  auto I = this->begin();
120  uint64_t Offset = 0;
121  while (Data.isValidOffset(Offset)) {
122  if (I != this->end() &&
123  (&(*I)->getInfoSection() != &Section || (*I)->getOffset() == Offset)) {
124  ++I;
125  continue;
126  }
127  auto U = Parser(Offset, SectionKind, &Section, nullptr);
128  // If parsing failed, we're done with this section.
129  if (!U)
130  break;
131  Offset = U->getNextUnitOffset();
132  I = std::next(this->insert(I, std::move(U)));
133  }
134 }
135 
136 DWARFUnit *DWARFUnitVector::addUnit(std::unique_ptr<DWARFUnit> Unit) {
137  auto I = llvm::upper_bound(*this, Unit,
138  [](const std::unique_ptr<DWARFUnit> &LHS,
139  const std::unique_ptr<DWARFUnit> &RHS) {
140  return LHS->getOffset() < RHS->getOffset();
141  });
142  return this->insert(I, std::move(Unit))->get();
143 }
144 
146  auto end = begin() + getNumInfoUnits();
147  auto *CU =
148  std::upper_bound(begin(), end, Offset,
149  [](uint64_t LHS, const std::unique_ptr<DWARFUnit> &RHS) {
150  return LHS < RHS->getNextUnitOffset();
151  });
152  if (CU != end && (*CU)->getOffset() <= Offset)
153  return CU->get();
154  return nullptr;
155 }
156 
157 DWARFUnit *
159  const auto *CUOff = E.getContribution(DW_SECT_INFO);
160  if (!CUOff)
161  return nullptr;
162 
163  auto Offset = CUOff->Offset;
164  auto end = begin() + getNumInfoUnits();
165 
166  auto *CU =
167  std::upper_bound(begin(), end, CUOff->Offset,
168  [](uint64_t LHS, const std::unique_ptr<DWARFUnit> &RHS) {
169  return LHS < RHS->getNextUnitOffset();
170  });
171  if (CU != end && (*CU)->getOffset() <= Offset)
172  return CU->get();
173 
174  if (!Parser)
175  return nullptr;
176 
177  auto U = Parser(Offset, DW_SECT_INFO, nullptr, &E);
178  if (!U)
179  U = nullptr;
180 
181  auto *NewCU = U.get();
182  this->insert(CU, std::move(U));
183  ++NumInfoUnits;
184  return NewCU;
185 }
186 
188  const DWARFUnitHeader &Header, const DWARFDebugAbbrev *DA,
189  const DWARFSection *RS, const DWARFSection *LocSection,
190  StringRef SS, const DWARFSection &SOS,
191  const DWARFSection *AOS, const DWARFSection &LS, bool LE,
192  bool IsDWO, const DWARFUnitVector &UnitVector)
193  : Context(DC), InfoSection(Section), Header(Header), Abbrev(DA),
194  RangeSection(RS), LineSection(LS), StringSection(SS),
195  StringOffsetSection(SOS), AddrOffsetSection(AOS), IsLittleEndian(LE),
196  IsDWO(IsDWO), UnitVector(UnitVector) {
197  clear();
198 }
199 
200 DWARFUnit::~DWARFUnit() = default;
201 
203  return DWARFDataExtractor(Context.getDWARFObj(), InfoSection, IsLittleEndian,
205 }
206 
209  if (!AddrOffsetSectionBase) {
210  auto R = Context.info_section_units();
211  // Surprising if a DWO file has more than one skeleton unit in it - this
212  // probably shouldn't be valid, but if a use case is found, here's where to
213  // support it (probably have to linearly search for the matching skeleton CU
214  // here)
215  if (IsDWO && hasSingleElement(R))
216  return (*R.begin())->getAddrOffsetSectionItem(Index);
217 
218  return None;
219  }
220 
221  uint64_t Offset = *AddrOffsetSectionBase + Index * getAddressByteSize();
222  if (AddrOffsetSection->Data.size() < Offset + getAddressByteSize())
223  return None;
224  DWARFDataExtractor DA(Context.getDWARFObj(), *AddrOffsetSection,
225  IsLittleEndian, getAddressByteSize());
226  uint64_t Section;
227  uint64_t Address = DA.getRelocatedAddress(&Offset, &Section);
228  return {{Address, Section}};
229 }
230 
232  if (!StringOffsetsTableContribution)
233  return make_error<StringError>(
234  "DW_FORM_strx used without a valid string offsets table",
236  unsigned ItemSize = getDwarfStringOffsetsByteSize();
237  uint64_t Offset = getStringOffsetsBase() + Index * ItemSize;
238  if (StringOffsetSection.Data.size() < Offset + ItemSize)
239  return make_error<StringError>("DW_FORM_strx uses index " + Twine(Index) +
240  ", which is too large",
242  DWARFDataExtractor DA(Context.getDWARFObj(), StringOffsetSection,
243  IsLittleEndian, 0);
244  return DA.getRelocatedValue(ItemSize, &Offset);
245 }
246 
248  const DWARFDataExtractor &debug_info,
249  uint64_t *offset_ptr,
251  Offset = *offset_ptr;
252  Error Err = Error::success();
253  IndexEntry = nullptr;
254  std::tie(Length, FormParams.Format) =
255  debug_info.getInitialLength(offset_ptr, &Err);
256  FormParams.Version = debug_info.getU16(offset_ptr, &Err);
257  if (FormParams.Version >= 5) {
258  UnitType = debug_info.getU8(offset_ptr, &Err);
259  FormParams.AddrSize = debug_info.getU8(offset_ptr, &Err);
260  AbbrOffset = debug_info.getRelocatedValue(
261  FormParams.getDwarfOffsetByteSize(), offset_ptr, nullptr, &Err);
262  } else {
263  AbbrOffset = debug_info.getRelocatedValue(
264  FormParams.getDwarfOffsetByteSize(), offset_ptr, nullptr, &Err);
265  FormParams.AddrSize = debug_info.getU8(offset_ptr, &Err);
266  // Fake a unit type based on the section type. This isn't perfect,
267  // but distinguishing compile and type units is generally enough.
269  UnitType = DW_UT_type;
270  else
271  UnitType = DW_UT_compile;
272  }
273  if (isTypeUnit()) {
274  TypeHash = debug_info.getU64(offset_ptr, &Err);
275  TypeOffset = debug_info.getUnsigned(
276  offset_ptr, FormParams.getDwarfOffsetByteSize(), &Err);
277  } else if (UnitType == DW_UT_split_compile || UnitType == DW_UT_skeleton)
278  DWOId = debug_info.getU64(offset_ptr, &Err);
279 
280  if (Err) {
281  Context.getWarningHandler()(joinErrors(
284  "DWARF unit at 0x%8.8" PRIx64 " cannot be parsed:", Offset),
285  std::move(Err)));
286  return false;
287  }
288 
289  // Header fields all parsed, capture the size of this unit header.
290  assert(*offset_ptr - Offset <= 255 && "unexpected header size");
291  Size = uint8_t(*offset_ptr - Offset);
292  uint64_t NextCUOffset = Offset + getUnitLengthFieldByteSize() + getLength();
293 
294  if (!debug_info.isValidOffset(getNextUnitOffset() - 1)) {
295  Context.getWarningHandler()(
297  "DWARF unit from offset 0x%8.8" PRIx64 " incl. "
298  "to offset 0x%8.8" PRIx64 " excl. "
299  "extends past section size 0x%8.8zx",
300  Offset, NextCUOffset, debug_info.size()));
301  return false;
302  }
303 
305  Context.getWarningHandler()(createStringError(
307  "DWARF unit at offset 0x%8.8" PRIx64 " "
308  "has unsupported version %" PRIu16 ", supported are 2-%u",
310  return false;
311  }
312 
313  // Type offset is unit-relative; should be after the header and before
314  // the end of the current unit.
315  if (isTypeUnit() && TypeOffset < Size) {
316  Context.getWarningHandler()(
318  "DWARF type unit at offset "
319  "0x%8.8" PRIx64 " "
320  "has its relocated type_offset 0x%8.8" PRIx64 " "
321  "pointing inside the header",
322  Offset, Offset + TypeOffset));
323  return false;
324  }
325  if (isTypeUnit() &&
326  TypeOffset >= getUnitLengthFieldByteSize() + getLength()) {
327  Context.getWarningHandler()(createStringError(
329  "DWARF type unit from offset 0x%8.8" PRIx64 " incl. "
330  "to offset 0x%8.8" PRIx64 " excl. has its "
331  "relocated type_offset 0x%8.8" PRIx64 " pointing past the unit end",
332  Offset, NextCUOffset, Offset + TypeOffset));
333  return false;
334  }
335 
338  "DWARF unit at offset 0x%8.8" PRIx64, Offset)) {
339  Context.getWarningHandler()(std::move(SizeErr));
340  return false;
341  }
342 
343  // Keep track of the highest DWARF version we encounter across all units.
344  Context.setMaxVersionIfGreater(getVersion());
345  return true;
346 }
347 
349  assert(Entry);
350  assert(!IndexEntry);
351  IndexEntry = Entry;
352  if (AbbrOffset)
353  return false;
354  auto *UnitContrib = IndexEntry->getContribution();
355  if (!UnitContrib ||
356  UnitContrib->Length != (getLength() + getUnitLengthFieldByteSize()))
357  return false;
358  auto *AbbrEntry = IndexEntry->getContribution(DW_SECT_ABBREV);
359  if (!AbbrEntry)
360  return false;
361  AbbrOffset = AbbrEntry->Offset;
362  return true;
363 }
364 
366  DWARFDebugRangeList &RangeList) const {
367  // Require that compile unit is extracted.
368  assert(!DieArray.empty());
369  DWARFDataExtractor RangesData(Context.getDWARFObj(), *RangeSection,
370  IsLittleEndian, getAddressByteSize());
371  uint64_t ActualRangeListOffset = RangeSectionBase + RangeListOffset;
372  return RangeList.extract(RangesData, &ActualRangeListOffset);
373 }
374 
376  Abbrevs = nullptr;
377  BaseAddr.reset();
378  RangeSectionBase = 0;
379  LocSectionBase = 0;
380  AddrOffsetSectionBase = None;
381  SU = nullptr;
382  clearDIEs(false);
383  AddrDieMap.clear();
384  if (DWO)
385  DWO->clear();
386  DWO.reset();
387 }
388 
390  return dwarf::toString(getUnitDIE().find(DW_AT_comp_dir), nullptr);
391 }
392 
393 void DWARFUnit::extractDIEsToVector(
394  bool AppendCUDie, bool AppendNonCUDies,
395  std::vector<DWARFDebugInfoEntry> &Dies) const {
396  if (!AppendCUDie && !AppendNonCUDies)
397  return;
398 
399  // Set the offset to that of the first DIE and calculate the start of the
400  // next compilation unit header.
401  uint64_t DIEOffset = getOffset() + getHeaderSize();
402  uint64_t NextCUOffset = getNextUnitOffset();
404  DWARFDataExtractor DebugInfoData = getDebugInfoExtractor();
405  // The end offset has been already checked by DWARFUnitHeader::extract.
406  assert(DebugInfoData.isValidOffset(NextCUOffset - 1));
407  std::vector<uint32_t> Parents;
408  std::vector<uint32_t> PrevSiblings;
409  bool IsCUDie = true;
410 
411  assert(
412  ((AppendCUDie && Dies.empty()) || (!AppendCUDie && Dies.size() == 1)) &&
413  "Dies array is not empty");
414 
415  // Fill Parents and Siblings stacks with initial value.
416  Parents.push_back(UINT32_MAX);
417  if (!AppendCUDie)
418  Parents.push_back(0);
419  PrevSiblings.push_back(0);
420 
421  // Start to extract dies.
422  do {
423  assert(Parents.size() > 0 && "Empty parents stack");
424  assert((Parents.back() == UINT32_MAX || Parents.back() <= Dies.size()) &&
425  "Wrong parent index");
426 
427  // Extract die. Stop if any error occurred.
428  if (!DIE.extractFast(*this, &DIEOffset, DebugInfoData, NextCUOffset,
429  Parents.back()))
430  break;
431 
432  // If previous sibling is remembered then update it`s SiblingIdx field.
433  if (PrevSiblings.back() > 0) {
434  assert(PrevSiblings.back() < Dies.size() &&
435  "Previous sibling index is out of Dies boundaries");
436  Dies[PrevSiblings.back()].setSiblingIdx(Dies.size());
437  }
438 
439  // Store die into the Dies vector.
440  if (IsCUDie) {
441  if (AppendCUDie)
442  Dies.push_back(DIE);
443  if (!AppendNonCUDies)
444  break;
445  // The average bytes per DIE entry has been seen to be
446  // around 14-20 so let's pre-reserve the needed memory for
447  // our DIE entries accordingly.
448  Dies.reserve(Dies.size() + getDebugInfoSize() / 14);
449  } else {
450  // Remember last previous sibling.
451  PrevSiblings.back() = Dies.size();
452 
453  Dies.push_back(DIE);
454  }
455 
456  // Check for new children scope.
457  if (const DWARFAbbreviationDeclaration *AbbrDecl =
458  DIE.getAbbreviationDeclarationPtr()) {
459  if (AbbrDecl->hasChildren()) {
460  if (AppendCUDie || !IsCUDie) {
461  assert(Dies.size() > 0 && "Dies does not contain any die");
462  Parents.push_back(Dies.size() - 1);
463  PrevSiblings.push_back(0);
464  }
465  } else if (IsCUDie)
466  // Stop if we have single compile unit die w/o children.
467  break;
468  } else {
469  // NULL DIE: finishes current children scope.
470  Parents.pop_back();
471  PrevSiblings.pop_back();
472  }
473 
474  if (IsCUDie)
475  IsCUDie = false;
476 
477  // Stop when compile unit die is removed from the parents stack.
478  } while (Parents.size() > 1);
479 }
480 
481 void DWARFUnit::extractDIEsIfNeeded(bool CUDieOnly) {
482  if (Error e = tryExtractDIEsIfNeeded(CUDieOnly))
483  Context.getRecoverableErrorHandler()(std::move(e));
484 }
485 
487  if ((CUDieOnly && !DieArray.empty()) ||
488  DieArray.size() > 1)
489  return Error::success(); // Already parsed.
490 
491  bool HasCUDie = !DieArray.empty();
492  extractDIEsToVector(!HasCUDie, !CUDieOnly, DieArray);
493 
494  if (DieArray.empty())
495  return Error::success();
496 
497  // If CU DIE was just parsed, copy several attribute values from it.
498  if (HasCUDie)
499  return Error::success();
500 
501  DWARFDie UnitDie(this, &DieArray[0]);
502  if (Optional<uint64_t> DWOId = toUnsigned(UnitDie.find(DW_AT_GNU_dwo_id)))
503  Header.setDWOId(*DWOId);
504  if (!IsDWO) {
505  assert(AddrOffsetSectionBase == None);
506  assert(RangeSectionBase == 0);
507  assert(LocSectionBase == 0);
508  AddrOffsetSectionBase = toSectionOffset(UnitDie.find(DW_AT_addr_base));
509  if (!AddrOffsetSectionBase)
510  AddrOffsetSectionBase =
511  toSectionOffset(UnitDie.find(DW_AT_GNU_addr_base));
512  RangeSectionBase = toSectionOffset(UnitDie.find(DW_AT_rnglists_base), 0);
513  LocSectionBase = toSectionOffset(UnitDie.find(DW_AT_loclists_base), 0);
514  }
515 
516  // In general, in DWARF v5 and beyond we derive the start of the unit's
517  // contribution to the string offsets table from the unit DIE's
518  // DW_AT_str_offsets_base attribute. Split DWARF units do not use this
519  // attribute, so we assume that there is a contribution to the string
520  // offsets table starting at offset 0 of the debug_str_offsets.dwo section.
521  // In both cases we need to determine the format of the contribution,
522  // which may differ from the unit's format.
523  DWARFDataExtractor DA(Context.getDWARFObj(), StringOffsetSection,
524  IsLittleEndian, 0);
525  if (IsDWO || getVersion() >= 5) {
526  auto StringOffsetOrError =
529  if (!StringOffsetOrError)
531  "invalid reference to or invalid content in "
532  ".debug_str_offsets[.dwo]: " +
533  toString(StringOffsetOrError.takeError()));
534 
535  StringOffsetsTableContribution = *StringOffsetOrError;
536  }
537 
538  // DWARF v5 uses the .debug_rnglists and .debug_rnglists.dwo sections to
539  // describe address ranges.
540  if (getVersion() >= 5) {
541  // In case of DWP, the base offset from the index has to be added.
542  if (IsDWO) {
543  uint64_t ContributionBaseOffset = 0;
544  if (auto *IndexEntry = Header.getIndexEntry())
545  if (auto *Contrib = IndexEntry->getContribution(DW_SECT_RNGLISTS))
546  ContributionBaseOffset = Contrib->Offset;
548  &Context.getDWARFObj().getRnglistsDWOSection(),
549  ContributionBaseOffset +
550  DWARFListTableHeader::getHeaderSize(Header.getFormat()));
551  } else
552  setRangesSection(&Context.getDWARFObj().getRnglistsSection(),
553  toSectionOffset(UnitDie.find(DW_AT_rnglists_base),
555  Header.getFormat())));
556  }
557 
558  if (IsDWO) {
559  // If we are reading a package file, we need to adjust the location list
560  // data based on the index entries.
561  StringRef Data = Header.getVersion() >= 5
562  ? Context.getDWARFObj().getLoclistsDWOSection().Data
563  : Context.getDWARFObj().getLocDWOSection().Data;
564  if (auto *IndexEntry = Header.getIndexEntry())
565  if (const auto *C = IndexEntry->getContribution(
566  Header.getVersion() >= 5 ? DW_SECT_LOCLISTS : DW_SECT_EXT_LOC))
567  Data = Data.substr(C->Offset, C->Length);
568 
569  DWARFDataExtractor DWARFData(Data, IsLittleEndian, getAddressByteSize());
570  LocTable =
571  std::make_unique<DWARFDebugLoclists>(DWARFData, Header.getVersion());
572  LocSectionBase = DWARFListTableHeader::getHeaderSize(Header.getFormat());
573  } else if (getVersion() >= 5) {
574  LocTable = std::make_unique<DWARFDebugLoclists>(
575  DWARFDataExtractor(Context.getDWARFObj(),
576  Context.getDWARFObj().getLoclistsSection(),
577  IsLittleEndian, getAddressByteSize()),
578  getVersion());
579  } else {
580  LocTable = std::make_unique<DWARFDebugLoc>(DWARFDataExtractor(
581  Context.getDWARFObj(), Context.getDWARFObj().getLocSection(),
582  IsLittleEndian, getAddressByteSize()));
583  }
584 
585  // Don't fall back to DW_AT_GNU_ranges_base: it should be ignored for
586  // skeleton CU DIE, so that DWARF users not aware of it are not broken.
587  return Error::success();
588 }
589 
590 bool DWARFUnit::parseDWO(StringRef DWOAlternativeLocation) {
591  if (IsDWO)
592  return false;
593  if (DWO.get())
594  return false;
595  DWARFDie UnitDie = getUnitDIE();
596  if (!UnitDie)
597  return false;
598  auto DWOFileName = getVersion() >= 5
599  ? dwarf::toString(UnitDie.find(DW_AT_dwo_name))
600  : dwarf::toString(UnitDie.find(DW_AT_GNU_dwo_name));
601  if (!DWOFileName)
602  return false;
603  auto CompilationDir = dwarf::toString(UnitDie.find(DW_AT_comp_dir));
604  SmallString<16> AbsolutePath;
605  if (sys::path::is_relative(*DWOFileName) && CompilationDir &&
606  *CompilationDir) {
607  sys::path::append(AbsolutePath, *CompilationDir);
608  }
609  sys::path::append(AbsolutePath, *DWOFileName);
610  auto DWOId = getDWOId();
611  if (!DWOId)
612  return false;
613  auto DWOContext = Context.getDWOContext(AbsolutePath);
614  if (!DWOContext) {
615  // Use the alternative location to get the DWARF context for the DWO object.
616  if (DWOAlternativeLocation.empty())
617  return false;
618  // If the alternative context does not correspond to the original DWO object
619  // (different hashes), the below 'getDWOCompileUnitForHash' call will catch
620  // the issue, with a returned null context.
621  DWOContext = Context.getDWOContext(DWOAlternativeLocation);
622  if (!DWOContext)
623  return false;
624  }
625 
626  DWARFCompileUnit *DWOCU = DWOContext->getDWOCompileUnitForHash(*DWOId);
627  if (!DWOCU)
628  return false;
629  DWO = std::shared_ptr<DWARFCompileUnit>(std::move(DWOContext), DWOCU);
630  DWO->setSkeletonUnit(this);
631  // Share .debug_addr and .debug_ranges section with compile unit in .dwo
632  if (AddrOffsetSectionBase)
633  DWO->setAddrOffsetSection(AddrOffsetSection, *AddrOffsetSectionBase);
634  if (getVersion() == 4) {
635  auto DWORangesBase = UnitDie.getRangesBaseAttribute();
636  DWO->setRangesSection(RangeSection, DWORangesBase.value_or(0));
637  }
638 
639  return true;
640 }
641 
642 void DWARFUnit::clearDIEs(bool KeepCUDie) {
643  // Do not use resize() + shrink_to_fit() to free memory occupied by dies.
644  // shrink_to_fit() is a *non-binding* request to reduce capacity() to size().
645  // It depends on the implementation whether the request is fulfilled.
646  // Create a new vector with a small capacity and assign it to the DieArray to
647  // have previous contents freed.
648  DieArray = (KeepCUDie && !DieArray.empty())
649  ? std::vector<DWARFDebugInfoEntry>({DieArray[0]})
650  : std::vector<DWARFDebugInfoEntry>();
651 }
652 
655  if (getVersion() <= 4) {
656  DWARFDebugRangeList RangeList;
657  if (Error E = extractRangeList(Offset, RangeList))
658  return std::move(E);
659  return RangeList.getAbsoluteRanges(getBaseAddress());
660  }
661  DWARFDataExtractor RangesData(Context.getDWARFObj(), *RangeSection,
662  IsLittleEndian, Header.getAddressByteSize());
663  DWARFDebugRnglistTable RnglistTable;
664  auto RangeListOrError = RnglistTable.findList(RangesData, Offset);
665  if (RangeListOrError)
666  return RangeListOrError.get().getAbsoluteRanges(getBaseAddress(), *this);
667  return RangeListOrError.takeError();
668 }
669 
672  if (auto Offset = getRnglistOffset(Index))
673  return findRnglistFromOffset(*Offset);
674 
676  "invalid range list table index %d (possibly "
677  "missing the entire range list table)",
678  Index);
679 }
680 
682  DWARFDie UnitDie = getUnitDIE();
683  if (!UnitDie)
684  return createStringError(errc::invalid_argument, "No unit DIE");
685 
686  // First, check if unit DIE describes address ranges for the whole unit.
687  auto CUDIERangesOrError = UnitDie.getAddressRanges();
688  if (!CUDIERangesOrError)
690  "decoding address ranges: %s",
691  toString(CUDIERangesOrError.takeError()).c_str());
692  return *CUDIERangesOrError;
693 }
694 
698 
699  Error InterpretationError = Error::success();
700 
702  Offset, getBaseAddress(),
703  [this](uint32_t Index) { return getAddrOffsetSectionItem(Index); },
705  if (L)
706  Result.push_back(std::move(*L));
707  else
708  InterpretationError =
709  joinErrors(L.takeError(), std::move(InterpretationError));
710  return !InterpretationError;
711  });
712 
713  if (ParseError || InterpretationError)
714  return joinErrors(std::move(ParseError), std::move(InterpretationError));
715 
716  return Result;
717 }
718 
720  if (Die.isSubroutineDIE()) {
721  auto DIERangesOrError = Die.getAddressRanges();
722  if (DIERangesOrError) {
723  for (const auto &R : DIERangesOrError.get()) {
724  // Ignore 0-sized ranges.
725  if (R.LowPC == R.HighPC)
726  continue;
727  auto B = AddrDieMap.upper_bound(R.LowPC);
728  if (B != AddrDieMap.begin() && R.LowPC < (--B)->second.first) {
729  // The range is a sub-range of existing ranges, we need to split the
730  // existing range.
731  if (R.HighPC < B->second.first)
732  AddrDieMap[R.HighPC] = B->second;
733  if (R.LowPC > B->first)
734  AddrDieMap[B->first].first = R.LowPC;
735  }
736  AddrDieMap[R.LowPC] = std::make_pair(R.HighPC, Die);
737  }
738  } else
739  llvm::consumeError(DIERangesOrError.takeError());
740  }
741  // Parent DIEs are added to the AddrDieMap prior to the Children DIEs to
742  // simplify the logic to update AddrDieMap. The child's range will always
743  // be equal or smaller than the parent's range. With this assumption, when
744  // adding one range into the map, it will at most split a range into 3
745  // sub-ranges.
746  for (DWARFDie Child = Die.getFirstChild(); Child; Child = Child.getSibling())
747  updateAddressDieMap(Child);
748 }
749 
751  extractDIEsIfNeeded(false);
752  if (AddrDieMap.empty())
754  auto R = AddrDieMap.upper_bound(Address);
755  if (R == AddrDieMap.begin())
756  return DWARFDie();
757  // upper_bound's previous item contains Address.
758  --R;
759  if (Address >= R->second.first)
760  return DWARFDie();
761  return R->second.second;
762 }
763 
765  for (DWARFDie Child : Die) {
766  if (isType(Child.getTag()))
767  continue;
768  updateVariableDieMap(Child);
769  }
770 
771  if (Die.getTag() != DW_TAG_variable)
772  return;
773 
775  Die.getLocations(DW_AT_location);
776  if (!Locations) {
777  // Missing DW_AT_location is fine here.
778  consumeError(Locations.takeError());
779  return;
780  }
781 
782  uint64_t Address = UINT64_MAX;
783 
784  for (const DWARFLocationExpression &Location : *Locations) {
785  uint8_t AddressSize = getAddressByteSize();
786  DataExtractor Data(Location.Expr, /*IsLittleEndian=*/true, AddressSize);
787  DWARFExpression Expr(Data, AddressSize);
788  auto It = Expr.begin();
789  if (It == Expr.end())
790  continue;
791 
792  // Match exactly the main sequence used to describe global variables:
793  // `DW_OP_addr[x] [+ DW_OP_plus_uconst]`. Currently, this is the sequence
794  // that LLVM produces for DILocalVariables and DIGlobalVariables. If, in
795  // future, the DWARF producer (`DwarfCompileUnit::addLocationAttribute()` is
796  // a good starting point) is extended to use further expressions, this code
797  // needs to be updated.
798  uint64_t LocationAddr;
799  if (It->getCode() == dwarf::DW_OP_addr) {
800  LocationAddr = It->getRawOperand(0);
801  } else if (It->getCode() == dwarf::DW_OP_addrx) {
802  uint64_t DebugAddrOffset = It->getRawOperand(0);
803  if (auto Pointer = getAddrOffsetSectionItem(DebugAddrOffset)) {
804  LocationAddr = Pointer->Address;
805  }
806  } else {
807  continue;
808  }
809 
810  // Read the optional 2nd operand, a DW_OP_plus_uconst.
811  if (++It != Expr.end()) {
812  if (It->getCode() != dwarf::DW_OP_plus_uconst)
813  continue;
814 
815  LocationAddr += It->getRawOperand(0);
816 
817  // Probe for a 3rd operand, if it exists, bail.
818  if (++It != Expr.end())
819  continue;
820  }
821 
822  Address = LocationAddr;
823  break;
824  }
825 
826  // Get the size of the global variable. If all else fails (i.e. the global has
827  // no type), then we use a size of one to still allow symbolization of the
828  // exact address.
829  uint64_t GVSize = 1;
830  if (DWARFDie BaseType = Die.getAttributeValueAsReferencedDie(DW_AT_type))
831  if (Optional<uint64_t> Size = Die.getTypeSize(getAddressByteSize()))
832  GVSize = *Size;
833 
834  if (Address != UINT64_MAX)
835  VariableDieMap[Address] = {Address + GVSize, Die};
836 }
837 
839  extractDIEsIfNeeded(false);
840 
841  auto RootDie = getUnitDIE();
842 
843  auto RootLookup = RootsParsedForVariables.insert(RootDie.getOffset());
844  if (RootLookup.second)
845  updateVariableDieMap(RootDie);
846 
847  auto R = VariableDieMap.upper_bound(Address);
848  if (R == VariableDieMap.begin())
849  return DWARFDie();
850 
851  // upper_bound's previous item contains Address.
852  --R;
853  if (Address >= R->second.first)
854  return DWARFDie();
855  return R->second.second;
856 }
857 
858 void
860  SmallVectorImpl<DWARFDie> &InlinedChain) {
861  assert(InlinedChain.empty());
862  // Try to look for subprogram DIEs in the DWO file.
863  parseDWO();
864  // First, find the subroutine that contains the given address (the leaf
865  // of inlined chain).
866  DWARFDie SubroutineDIE =
867  (DWO ? *DWO : *this).getSubroutineForAddress(Address);
868 
869  while (SubroutineDIE) {
870  if (SubroutineDIE.isSubprogramDIE()) {
871  InlinedChain.push_back(SubroutineDIE);
872  return;
873  }
874  if (SubroutineDIE.getTag() == DW_TAG_inlined_subroutine)
875  InlinedChain.push_back(SubroutineDIE);
876  SubroutineDIE = SubroutineDIE.getParent();
877  }
878 }
879 
881  DWARFSectionKind Kind) {
882  if (Kind == DW_SECT_INFO)
883  return Context.getCUIndex();
884  assert(Kind == DW_SECT_EXT_TYPES);
885  return Context.getTUIndex();
886 }
887 
889  if (const DWARFDebugInfoEntry *Entry = getParentEntry(Die))
890  return DWARFDie(this, Entry);
891 
892  return DWARFDie();
893 }
894 
895 const DWARFDebugInfoEntry *
897  if (!Die)
898  return nullptr;
899  assert(Die >= DieArray.data() && Die < DieArray.data() + DieArray.size());
900 
901  if (Optional<uint32_t> ParentIdx = Die->getParentIdx()) {
902  assert(*ParentIdx < DieArray.size() &&
903  "ParentIdx is out of DieArray boundaries");
904  return getDebugInfoEntry(*ParentIdx);
905  }
906 
907  return nullptr;
908 }
909 
911  if (const DWARFDebugInfoEntry *Sibling = getSiblingEntry(Die))
912  return DWARFDie(this, Sibling);
913 
914  return DWARFDie();
915 }
916 
917 const DWARFDebugInfoEntry *
919  if (!Die)
920  return nullptr;
921  assert(Die >= DieArray.data() && Die < DieArray.data() + DieArray.size());
922 
923  if (Optional<uint32_t> SiblingIdx = Die->getSiblingIdx()) {
924  assert(*SiblingIdx < DieArray.size() &&
925  "SiblingIdx is out of DieArray boundaries");
926  return &DieArray[*SiblingIdx];
927  }
928 
929  return nullptr;
930 }
931 
933  if (const DWARFDebugInfoEntry *Sibling = getPreviousSiblingEntry(Die))
934  return DWARFDie(this, Sibling);
935 
936  return DWARFDie();
937 }
938 
939 const DWARFDebugInfoEntry *
941  if (!Die)
942  return nullptr;
943  assert(Die >= DieArray.data() && Die < DieArray.data() + DieArray.size());
944 
945  Optional<uint32_t> ParentIdx = Die->getParentIdx();
946  if (!ParentIdx)
947  // Die is a root die, there is no previous sibling.
948  return nullptr;
949 
950  assert(*ParentIdx < DieArray.size() &&
951  "ParentIdx is out of DieArray boundaries");
952  assert(getDIEIndex(Die) > 0 && "Die is a root die");
953 
954  uint32_t PrevDieIdx = getDIEIndex(Die) - 1;
955  if (PrevDieIdx == *ParentIdx)
956  // Immediately previous node is parent, there is no previous sibling.
957  return nullptr;
958 
959  while (DieArray[PrevDieIdx].getParentIdx() != *ParentIdx) {
960  PrevDieIdx = *DieArray[PrevDieIdx].getParentIdx();
961 
962  assert(PrevDieIdx < DieArray.size() &&
963  "PrevDieIdx is out of DieArray boundaries");
964  assert(PrevDieIdx >= *ParentIdx &&
965  "PrevDieIdx is not a child of parent of Die");
966  }
967 
968  return &DieArray[PrevDieIdx];
969 }
970 
972  if (const DWARFDebugInfoEntry *Child = getFirstChildEntry(Die))
973  return DWARFDie(this, Child);
974 
975  return DWARFDie();
976 }
977 
978 const DWARFDebugInfoEntry *
980  if (!Die)
981  return nullptr;
982  assert(Die >= DieArray.data() && Die < DieArray.data() + DieArray.size());
983 
984  if (!Die->hasChildren())
985  return nullptr;
986 
987  // TODO: Instead of checking here for invalid die we might reject
988  // invalid dies at parsing stage(DWARFUnit::extractDIEsToVector).
989  // We do not want access out of bounds when parsing corrupted debug data.
990  size_t I = getDIEIndex(Die) + 1;
991  if (I >= DieArray.size())
992  return nullptr;
993  return &DieArray[I];
994 }
995 
997  if (const DWARFDebugInfoEntry *Child = getLastChildEntry(Die))
998  return DWARFDie(this, Child);
999 
1000  return DWARFDie();
1001 }
1002 
1003 const DWARFDebugInfoEntry *
1005  if (!Die)
1006  return nullptr;
1007  assert(Die >= DieArray.data() && Die < DieArray.data() + DieArray.size());
1008 
1009  if (!Die->hasChildren())
1010  return nullptr;
1011 
1012  if (Optional<uint32_t> SiblingIdx = Die->getSiblingIdx()) {
1013  assert(*SiblingIdx < DieArray.size() &&
1014  "SiblingIdx is out of DieArray boundaries");
1015  assert(DieArray[*SiblingIdx - 1].getTag() == dwarf::DW_TAG_null &&
1016  "Bad end of children marker");
1017  return &DieArray[*SiblingIdx - 1];
1018  }
1019 
1020  // If SiblingIdx is set for non-root dies we could be sure that DWARF is
1021  // correct and "end of children marker" must be found. For root die we do not
1022  // have such a guarantee(parsing root die might be stopped if "end of children
1023  // marker" is missing, SiblingIdx is always zero for root die). That is why we
1024  // do not use assertion for checking for "end of children marker" for root
1025  // die.
1026 
1027  // TODO: Instead of checking here for invalid die we might reject
1028  // invalid dies at parsing stage(DWARFUnit::extractDIEsToVector).
1029  if (getDIEIndex(Die) == 0 && DieArray.size() > 1 &&
1030  DieArray.back().getTag() == dwarf::DW_TAG_null) {
1031  // For the unit die we might take last item from DieArray.
1032  assert(getDIEIndex(Die) ==
1033  getDIEIndex(const_cast<DWARFUnit *>(this)->getUnitDIE()) &&
1034  "Bad unit die");
1035  return &DieArray.back();
1036  }
1037 
1038  return nullptr;
1039 }
1040 
1042  if (!Abbrevs)
1044  return Abbrevs;
1045 }
1046 
1048  if (BaseAddr)
1049  return BaseAddr;
1050 
1051  DWARFDie UnitDie = getUnitDIE();
1052  Optional<DWARFFormValue> PC = UnitDie.find({DW_AT_low_pc, DW_AT_entry_pc});
1053  BaseAddr = toSectionedAddress(PC);
1054  return BaseAddr;
1055 }
1056 
1060  uint8_t EntrySize = getDwarfOffsetByteSize();
1061  // In order to ensure that we don't read a partial record at the end of
1062  // the section we validate for a multiple of the entry size.
1063  uint64_t ValidationSize = alignTo(Size, EntrySize);
1064  // Guard against overflow.
1065  if (ValidationSize >= Size)
1066  if (DA.isValidOffsetForDataOfSize((uint32_t)Base, ValidationSize))
1067  return *this;
1068  return createStringError(errc::invalid_argument, "length exceeds section size");
1069 }
1070 
1071 // Look for a DWARF64-formatted contribution to the string offsets table
1072 // starting at a given offset and record it in a descriptor.
1075  if (!DA.isValidOffsetForDataOfSize(Offset, 16))
1076  return createStringError(errc::invalid_argument, "section offset exceeds section size");
1077 
1078  if (DA.getU32(&Offset) != dwarf::DW_LENGTH_DWARF64)
1079  return createStringError(errc::invalid_argument, "32 bit contribution referenced from a 64 bit unit");
1080 
1081  uint64_t Size = DA.getU64(&Offset);
1082  uint8_t Version = DA.getU16(&Offset);
1083  (void)DA.getU16(&Offset); // padding
1084  // The encoded length includes the 2-byte version field and the 2-byte
1085  // padding, so we need to subtract them out when we populate the descriptor.
1086  return StrOffsetsContributionDescriptor(Offset, Size - 4, Version, DWARF64);
1087 }
1088 
1089 // Look for a DWARF32-formatted contribution to the string offsets table
1090 // starting at a given offset and record it in a descriptor.
1093  if (!DA.isValidOffsetForDataOfSize(Offset, 8))
1094  return createStringError(errc::invalid_argument, "section offset exceeds section size");
1095 
1096  uint32_t ContributionSize = DA.getU32(&Offset);
1097  if (ContributionSize >= dwarf::DW_LENGTH_lo_reserved)
1098  return createStringError(errc::invalid_argument, "invalid length");
1099 
1100  uint8_t Version = DA.getU16(&Offset);
1101  (void)DA.getU16(&Offset); // padding
1102  // The encoded length includes the 2-byte version field and the 2-byte
1103  // padding, so we need to subtract them out when we populate the descriptor.
1104  return StrOffsetsContributionDescriptor(Offset, ContributionSize - 4, Version,
1105  DWARF32);
1106 }
1107 
1110  llvm::dwarf::DwarfFormat Format,
1111  uint64_t Offset) {
1113  switch (Format) {
1115  if (Offset < 16)
1116  return createStringError(errc::invalid_argument, "insufficient space for 64 bit header prefix");
1117  auto DescOrError = parseDWARF64StringOffsetsTableHeader(DA, Offset - 16);
1118  if (!DescOrError)
1119  return DescOrError.takeError();
1120  Desc = *DescOrError;
1121  break;
1122  }
1124  if (Offset < 8)
1125  return createStringError(errc::invalid_argument, "insufficient space for 32 bit header prefix");
1126  auto DescOrError = parseDWARF32StringOffsetsTableHeader(DA, Offset - 8);
1127  if (!DescOrError)
1128  return DescOrError.takeError();
1129  Desc = *DescOrError;
1130  break;
1131  }
1132  }
1133  return Desc.validateContributionSize(DA);
1134 }
1135 
1138  assert(!IsDWO);
1139  auto OptOffset = toSectionOffset(getUnitDIE().find(DW_AT_str_offsets_base));
1140  if (!OptOffset)
1141  return None;
1142  auto DescOrError =
1143  parseDWARFStringOffsetsTableHeader(DA, Header.getFormat(), *OptOffset);
1144  if (!DescOrError)
1145  return DescOrError.takeError();
1146  return *DescOrError;
1147 }
1148 
1151  assert(IsDWO);
1152  uint64_t Offset = 0;
1153  auto IndexEntry = Header.getIndexEntry();
1154  const auto *C =
1155  IndexEntry ? IndexEntry->getContribution(DW_SECT_STR_OFFSETS) : nullptr;
1156  if (C)
1157  Offset = C->Offset;
1158  if (getVersion() >= 5) {
1159  if (DA.getData().data() == nullptr)
1160  return None;
1161  Offset += Header.getFormat() == dwarf::DwarfFormat::DWARF32 ? 8 : 16;
1162  // Look for a valid contribution at the given offset.
1163  auto DescOrError = parseDWARFStringOffsetsTableHeader(DA, Header.getFormat(), Offset);
1164  if (!DescOrError)
1165  return DescOrError.takeError();
1166  return *DescOrError;
1167  }
1168  // Prior to DWARF v5, we derive the contribution size from the
1169  // index table (in a package file). In a .dwo file it is simply
1170  // the length of the string offsets section.
1172  if (C)
1173  Desc = StrOffsetsContributionDescriptor(C->Offset, C->Length, 4,
1174  Header.getFormat());
1175  else if (!IndexEntry && !StringOffsetSection.Data.empty())
1176  Desc = StrOffsetsContributionDescriptor(0, StringOffsetSection.Data.size(),
1177  4, Header.getFormat());
1178  else
1179  return None;
1180  auto DescOrError = Desc.validateContributionSize(DA);
1181  if (!DescOrError)
1182  return DescOrError.takeError();
1183  return *DescOrError;
1184 }
1185 
1187  DataExtractor RangesData(RangeSection->Data, IsLittleEndian,
1188  getAddressByteSize());
1189  DWARFDataExtractor RangesDA(Context.getDWARFObj(), *RangeSection,
1190  IsLittleEndian, 0);
1192  RangesData, RangeSectionBase, getFormat(), Index))
1193  return *Off + RangeSectionBase;
1194  return None;
1195 }
1196 
1199  LocTable->getData(), LocSectionBase, getFormat(), Index))
1200  return *Off + LocSectionBase;
1201  return None;
1202 }
llvm::DWARFLocationExpressionsVector
std::vector< DWARFLocationExpression > DWARFLocationExpressionsVector
Represents a set of absolute location expressions.
Definition: DWARFLocationExpression.h:45
llvm::DWARFDebugRangeList
Definition: DWARFDebugRangeList.h:24
llvm::alignTo
uint64_t alignTo(uint64_t Size, Align A)
Returns a multiple of A needed to store Size bytes.
Definition: Alignment.h:156
llvm::DWARFSection
Definition: DWARFSection.h:16
DWARFFormValue.h
llvm::DWARFUnit::getAbbreviations
const DWARFAbbreviationDeclarationSet * getAbbreviations() const
Definition: DWARFUnit.cpp:1041
llvm::errc::invalid_argument
@ invalid_argument
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:671
llvm::DWARFUnit::getFirstChild
DWARFDie getFirstChild(const DWARFDebugInfoEntry *Die)
Definition: DWARFUnit.cpp:971
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
llvm::DWARFUnitHeader::getLength
uint64_t getLength() const
Definition: DWARFUnit.h:94
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::upper_bound
auto upper_bound(R &&Range, T &&Value)
Provide wrappers to std::upper_bound which take ranges instead of having to pass begin/end explicitly...
Definition: STLExtras.h:1910
DWARFCompileUnit.h
llvm::DWARFUnit::getRnglistOffset
Optional< uint64_t > getRnglistOffset(uint32_t Index)
Return a rangelist's offset based on an index.
Definition: DWARFUnit.cpp:1186
StringRef.h
DWARFObject.h
parseDWARF64StringOffsetsTableHeader
static Expected< StrOffsetsContributionDescriptor > parseDWARF64StringOffsetsTableHeader(DWARFDataExtractor &DA, uint64_t Offset)
Definition: DWARFUnit.cpp:1074
Path.h
llvm::logicalview::LVReportKind::Parents
@ Parents
llvm::Error::success
static ErrorSuccess success()
Create a success value.
Definition: Error.h:329
DWARFContext.h
llvm::dwarf::toSectionedAddress
Optional< object::SectionedAddress > toSectionedAddress(const Optional< DWARFFormValue > &V)
Definition: DWARFFormValue.h:297
llvm::dwarf::DW_LENGTH_DWARF64
@ DW_LENGTH_DWARF64
Indicator of 64-bit DWARF format.
Definition: Dwarf.h:57
Errc.h
llvm::DWARFUnitVector::addUnitsForSection
void addUnitsForSection(DWARFContext &C, const DWARFSection &Section, DWARFSectionKind SectionKind)
Read units from a .debug_info or .debug_types section.
Definition: DWARFUnit.cpp:42
llvm::DWARFUnitVector::addUnitsForDWOSection
void addUnitsForDWOSection(DWARFContext &C, const DWARFSection &DWOSection, DWARFSectionKind SectionKind, bool Lazy=false)
Read units from a .debug_info.dwo or .debug_types.dwo section.
Definition: DWARFUnit.cpp:53
llvm::DWARFContext
DWARFContext This data structure is the top level entity that deals with dwarf debug information pars...
Definition: DWARFContext.h:47
llvm::StrOffsetsContributionDescriptor::validateContributionSize
Expected< StrOffsetsContributionDescriptor > validateContributionSize(DWARFDataExtractor &DA)
Determine whether a contribution to the string offsets table is consistent with the relevant section ...
Definition: DWARFUnit.cpp:1058
llvm::StrOffsetsContributionDescriptor::Base
uint64_t Base
Definition: DWARFUnit.h:184
llvm::sys::path::end
const_iterator end(StringRef path)
Get end iterator over path.
Definition: Path.cpp:235
llvm::dwarf::FormParams::AddrSize
uint8_t AddrSize
Definition: Dwarf.h:655
llvm::DWARFUnitIndex::Entry
Definition: DWARFUnitIndex.h:111
llvm::sys::path::begin
const_iterator begin(StringRef path, Style style=Style::native)
Get begin iterator over path.
Definition: Path.cpp:226
llvm::DWARFLocationExpression
Represents a single DWARF expression, whose value is location-dependent.
Definition: DWARFLocationExpression.h:22
llvm::Optional
Definition: APInt.h:33
llvm::DWARFUnit::getParentEntry
const DWARFDebugInfoEntry * getParentEntry(const DWARFDebugInfoEntry *Die) const
Definition: DWARFUnit.cpp:896
llvm::DIE
A structured debug information entry.
Definition: DIE.h:739
llvm::Expected
Tagged union holding either a T or a Error.
Definition: APFloat.h:41
llvm::DWARFDebugInfoEntry
DWARFDebugInfoEntry - A DIE with only the minimum required data.
Definition: DWARFDebugInfoEntry.h:22
RHS
Value * RHS
Definition: X86PartialReduction.cpp:76
llvm::DataExtractor::getU64
uint64_t getU64(uint64_t *offset_ptr, Error *Err=nullptr) const
Extract a uint64_t value from *offset_ptr.
Definition: DataExtractor.cpp:116
llvm::DWARFDataExtractor
A DataExtractor (typically for an in-memory copy of an object-file section) plus a relocation map for...
Definition: DWARFDataExtractor.h:21
BaseType
llvm::detail::DenseSetImpl::insert
std::pair< iterator, bool > insert(const ValueT &V)
Definition: DenseSet.h:206
llvm::StrOffsetsContributionDescriptor::Size
uint64_t Size
The contribution size not including the header.
Definition: DWARFUnit.h:186
llvm::dwarf::FormParams::Format
DwarfFormat Format
Definition: Dwarf.h:656
getTag
static Optional< unsigned > getTag(const TargetRegisterInfo *TRI, const MachineInstr &MI, const LoadInfo &LI)
Definition: AArch64FalkorHWPFFix.cpp:659
llvm::consumeError
void consumeError(Error Err)
Consume a Error without doing anything.
Definition: Error.h:1042
llvm::Data
@ Data
Definition: SIMachineScheduler.h:55
llvm::DWARFUnit::getAddrOffsetSectionItem
Optional< object::SectionedAddress > getAddrOffsetSectionItem(uint32_t Index) const
Definition: DWARFUnit.cpp:208
llvm::DWARFUnit::getLastChildEntry
const DWARFDebugInfoEntry * getLastChildEntry(const DWARFDebugInfoEntry *Die) const
Definition: DWARFUnit.cpp:1004
llvm::DWARFUnit::getLoclistOffset
Optional< uint64_t > getLoclistOffset(uint32_t Index)
Definition: DWARFUnit.cpp:1197
llvm::sys::path::append
void append(SmallVectorImpl< char > &path, const Twine &a, const Twine &b="", const Twine &c="", const Twine &d="")
Append to path.
Definition: Path.cpp:456
Context
LLVMContext & Context
Definition: NVVMIntrRange.cpp:66
llvm::DWARFUnit::getUnitDIE
DWARFDie getUnitDIE(bool ExtractUnitDIEOnly=true)
Definition: DWARFUnit.h:426
llvm::X86AS::SS
@ SS
Definition: X86.h:201
LHS
Value * LHS
Definition: X86PartialReduction.cpp:75
llvm::DWARFUnit::getDWOId
Optional< uint64_t > getDWOId()
Definition: DWARFUnit.h:441
isType
static bool isType(const Metadata *MD)
Definition: Verifier.cpp:1003
DWARFDebugRangeList.h
llvm::DWARFUnit::getSiblingEntry
const DWARFDebugInfoEntry * getSiblingEntry(const DWARFDebugInfoEntry *Die) const
Definition: DWARFUnit.cpp:918
llvm::DWARFDataExtractor::getRelocatedValue
uint64_t getRelocatedValue(uint32_t Size, uint64_t *Off, uint64_t *SectionIndex=nullptr, Error *Err=nullptr) const
Extracts a value and applies a relocation to the result if one exists for the given offset.
Definition: DWARFDataExtractor.cpp:48
SmallString.h
E
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
llvm::DWARFDie::isSubroutineDIE
bool isSubroutineDIE() const
Returns true if DIE represents a subprogram or an inlined subroutine.
Definition: DWARFDie.cpp:247
llvm::DWARFUnit::determineStringOffsetsTableContribution
Expected< Optional< StrOffsetsContributionDescriptor > > determineStringOffsetsTableContribution(DWARFDataExtractor &DA)
Find the unit's contribution to the string offsets table and determine its length and form.
Definition: DWARFUnit.cpp:1137
C
(vector float) vec_cmpeq(*A, *B) C
Definition: README_ALTIVEC.txt:86
llvm::DWARFDebugAbbrev
Definition: DWARFDebugAbbrev.h:56
llvm::StrOffsetsContributionDescriptor
Represents base address of the CU.
Definition: DWARFUnit.h:183
llvm::DWARFSectionKind
DWARFSectionKind
The enum of section identifiers to be used in internal interfaces.
Definition: DWARFUnitIndex.h:56
llvm::DWARFUnitIndex
Definition: DWARFUnitIndex.h:99
DWARFSection.h
UINT64_MAX
#define UINT64_MAX
Definition: DataTypes.h:77
DWARFDie.h
llvm::dwarf::Index
Index
Definition: Dwarf.h:472
DWARFDebugLoc.h
B
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
llvm::DWARFUnitHeader::isTypeUnit
bool isTypeUnit() const
Definition: DWARFUnit.h:105
llvm::DWARFUnit::getVariableForAddress
DWARFDie getVariableForAddress(uint64_t Address)
Returns variable DIE for the address provided.
Definition: DWARFUnit.cpp:838
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
llvm::DWARFExpression::begin
iterator begin() const
Definition: DWARFExpression.h:148
llvm::dwarf::DW_LENGTH_lo_reserved
@ DW_LENGTH_lo_reserved
Special values for an initial length field.
Definition: Dwarf.h:56
llvm::DWARFContext::checkAddressSizeSupported
static Error checkAddressSizeSupported(unsigned AddressSize, std::error_code EC, char const *Fmt, const Ts &...Vals)
Definition: DWARFContext.h:392
llvm::DW_SECT_EXT_TYPES
@ DW_SECT_EXT_TYPES
Definition: DWARFUnitIndex.h:62
llvm::DWARFObject
Definition: DWARFObject.h:26
llvm::AArch64CC::LE
@ LE
Definition: AArch64BaseInfo.h:268
DWARFListTable.h
llvm::IndexedInstrProf::Version
const uint64_t Version
Definition: InstrProf.h:1056
llvm::dwarf::DwarfFormat
DwarfFormat
Constants that define the DWARF format as 32 or 64 bit.
Definition: Dwarf.h:93
llvm::DWARFUnit::updateAddressDieMap
void updateAddressDieMap(DWARFDie Die)
Recursively update address to Die map.
Definition: DWARFUnit.cpp:719
llvm::DWARFUnit::getParent
DWARFDie getParent(const DWARFDebugInfoEntry *Die)
Definition: DWARFUnit.cpp:888
llvm::SmallString< 16 >
llvm::DWARFCompileUnit
Definition: DWARFCompileUnit.h:22
llvm::DWARFUnit::getSubroutineForAddress
DWARFDie getSubroutineForAddress(uint64_t Address)
Returns subprogram DIE with address range encompassing the provided address.
Definition: DWARFUnit.cpp:750
llvm::DWARFDebugRangeList::extract
Error extract(const DWARFDataExtractor &data, uint64_t *offset_ptr)
Definition: DWARFDebugRangeList.cpp:31
llvm::DataExtractor::size
size_t size() const
Return the number of bytes in the underlying buffer.
Definition: DataExtractor.h:688
llvm::StringRef::empty
constexpr bool empty() const
empty - Check if the string is empty.
Definition: StringRef.h:134
llvm::DWARFAbbreviationDeclarationSet
Definition: DWARFDebugAbbrev.h:22
llvm::DWARFUnit::~DWARFUnit
virtual ~DWARFUnit()
llvm::DWARFUnit::getDebugInfoExtractor
DWARFDataExtractor getDebugInfoExtractor() const
Definition: DWARFUnit.cpp:202
llvm::AArch64PACKey::DA
@ DA
Definition: AArch64BaseInfo.h:821
llvm::DWARFUnit::collectAddressRanges
Expected< DWARFAddressRangesVector > collectAddressRanges()
Definition: DWARFUnit.cpp:681
llvm::DWARFUnit::findLoclistFromOffset
Expected< DWARFLocationExpressionsVector > findLoclistFromOffset(uint64_t Offset)
Definition: DWARFUnit.cpp:696
llvm::AMDGPU::Hwreg::Offset
Offset
Definition: SIDefines.h:416
llvm::DWARFListTableHeader::getHeaderSize
static uint8_t getHeaderSize(dwarf::DwarfFormat Format)
Return the size of the table header including the length but not including the offsets.
Definition: DWARFListTable.h:103
llvm::DWARFLocationTable::visitAbsoluteLocationList
Error visitAbsoluteLocationList(uint64_t Offset, Optional< object::SectionedAddress > BaseAddr, std::function< Optional< object::SectionedAddress >(uint32_t)> LookupAddr, function_ref< bool(Expected< DWARFLocationExpression >)> Callback) const
Definition: DWARFDebugLoc.cpp:172
llvm::DWARFDebugRnglistTable
Definition: DWARFDebugRnglists.h:63
uint64_t
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:1729
llvm::DWARFUnitHeader
Base class describing the header of any kind of "unit." Some information is specific to certain unit ...
Definition: DWARFUnit.h:51
llvm::DW_SECT_EXT_LOC
@ DW_SECT_EXT_LOC
Definition: DWARFUnitIndex.h:63
llvm::DWARFDie::getAddressRanges
Expected< DWARFAddressRangesVector > getAddressRanges() const
Get the address ranges for this DIE.
Definition: DWARFDie.cpp:380
llvm::DWARFListTableHeader::getOffsetEntry
Optional< uint64_t > getOffsetEntry(DataExtractor Data, uint32_t Index) const
Definition: DWARFListTable.h:115
move
compiles ldr LCPI1_0 ldr ldr mov lsr tst moveq r1 ldr LCPI1_1 and r0 bx lr It would be better to do something like to fold the shift into the conditional move
Definition: README.txt:546
llvm::numbers::e
constexpr double e
Definition: MathExtras.h:53
llvm::DWARFUnitIndex::Entry::getContribution
const SectionContribution * getContribution(DWARFSectionKind Sec) const
Definition: DWARFUnitIndex.cpp:248
I
#define I(x, y, z)
Definition: MD5.cpp:58
DWARFUnit.h
llvm::DWARFUnit::getSibling
DWARFDie getSibling(const DWARFDebugInfoEntry *Die)
Definition: DWARFUnit.cpp:910
llvm::DWARFDie::find
Optional< DWARFFormValue > find(dwarf::Attribute Attr) const
Extract the specified attribute from this DIE.
Definition: DWARFDie.cpp:252
llvm::DWARFUnit::getDwarfStringOffsetsByteSize
uint8_t getDwarfStringOffsetsByteSize() const
Definition: DWARFUnit.h:393
llvm::joinErrors
Error joinErrors(Error E1, Error E2)
Concatenate errors.
Definition: Error.h:426
llvm::DWARFExpression
Definition: DWARFExpression.h:24
DWARFDebugRnglists.h
llvm::dwarf::FormParams
A helper struct providing information about the byte size of DW_FORM values that vary in size dependi...
Definition: Dwarf.h:653
llvm::DWARFUnit::DWARFUnit
DWARFUnit(DWARFContext &Context, const DWARFSection &Section, const DWARFUnitHeader &Header, const DWARFDebugAbbrev *DA, const DWARFSection *RS, const DWARFSection *LocSection, StringRef SS, const DWARFSection &SOS, const DWARFSection *AOS, const DWARFSection &LS, bool LE, bool IsDWO, const DWARFUnitVector &UnitVector)
Definition: DWARFUnit.cpp:187
llvm::dwarf::UnitType
UnitType
Constants for unit types in DWARF v5.
Definition: Dwarf.h:465
llvm::DataExtractor::getUnsigned
uint64_t getUnsigned(uint64_t *offset_ptr, uint32_t byte_size, Error *Err=nullptr) const
Extract an unsigned integer of size byte_size from *offset_ptr.
Definition: DataExtractor.cpp:125
llvm::DWARFUnit::getDebugInfoEntry
const DWARFDebugInfoEntry * getDebugInfoEntry(unsigned Index) const
Return DWARFDebugInfoEntry for the specified index Index.
Definition: DWARFUnit.h:269
llvm::DataExtractor::isValidOffset
bool isValidOffset(uint64_t offset) const
Test the validity of offset.
Definition: DataExtractor.h:665
DWARFAbbreviationDeclaration.h
llvm::DWARFExpression::end
iterator end() const
Definition: DWARFExpression.h:149
assert
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
llvm::DWARFDataExtractor::getInitialLength
std::pair< uint64_t, dwarf::DwarfFormat > getInitialLength(uint64_t *Off, Error *Err=nullptr) const
Extracts the DWARF "initial length" field, which can either be a 32-bit value smaller than 0xfffffff0...
Definition: DWARFDataExtractor.cpp:17
ObjectFile.h
llvm::DWARFUnit::getFormat
dwarf::DwarfFormat getFormat() const
Definition: DWARFUnit.h:327
llvm::dwarf::FormParams::getDwarfOffsetByteSize
uint8_t getDwarfOffsetByteSize() const
The size of a reference is determined by the DWARF 32/64-bit format.
Definition: Dwarf.h:671
llvm::DWARFUnit::getNextUnitOffset
uint64_t getNextUnitOffset() const
Definition: DWARFUnit.h:331
llvm::DWARFUnit::clear
void clear()
Definition: DWARFUnit.cpp:375
llvm::DWARFDebugAbbrev::getAbbreviationDeclarationSet
const DWARFAbbreviationDeclarationSet * getAbbreviationDeclarationSet(uint64_t CUAbbrOffset) const
Definition: DWARFDebugAbbrev.cpp:143
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::DWARFUnitVector::getUnitForIndexEntry
DWARFUnit * getUnitForIndexEntry(const DWARFUnitIndex::Entry &E)
Definition: DWARFUnit.cpp:158
llvm::DWARFDebugInfoEntry::getParentIdx
Optional< uint32_t > getParentIdx() const
Returns index of the parent die.
Definition: DWARFDebugInfoEntry.h:48
llvm::hasSingleElement
bool hasSingleElement(ContainerTy &&C)
Returns true if the given container only contains a single element.
Definition: STLExtras.h:380
llvm::DWARFUnit::getCompilationDir
const char * getCompilationDir()
Definition: DWARFUnit.cpp:389
llvm::DWARFUnitVector::addUnit
DWARFUnit * addUnit(std::unique_ptr< DWARFUnit > Unit)
Add an existing DWARFUnit to this UnitVector.
Definition: DWARFUnit.cpp:136
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:50
Dwarf.h
llvm::DWARFDebugRangeList::getAbsoluteRanges
DWARFAddressRangesVector getAbsoluteRanges(llvm::Optional< object::SectionedAddress > BaseAddr) const
getAbsoluteRanges - Returns absolute address ranges defined by this range list.
Definition: DWARFDebugRangeList.cpp:87
llvm::DWARFUnitHeader::getAddressByteSize
uint8_t getAddressByteSize() const
Definition: DWARFUnit.h:89
llvm::DWARFUnitVector::getUnitForOffset
DWARFUnit * getUnitForOffset(uint64_t Offset) const
Definition: DWARFUnit.cpp:145
uint32_t
DWARFDebugInfoEntry.h
llvm::DWARFUnitHeader::extract
bool extract(DWARFContext &Context, const DWARFDataExtractor &debug_info, uint64_t *offset_ptr, DWARFSectionKind SectionKind)
Parse a unit header from debug_info starting at offset_ptr.
Definition: DWARFUnit.cpp:247
llvm::DWARFDie::getSibling
DWARFDie getSibling() const
Get the sibling of this DIE object.
Definition: DWARFDie.cpp:633
llvm::DWARFUnitHeader::getNextUnitOffset
uint64_t getNextUnitOffset() const
Definition: DWARFUnit.h:112
llvm::DWARFDebugInfoEntry::getSiblingIdx
Optional< uint32_t > getSiblingIdx() const
Returns index of the sibling die.
Definition: DWARFDebugInfoEntry.h:56
llvm::DataExtractor::getU8
uint8_t getU8(uint64_t *offset_ptr, Error *Err=nullptr) const
Extract a uint8_t value from *offset_ptr.
Definition: DataExtractor.cpp:79
llvm::DWARFUnit::getStringOffsetSectionItem
Expected< uint64_t > getStringOffsetSectionItem(uint32_t Index) const
Definition: DWARFUnit.cpp:231
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:654
llvm::DWARFUnitHeader::getVersion
uint16_t getVersion() const
Definition: DWARFUnit.h:87
llvm::DWARFUnit::extractRangeList
Error extractRangeList(uint64_t RangeListOffset, DWARFDebugRangeList &RangeList) const
Extract the range list referenced by this compile unit from the .debug_ranges section.
Definition: DWARFUnit.cpp:365
llvm::StringRef::size
constexpr size_t size() const
size - Get the string size.
Definition: StringRef.h:137
parseDWARFStringOffsetsTableHeader
static Expected< StrOffsetsContributionDescriptor > parseDWARFStringOffsetsTableHeader(DWARFDataExtractor &DA, llvm::dwarf::DwarfFormat Format, uint64_t Offset)
Definition: DWARFUnit.cpp:1109
llvm::Twine
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
Definition: Twine.h:81
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::DWARFUnit::getLastChild
DWARFDie getLastChild(const DWARFDebugInfoEntry *Die)
Definition: DWARFUnit.cpp:996
llvm::createStringError
Error createStringError(std::error_code EC, char const *Fmt, const Ts &... Vals)
Create formatted StringError object.
Definition: Error.h:1238
llvm::SectionKind
SectionKind - This is a simple POD value that classifies the properties of a section.
Definition: SectionKind.h:22
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
DWARFDebugAbbrev.h
llvm::toString
const char * toString(DWARFSectionKind Kind)
Definition: DWARFUnitIndex.h:67
llvm::DWARFAbbreviationDeclaration
Definition: DWARFAbbreviationDeclaration.h:27
llvm::DWARFUnit
Definition: DWARFUnit.h:207
llvm::DWARFUnit::setRangesSection
void setRangesSection(const DWARFSection *RS, uint64_t Base)
Definition: DWARFUnit.h:359
llvm::DWARFUnit::getHeaderSize
uint32_t getHeaderSize() const
Size in bytes of the parsed unit header.
Definition: DWARFUnit.h:325
llvm::DWARFUnit::getPreviousSibling
DWARFDie getPreviousSibling(const DWARFDebugInfoEntry *Die)
Definition: DWARFUnit.cpp:932
llvm::DWARFUnit::tryExtractDIEsIfNeeded
Error tryExtractDIEsIfNeeded(bool CUDieOnly)
Definition: DWARFUnit.cpp:486
llvm::Error
Lightweight error class with error context and mandatory checking.
Definition: Error.h:155
llvm::DWARFUnit::getFirstChildEntry
const DWARFDebugInfoEntry * getFirstChildEntry(const DWARFDebugInfoEntry *Die) const
Definition: DWARFUnit.cpp:979
llvm::AArch64CC::LS
@ LS
Definition: AArch64BaseInfo.h:264
DataExtractor.h
llvm::DWARFListTableBase::findList
Expected< DWARFListType > findList(DWARFDataExtractor Data, uint64_t Offset) const
Look up a list based on a given offset.
Definition: DWARFListTable.h:279
llvm::DWARFUnit::getOffset
uint64_t getOffset() const
Definition: DWARFUnit.h:314
DWARFExpression.h
DWARFTypeUnit.h
llvm::StrOffsetsContributionDescriptor::getDwarfOffsetByteSize
uint8_t getDwarfOffsetByteSize() const
Definition: DWARFUnit.h:197
llvm::DWARFUnit::getInlinedChainForAddress
void getInlinedChainForAddress(uint64_t Address, SmallVectorImpl< DWARFDie > &InlinedChain)
getInlinedChainForAddress - fetches inlined chain for a given address.
Definition: DWARFUnit.cpp:859
llvm::DWARFUnit::getPreviousSiblingEntry
const DWARFDebugInfoEntry * getPreviousSiblingEntry(const DWARFDebugInfoEntry *Die) const
Definition: DWARFUnit.cpp:940
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
parseDWARF32StringOffsetsTableHeader
static Expected< StrOffsetsContributionDescriptor > parseDWARF32StringOffsetsTableHeader(DWARFDataExtractor &DA, uint64_t Offset)
Definition: DWARFUnit.cpp:1092
llvm::dwarf::FormParams::Version
uint16_t Version
Definition: Dwarf.h:654
llvm::DWARFUnit::getAbbreviationsOffset
uint64_t getAbbreviationsOffset() const
Definition: DWARFUnit.h:403
llvm::DataExtractor
Definition: DataExtractor.h:41
llvm::DWARFDie::getTag
dwarf::Tag getTag() const
Definition: DWARFDie.h:72
llvm::DWARFUnitHeader::getUnitLengthFieldByteSize
uint8_t getUnitLengthFieldByteSize() const
Definition: DWARFUnit.h:109
llvm::DWARFUnitHeader::applyIndexEntry
bool applyIndexEntry(const DWARFUnitIndex::Entry *Entry)
Definition: DWARFUnit.cpp:348
llvm::DWARFUnit::getBaseAddress
llvm::Optional< object::SectionedAddress > getBaseAddress()
Definition: DWARFUnit.cpp:1047
llvm::DWARFUnit::getDIEIndex
uint32_t getDIEIndex(const DWARFDebugInfoEntry *Die) const
Return the index of a Die entry inside the unit's DIE vector.
Definition: DWARFUnit.h:262
llvm::SmallVectorImpl
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
Definition: APFloat.h:42
llvm::getDWARFUnitIndex
const DWARFUnitIndex & getDWARFUnitIndex(DWARFContext &Context, DWARFSectionKind Kind)
Definition: DWARFUnit.cpp:880
llvm::dwarf::DWARF64
@ DWARF64
Definition: Dwarf.h:93
llvm::DWARFDie
Utility class that carries the DWARF compile/type unit and the debug info entry in an object.
Definition: DWARFDie.h:43
llvm::DWARFDie::isSubprogramDIE
bool isSubprogramDIE() const
Returns true if DIE represents a subprogram (not inlined).
Definition: DWARFDie.cpp:245
llvm::DWARFDebugInfoEntry::hasChildren
bool hasChildren() const
Definition: DWARFDebugInfoEntry.h:70
llvm::DWARFUnit::getLocationTable
const DWARFLocationTable & getLocationTable()
Definition: DWARFUnit.h:378
llvm::DWARFUnit::determineStringOffsetsTableContributionDWO
Expected< Optional< StrOffsetsContributionDescriptor > > determineStringOffsetsTableContributionDWO(DWARFDataExtractor &DA)
Find the unit's contribution to the string offsets table and determine its length and form.
Definition: DWARFUnit.cpp:1150
llvm::DWARFContext::isSupportedVersion
static bool isSupportedVersion(unsigned version)
Definition: DWARFContext.h:381
llvm::DWARFSection::Data
StringRef Data
Definition: DWARFSection.h:17
llvm::sys::path::is_relative
bool is_relative(const Twine &path, Style style=Style::native)
Is path relative?
Definition: Path.cpp:699
CU
Definition: AArch64AsmBackend.cpp:504
llvm::DWARFUnit::getStringOffsetsBase
uint64_t getStringOffsetsBase() const
Definition: DWARFUnit.h:398
llvm::DWARFUnit::updateVariableDieMap
void updateVariableDieMap(DWARFDie Die)
Recursively update address to variable Die map.
Definition: DWARFUnit.cpp:764
llvm::DWARFUnit::getVersion
uint16_t getVersion() const
Definition: DWARFUnit.h:318
llvm::DWARFDie::getFirstChild
DWARFDie getFirstChild() const
Get the first child of this DIE object.
Definition: DWARFDie.cpp:645
llvm::DWARFContext::getMaxSupportedVersion
static unsigned getMaxSupportedVersion()
Definition: DWARFContext.h:380
llvm::dwarf::DWARF32
@ DWARF32
Definition: Dwarf.h:93
llvm::DataExtractor::getU16
uint16_t getU16(uint64_t *offset_ptr, Error *Err=nullptr) const
Extract a uint16_t value from *offset_ptr.
Definition: DataExtractor.cpp:92
llvm::DWARFUnitVector
Describe a collection of units.
Definition: DWARFUnit.h:124