LLVM  5.0.0
DWARFUnit.cpp
Go to the documentation of this file.
1 //===- DWARFUnit.cpp ------------------------------------------------------===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 
11 #include "llvm/ADT/SmallString.h"
12 #include "llvm/ADT/StringRef.h"
20 #include "llvm/Support/Path.h"
21 #include <algorithm>
22 #include <cassert>
23 #include <cstddef>
24 #include <cstdint>
25 #include <cstdio>
26 #include <utility>
27 #include <vector>
28 
29 using namespace llvm;
30 using namespace dwarf;
31 
33  parseImpl(C, Section, C.getDebugAbbrev(), &C.getRangeSection(),
35  &C.getAddrSection(), C.getLineSection(), C.isLittleEndian(), false);
36 }
37 
39  const DWARFSection &DWOSection,
40  DWARFUnitIndex *Index) {
41  parseImpl(C, DWOSection, C.getDebugAbbrevDWO(), &C.getRangeDWOSection(),
44  true);
45 }
46 
48  const DWARFDebugAbbrev *DA, const DWARFSection *RS,
49  StringRef SS, const DWARFSection &SOS,
50  const DWARFSection *AOS, const DWARFSection &LS, bool LE,
51  bool IsDWO, const DWARFUnitSectionBase &UnitSection,
52  const DWARFUnitIndex::Entry *IndexEntry)
53  : Context(DC), InfoSection(Section), Abbrev(DA), RangeSection(RS),
54  LineSection(LS), StringSection(SS), StringOffsetSection(SOS),
55  AddrOffsetSection(AOS), isLittleEndian(LE), isDWO(IsDWO),
56  UnitSection(UnitSection), IndexEntry(IndexEntry) {
57  clear();
58 }
59 
60 DWARFUnit::~DWARFUnit() = default;
61 
63  uint64_t &Result) const {
64  uint32_t Offset = AddrOffsetSectionBase + Index * getAddressByteSize();
65  if (AddrOffsetSection->Data.size() < Offset + getAddressByteSize())
66  return false;
67  DWARFDataExtractor DA(*AddrOffsetSection, isLittleEndian,
69  Result = DA.getRelocatedAddress(&Offset);
70  return true;
71 }
72 
74  uint64_t &Result) const {
75  unsigned ItemSize = getDwarfOffsetByteSize();
76  uint32_t Offset = StringOffsetSectionBase + Index * ItemSize;
77  if (StringOffsetSection.Data.size() < Offset + ItemSize)
78  return false;
79  DWARFDataExtractor DA(StringOffsetSection, isLittleEndian, 0);
80  Result = DA.getRelocatedValue(ItemSize, &Offset);
81  return true;
82 }
83 
84 bool DWARFUnit::extractImpl(DataExtractor debug_info, uint32_t *offset_ptr) {
85  Length = debug_info.getU32(offset_ptr);
86  // FIXME: Support DWARF64.
87  FormParams.Format = DWARF32;
88  FormParams.Version = debug_info.getU16(offset_ptr);
89  uint64_t AbbrOffset;
90  if (FormParams.Version >= 5) {
91  UnitType = debug_info.getU8(offset_ptr);
92  FormParams.AddrSize = debug_info.getU8(offset_ptr);
93  AbbrOffset = debug_info.getU32(offset_ptr);
94  } else {
95  AbbrOffset = debug_info.getU32(offset_ptr);
96  FormParams.AddrSize = debug_info.getU8(offset_ptr);
97  }
98  if (IndexEntry) {
99  if (AbbrOffset)
100  return false;
101  auto *UnitContrib = IndexEntry->getOffset();
102  if (!UnitContrib || UnitContrib->Length != (Length + 4))
103  return false;
104  auto *AbbrEntry = IndexEntry->getOffset(DW_SECT_ABBREV);
105  if (!AbbrEntry)
106  return false;
107  AbbrOffset = AbbrEntry->Offset;
108  }
109 
110  bool LengthOK = debug_info.isValidOffset(getNextUnitOffset() - 1);
111  bool VersionOK = DWARFContext::isSupportedVersion(getVersion());
112  bool AddrSizeOK = getAddressByteSize() == 4 || getAddressByteSize() == 8;
113 
114  if (!LengthOK || !VersionOK || !AddrSizeOK)
115  return false;
116 
117  // Keep track of the highest DWARF version we encounter across all units.
119 
120  Abbrevs = Abbrev->getAbbreviationDeclarationSet(AbbrOffset);
121  return Abbrevs != nullptr;
122 }
123 
124 bool DWARFUnit::extract(DataExtractor debug_info, uint32_t *offset_ptr) {
125  clear();
126 
127  Offset = *offset_ptr;
128 
129  if (debug_info.isValidOffset(*offset_ptr)) {
130  if (extractImpl(debug_info, offset_ptr))
131  return true;
132 
133  // reset the offset to where we tried to parse from if anything went wrong
134  *offset_ptr = Offset;
135  }
136 
137  return false;
138 }
139 
141  DWARFDebugRangeList &RangeList) const {
142  // Require that compile unit is extracted.
143  assert(!DieArray.empty());
144  DWARFDataExtractor RangesData(*RangeSection, isLittleEndian,
146  uint32_t ActualRangeListOffset = RangeSectionBase + RangeListOffset;
147  return RangeList.extract(RangesData, &ActualRangeListOffset);
148 }
149 
151  Offset = 0;
152  Length = 0;
153  Abbrevs = nullptr;
154  FormParams = DWARFFormParams({0, 0, DWARF32});
155  BaseAddr = 0;
156  RangeSectionBase = 0;
157  AddrOffsetSectionBase = 0;
158  clearDIEs(false);
159  DWO.reset();
160 }
161 
163  return dwarf::toString(getUnitDIE().find(DW_AT_comp_dir), nullptr);
164 }
165 
167  return toUnsigned(getUnitDIE().find(DW_AT_GNU_dwo_id));
168 }
169 
170 void DWARFUnit::extractDIEsToVector(
171  bool AppendCUDie, bool AppendNonCUDies,
172  std::vector<DWARFDebugInfoEntry> &Dies) const {
173  if (!AppendCUDie && !AppendNonCUDies)
174  return;
175 
176  // Set the offset to that of the first DIE and calculate the start of the
177  // next compilation unit header.
178  uint32_t DIEOffset = Offset + getHeaderSize();
179  uint32_t NextCUOffset = getNextUnitOffset();
181  DWARFDataExtractor DebugInfoData = getDebugInfoExtractor();
182  uint32_t Depth = 0;
183  bool IsCUDie = true;
184 
185  while (DIE.extractFast(*this, &DIEOffset, DebugInfoData, NextCUOffset,
186  Depth)) {
187  if (IsCUDie) {
188  if (AppendCUDie)
189  Dies.push_back(DIE);
190  if (!AppendNonCUDies)
191  break;
192  // The average bytes per DIE entry has been seen to be
193  // around 14-20 so let's pre-reserve the needed memory for
194  // our DIE entries accordingly.
195  Dies.reserve(Dies.size() + getDebugInfoSize() / 14);
196  IsCUDie = false;
197  } else {
198  Dies.push_back(DIE);
199  }
200 
201  if (const DWARFAbbreviationDeclaration *AbbrDecl =
203  // Normal DIE
204  if (AbbrDecl->hasChildren())
205  ++Depth;
206  } else {
207  // NULL DIE.
208  if (Depth > 0)
209  --Depth;
210  if (Depth == 0)
211  break; // We are done with this compile unit!
212  }
213  }
214 
215  // Give a little bit of info if we encounter corrupt DWARF (our offset
216  // should always terminate at or before the start of the next compilation
217  // unit header).
218  if (DIEOffset > NextCUOffset)
219  fprintf(stderr, "warning: DWARF compile unit extends beyond its "
220  "bounds cu 0x%8.8x at 0x%8.8x'\n", getOffset(), DIEOffset);
221 }
222 
223 size_t DWARFUnit::extractDIEsIfNeeded(bool CUDieOnly) {
224  if ((CUDieOnly && !DieArray.empty()) ||
225  DieArray.size() > 1)
226  return 0; // Already parsed.
227 
228  bool HasCUDie = !DieArray.empty();
229  extractDIEsToVector(!HasCUDie, !CUDieOnly, DieArray);
230 
231  if (DieArray.empty())
232  return 0;
233 
234  // If CU DIE was just parsed, copy several attribute values from it.
235  if (!HasCUDie) {
236  DWARFDie UnitDie = getUnitDIE();
237  auto BaseAddr = toAddress(UnitDie.find({DW_AT_low_pc, DW_AT_entry_pc}));
238  if (BaseAddr)
239  setBaseAddress(*BaseAddr);
240  AddrOffsetSectionBase = toSectionOffset(UnitDie.find(DW_AT_GNU_addr_base), 0);
241  RangeSectionBase = toSectionOffset(UnitDie.find(DW_AT_rnglists_base), 0);
242 
243  // In general, we derive the offset of the unit's contibution to the
244  // debug_str_offsets{.dwo} section from the unit DIE's
245  // DW_AT_str_offsets_base attribute. In dwp files we add to it the offset
246  // we get from the index table.
247  StringOffsetSectionBase =
248  toSectionOffset(UnitDie.find(DW_AT_str_offsets_base), 0);
249  if (IndexEntry)
250  if (const auto *C = IndexEntry->getOffset(DW_SECT_STR_OFFSETS))
251  StringOffsetSectionBase += C->Offset;
252 
253  // Don't fall back to DW_AT_GNU_ranges_base: it should be ignored for
254  // skeleton CU DIE, so that DWARF users not aware of it are not broken.
255  }
256 
257  return DieArray.size();
258 }
259 
260 bool DWARFUnit::parseDWO() {
261  if (isDWO)
262  return false;
263  if (DWO.get())
264  return false;
265  DWARFDie UnitDie = getUnitDIE();
266  if (!UnitDie)
267  return false;
268  auto DWOFileName = dwarf::toString(UnitDie.find(DW_AT_GNU_dwo_name));
269  if (!DWOFileName)
270  return false;
271  auto CompilationDir = dwarf::toString(UnitDie.find(DW_AT_comp_dir));
272  SmallString<16> AbsolutePath;
273  if (sys::path::is_relative(*DWOFileName) && CompilationDir &&
274  *CompilationDir) {
275  sys::path::append(AbsolutePath, *CompilationDir);
276  }
277  sys::path::append(AbsolutePath, *DWOFileName);
278  auto DWOId = getDWOId();
279  if (!DWOId)
280  return false;
281  auto DWOContext = Context.getDWOContext(AbsolutePath);
282  if (!DWOContext)
283  return false;
284 
285  DWARFCompileUnit *DWOCU = DWOContext->getDWOCompileUnitForHash(*DWOId);
286  if (!DWOCU)
287  return false;
288  DWO = std::shared_ptr<DWARFCompileUnit>(std::move(DWOContext), DWOCU);
289  // Share .debug_addr and .debug_ranges section with compile unit in .dwo
290  DWO->setAddrOffsetSection(AddrOffsetSection, AddrOffsetSectionBase);
291  auto DWORangesBase = UnitDie.getRangesBaseAttribute();
292  DWO->setRangesSection(RangeSection, DWORangesBase ? *DWORangesBase : 0);
293  return true;
294 }
295 
296 void DWARFUnit::clearDIEs(bool KeepCUDie) {
297  if (DieArray.size() > (unsigned)KeepCUDie) {
298  // std::vectors never get any smaller when resized to a smaller size,
299  // or when clear() or erase() are called, the size will report that it
300  // is smaller, but the memory allocated remains intact (call capacity()
301  // to see this). So we need to create a temporary vector and swap the
302  // contents which will cause just the internal pointers to be swapped
303  // so that when temporary vector goes out of scope, it will destroy the
304  // contents.
305  std::vector<DWARFDebugInfoEntry> TmpArray;
306  DieArray.swap(TmpArray);
307  // Save at least the compile unit DIE
308  if (KeepCUDie)
309  DieArray.push_back(TmpArray.front());
310  }
311 }
312 
314  DWARFDie UnitDie = getUnitDIE();
315  if (!UnitDie)
316  return;
317  // First, check if unit DIE describes address ranges for the whole unit.
318  const auto &CUDIERanges = UnitDie.getAddressRanges();
319  if (!CUDIERanges.empty()) {
320  CURanges.insert(CURanges.end(), CUDIERanges.begin(), CUDIERanges.end());
321  return;
322  }
323 
324  // This function is usually called if there in no .debug_aranges section
325  // in order to produce a compile unit level set of address ranges that
326  // is accurate. If the DIEs weren't parsed, then we don't want all dies for
327  // all compile units to stay loaded when they weren't needed. So we can end
328  // up parsing the DWARF and then throwing them all away to keep memory usage
329  // down.
330  const bool ClearDIEs = extractDIEsIfNeeded(false) > 1;
332 
333  // Collect address ranges from DIEs in .dwo if necessary.
334  bool DWOCreated = parseDWO();
335  if (DWO)
336  DWO->collectAddressRanges(CURanges);
337  if (DWOCreated)
338  DWO.reset();
339 
340  // Keep memory down by clearing DIEs if this generate function
341  // caused them to be parsed.
342  if (ClearDIEs)
343  clearDIEs(true);
344 }
345 
347  if (Die.isSubroutineDIE()) {
348  for (const auto &R : Die.getAddressRanges()) {
349  // Ignore 0-sized ranges.
350  if (R.LowPC == R.HighPC)
351  continue;
352  auto B = AddrDieMap.upper_bound(R.LowPC);
353  if (B != AddrDieMap.begin() && R.LowPC < (--B)->second.first) {
354  // The range is a sub-range of existing ranges, we need to split the
355  // existing range.
356  if (R.HighPC < B->second.first)
357  AddrDieMap[R.HighPC] = B->second;
358  if (R.LowPC > B->first)
359  AddrDieMap[B->first].first = R.LowPC;
360  }
361  AddrDieMap[R.LowPC] = std::make_pair(R.HighPC, Die);
362  }
363  }
364  // Parent DIEs are added to the AddrDieMap prior to the Children DIEs to
365  // simplify the logic to update AddrDieMap. The child's range will always
366  // be equal or smaller than the parent's range. With this assumption, when
367  // adding one range into the map, it will at most split a range into 3
368  // sub-ranges.
369  for (DWARFDie Child = Die.getFirstChild(); Child; Child = Child.getSibling())
370  updateAddressDieMap(Child);
371 }
372 
373 DWARFDie DWARFUnit::getSubroutineForAddress(uint64_t Address) {
374  extractDIEsIfNeeded(false);
375  if (AddrDieMap.empty())
377  auto R = AddrDieMap.upper_bound(Address);
378  if (R == AddrDieMap.begin())
379  return DWARFDie();
380  // upper_bound's previous item contains Address.
381  --R;
382  if (Address >= R->second.first)
383  return DWARFDie();
384  return R->second.second;
385 }
386 
387 void
389  SmallVectorImpl<DWARFDie> &InlinedChain) {
390  assert(InlinedChain.empty());
391  // Try to look for subprogram DIEs in the DWO file.
392  parseDWO();
393  // First, find the subroutine that contains the given address (the leaf
394  // of inlined chain).
395  DWARFDie SubroutineDIE =
396  (DWO ? DWO.get() : this)->getSubroutineForAddress(Address);
397 
398  while (SubroutineDIE) {
399  if (SubroutineDIE.isSubroutineDIE())
400  InlinedChain.push_back(SubroutineDIE);
401  SubroutineDIE = SubroutineDIE.getParent();
402  }
403 }
404 
407  if (Kind == DW_SECT_INFO)
408  return Context.getCUIndex();
409  assert(Kind == DW_SECT_TYPES);
410  return Context.getTUIndex();
411 }
412 
414  if (!Die)
415  return DWARFDie();
416  const uint32_t Depth = Die->getDepth();
417  // Unit DIEs always have a depth of zero and never have parents.
418  if (Depth == 0)
419  return DWARFDie();
420  // Depth of 1 always means parent is the compile/type unit.
421  if (Depth == 1)
422  return getUnitDIE();
423  // Look for previous DIE with a depth that is one less than the Die's depth.
424  const uint32_t ParentDepth = Depth - 1;
425  for (uint32_t I = getDIEIndex(Die) - 1; I > 0; --I) {
426  if (DieArray[I].getDepth() == ParentDepth)
427  return DWARFDie(this, &DieArray[I]);
428  }
429  return DWARFDie();
430 }
431 
433  if (!Die)
434  return DWARFDie();
435  uint32_t Depth = Die->getDepth();
436  // Unit DIEs always have a depth of zero and never have siblings.
437  if (Depth == 0)
438  return DWARFDie();
439  // NULL DIEs don't have siblings.
440  if (Die->getAbbreviationDeclarationPtr() == nullptr)
441  return DWARFDie();
442 
443  // Find the next DIE whose depth is the same as the Die's depth.
444  for (size_t I = getDIEIndex(Die) + 1, EndIdx = DieArray.size(); I < EndIdx;
445  ++I) {
446  if (DieArray[I].getDepth() == Depth)
447  return DWARFDie(this, &DieArray[I]);
448  }
449  return DWARFDie();
450 }
const DWARFUnitIndex & getTUIndex()
void getInlinedChainForAddress(uint64_t Address, SmallVectorImpl< DWARFDie > &InlinedChain)
getInlinedChainForAddress - fetches inlined chain for a given address.
Definition: DWARFUnit.cpp:388
virtual ~DWARFUnit()
void parseDWO(DWARFContext &C, const DWARFSection &DWOSection, DWARFUnitIndex *Index=nullptr)
Definition: DWARFUnit.cpp:38
uint8_t getDwarfOffsetByteSize() const
Definition: DWARFUnit.h:231
LLVMContext & Context
DWARFAddressRangesVector getAddressRanges() const
Get the address ranges for this DIE.
Definition: DWARFDie.cpp:233
void setBaseAddress(uint64_t base_addr)
Definition: DWARFUnit.h:271
virtual const DWARFSection & getLineSection()=0
std::shared_ptr< DWARFContext > getDWOContext(StringRef AbsolutePath)
void collectAddressRanges(DWARFAddressRangesVector &CURanges)
Definition: DWARFUnit.cpp:313
bool getStringOffsetSectionItem(uint32_t Index, uint64_t &Result) const
Definition: DWARFUnit.cpp:73
virtual uint32_t getHeaderSize() const
Size in bytes of the unit header.
Definition: DWARFUnit.h:164
void collectChildrenAddressRanges(DWARFAddressRangesVector &Ranges) const
Get all address ranges for any DW_TAG_subprogram DIEs in this DIE or any of its children.
Definition: DWARFDie.cpp:252
DWARFDie getSibling(const DWARFDebugInfoEntry *Die)
Definition: DWARFUnit.cpp:432
bool extractRangeList(uint32_t RangeListOffset, DWARFDebugRangeList &RangeList) const
extractRangeList - extracts the range list referenced by this compile unit from .debug_ranges section...
Definition: DWARFUnit.cpp:140
unsigned second
uint32_t getNextUnitOffset() const
Definition: DWARFUnit.h:223
const DWARFDebugAbbrev * getDebugAbbrevDWO()
Get a pointer to the parsed dwo abbreviations object.
virtual StringRef getStringDWOSection()=0
bool isValidOffset(uint32_t offset) const
Test the validity of offset.
dwarf::DwarfFormat Format
Optional< uint64_t > toAddress(const Optional< DWARFFormValue > &V)
Take an optional DWARFFormValue and try to extract an address.
virtual const DWARFSection & getRangeDWOSection()=0
DWARFDataExtractor getDebugInfoExtractor() const
Definition: DWARFUnit.h:200
void append(SmallVectorImpl< char > &path, const Twine &a, const Twine &b="", const Twine &c="", const Twine &d="")
Append to path.
Definition: Path.cpp:465
DWARFUnit(DWARFContext &Context, const DWARFSection &Section, const DWARFDebugAbbrev *DA, const DWARFSection *RS, StringRef SS, const DWARFSection &SOS, const DWARFSection *AOS, const DWARFSection &LS, bool LE, bool IsDWO, const DWARFUnitSectionBase &UnitSection, const DWARFUnitIndex::Entry *IndexEntry=nullptr)
Definition: DWARFUnit.cpp:47
static ManagedStatic< DebugCounter > DC
uint32_t getU32(uint32_t *offset_ptr) const
Extract a uint32_t value from *offset_ptr.
const char * getCompilationDir()
Definition: DWARFUnit.cpp:162
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
Definition: APFloat.h:42
LLVM_NODISCARD bool empty() const
Definition: SmallVector.h:60
uint64_t getRelocatedAddress(uint32_t *Off, uint64_t *SecIx=nullptr) const
Extracts an address-sized value and applies a relocation to the result if one exists for the given of...
uint64_t getRelocatedValue(uint32_t Size, uint32_t *Off, uint64_t *SectionIndex=nullptr) const
Extracts a value and applies a relocation to the result if one exists for the given offset...
void parse(DWARFContext &C, const DWARFSection &Section)
Definition: DWARFUnit.cpp:32
SmallString - A SmallString is just a SmallVector with methods and accessors that make it work better...
Definition: SmallString.h:26
const DWARFDebugAbbrev * getDebugAbbrev()
Get a pointer to the parsed DebugAbbrev object.
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE size_t size() const
size - Get the string size.
Definition: StringRef.h:138
uint16_t getVersion() const
Definition: DWARFUnit.h:227
DWARFDie getParent() const
Get the parent of this DIE object.
Definition: DWARFDie.cpp:363
virtual const DWARFSection & getStringOffsetDWOSection()=0
const DWARFAbbreviationDeclarationSet * getAbbreviationDeclarationSet(uint64_t CUAbbrOffset) const
DWARFDie getSibling() const
Get the sibling of this DIE object.
Definition: DWARFDie.cpp:369
Optional< uint64_t > toSectionOffset(const Optional< DWARFFormValue > &V)
Take an optional DWARFFormValue and try to extract an section offset.
Utility class that carries the DWARF compile/type unit and the debug info entry in an object...
Definition: DWARFDie.h:43
uint8_t getU8(uint32_t *offset_ptr) const
Extract a uint8_t value from *offset_ptr.
DWARFSectionKind
A structured debug information entry.
Definition: DIE.h:662
bool extractFast(const DWARFUnit &U, uint32_t *OffsetPtr)
Extracts a debug info entry, which is a child of a given unit, starting at a given offset...
const SectionContribution * getOffset(DWARFSectionKind Sec) const
virtual const DWARFSection & getAddrSection()=0
DWARFDie getParent(const DWARFDebugInfoEntry *Die)
Definition: DWARFUnit.cpp:413
Optional< DWARFFormValue > find(dwarf::Attribute Attr) const
Extract the specified attribute from this DIE.
Definition: DWARFDie.cpp:146
const DWARFUnitIndex & getDWARFUnitIndex(DWARFContext &Context, DWARFSectionKind Kind)
Definition: DWARFUnit.cpp:405
UnitType
Constants for unit types in DWARF v5.
Definition: Dwarf.h:319
A DataExtractor (typically for an in-memory copy of an object-file section) plus a relocation map for...
DWARFDie getFirstChild() const
Get the first child of this DIE object.
Definition: DWARFDie.h:111
DWARFDie getUnitDIE(bool ExtractUnitDIEOnly=true)
Definition: DWARFUnit.h:275
auto find(R &&Range, const T &Val) -> decltype(std::begin(Range))
Provide wrappers to std::find which take ranges instead of having to pass begin/end explicitly...
Definition: STLExtras.h:839
#define B
Definition: LargeTest.cpp:24
bool extract(DataExtractor debug_info, uint32_t *offset_ptr)
Definition: DWARFUnit.cpp:124
DWARFContext This data structure is the top level entity that deals with dwarf debug information pars...
Definition: DWARFContext.h:52
A helper struct for DWARFFormValue methods, providing information that allows it to know the byte siz...
uint16_t getU16(uint32_t *offset_ptr) const
Extract a uint16_t value from *offset_ptr.
Optional< const char * > toString(const Optional< DWARFFormValue > &V)
Take an optional DWARFFormValue and try to extract a string value from it.
Optional< uint64_t > getRangesBaseAttribute() const
Extract the range base attribute from this DIE as absolute section offset.
Definition: DWARFDie.cpp:199
bool isSubroutineDIE() const
Returns true if DIE represents a subprogram or an inlined subroutine.
Definition: DWARFDie.cpp:140
bool getAddrOffsetSectionItem(uint32_t Index, uint64_t &Result) const
Definition: DWARFUnit.cpp:62
static bool isSupportedVersion(unsigned version)
Definition: DWARFContext.h:268
virtual bool extractImpl(DataExtractor debug_info, uint32_t *offset_ptr)
Definition: DWARFUnit.cpp:84
#define C
Definition: LargeTest.cpp:25
Optional< uint64_t > getDWOId()
Definition: DWARFUnit.cpp:166
#define I(x, y, z)
Definition: MD5.cpp:58
bool is_relative(const Twine &path, Style style=Style::native)
Is path relative?
Definition: Path.cpp:684
const DWARFAbbreviationDeclaration * getAbbreviationDeclarationPtr() const
void updateAddressDieMap(DWARFDie Die)
Recursively update address to Die map.
Definition: DWARFUnit.cpp:346
virtual const DWARFSection & getStringOffsetSection()=0
DWARF v5.
uint32_t getOffset() const
Definition: DWARFUnit.h:222
const DWARFUnitIndex & getCUIndex()
uint8_t getAddressByteSize() const
Definition: DWARFUnit.h:229
const unsigned Kind
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
Base class for all DWARFUnitSection classes.
Definition: DWARFUnit.h:45
std::vector< DWARFAddressRange > DWARFAddressRangesVector
DWARFAddressRangesVector - represents a set of absolute address ranges.
virtual const DWARFSection & getLineDWOSection()=0
DWARFDebugInfoEntry - A DIE with only the minimum required data.
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:49
virtual StringRef getStringSection()=0
virtual const DWARFSection & getRangeSection()=0
bool extract(const DWARFDataExtractor &data, uint32_t *offset_ptr)
void setMaxVersionIfGreater(unsigned Version)
Definition: DWARFContext.h:182
virtual bool isLittleEndian() const =0
Optional< uint64_t > toUnsigned(const Optional< DWARFFormValue > &V)
Take an optional DWARFFormValue and try to extract an unsigned constant.