LLVM  8.0.1
DWARFUnit.h
Go to the documentation of this file.
1 //===- DWARFUnit.h ----------------------------------------------*- C++ -*-===//
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 
10 #ifndef LLVM_DEBUGINFO_DWARF_DWARFUNIT_H
11 #define LLVM_DEBUGINFO_DWARF_DWARFUNIT_H
12 
13 #include "llvm/ADT/Optional.h"
14 #include "llvm/ADT/STLExtras.h"
15 #include "llvm/ADT/SmallVector.h"
16 #include "llvm/ADT/StringRef.h"
28 #include <algorithm>
29 #include <cassert>
30 #include <cstddef>
31 #include <cstdint>
32 #include <map>
33 #include <memory>
34 #include <utility>
35 #include <vector>
36 
37 namespace llvm {
38 
39 class DWARFAbbreviationDeclarationSet;
40 class DWARFContext;
41 class DWARFDebugAbbrev;
42 class DWARFUnit;
43 
44 /// Base class describing the header of any kind of "unit." Some information
45 /// is specific to certain unit types. We separate this class out so we can
46 /// parse the header before deciding what specific kind of unit to construct.
48  // Offset within section.
49  uint32_t Offset = 0;
50  // Version, address size, and DWARF format.
51  dwarf::FormParams FormParams;
52  uint32_t Length = 0;
53  uint64_t AbbrOffset = 0;
54 
55  // For DWO units only.
56  const DWARFUnitIndex::Entry *IndexEntry = nullptr;
57 
58  // For type units only.
59  uint64_t TypeHash = 0;
60  uint32_t TypeOffset = 0;
61 
62  // For v5 split or skeleton compile units only.
63  Optional<uint64_t> DWOId;
64 
65  // Unit type as parsed, or derived from the section kind.
66  uint8_t UnitType = 0;
67 
68  // Size as parsed. uint8_t for compactness.
69  uint8_t Size = 0;
70 
71 public:
72  /// Parse a unit header from \p debug_info starting at \p offset_ptr.
73  bool extract(DWARFContext &Context, const DWARFDataExtractor &debug_info,
75  const DWARFUnitIndex *Index = nullptr,
76  const DWARFUnitIndex::Entry *Entry = nullptr);
77  uint32_t getOffset() const { return Offset; }
78  const dwarf::FormParams &getFormParams() const { return FormParams; }
79  uint16_t getVersion() const { return FormParams.Version; }
80  dwarf::DwarfFormat getFormat() const { return FormParams.Format; }
81  uint8_t getAddressByteSize() const { return FormParams.AddrSize; }
82  uint8_t getRefAddrByteSize() const { return FormParams.getRefAddrByteSize(); }
83  uint8_t getDwarfOffsetByteSize() const {
84  return FormParams.getDwarfOffsetByteSize();
85  }
86  uint32_t getLength() const { return Length; }
87  uint64_t getAbbrOffset() const { return AbbrOffset; }
88  Optional<uint64_t> getDWOId() const { return DWOId; }
89  void setDWOId(uint64_t Id) {
90  assert((!DWOId || *DWOId == Id) && "setting DWOId to a different value");
91  DWOId = Id;
92  }
93  const DWARFUnitIndex::Entry *getIndexEntry() const { return IndexEntry; }
94  uint64_t getTypeHash() const { return TypeHash; }
95  uint32_t getTypeOffset() const { return TypeOffset; }
96  uint8_t getUnitType() const { return UnitType; }
97  bool isTypeUnit() const {
98  return UnitType == dwarf::DW_UT_type || UnitType == dwarf::DW_UT_split_type;
99  }
100  uint8_t getSize() const { return Size; }
101  // FIXME: Support DWARF64.
102  uint32_t getNextUnitOffset() const { return Offset + Length + 4; }
103 };
104 
107 
108 /// Describe a collection of units. Intended to hold all units either from
109 /// .debug_info and .debug_types, or from .debug_info.dwo and .debug_types.dwo.
110 class DWARFUnitVector final : public SmallVector<std::unique_ptr<DWARFUnit>, 1> {
111  std::function<std::unique_ptr<DWARFUnit>(uint32_t, DWARFSectionKind,
112  const DWARFSection *,
113  const DWARFUnitIndex::Entry *)>
114  Parser;
115  int NumInfoUnits = -1;
116 
117 public:
119  using iterator = typename UnitVector::iterator;
121 
122  DWARFUnit *getUnitForOffset(uint32_t Offset) const;
123  DWARFUnit *getUnitForIndexEntry(const DWARFUnitIndex::Entry &E);
124 
125  /// Read units from a .debug_info or .debug_types section. Calls made
126  /// before finishedInfoUnits() are assumed to be for .debug_info sections,
127  /// calls after finishedInfoUnits() are for .debug_types sections. Caller
128  /// must not mix calls to addUnitsForSection and addUnitsForDWOSection.
129  void addUnitsForSection(DWARFContext &C, const DWARFSection &Section,
130  DWARFSectionKind SectionKind);
131  /// Read units from a .debug_info.dwo or .debug_types.dwo section. Calls
132  /// made before finishedInfoUnits() are assumed to be for .debug_info.dwo
133  /// sections, calls after finishedInfoUnits() are for .debug_types.dwo
134  /// sections. Caller must not mix calls to addUnitsForSection and
135  /// addUnitsForDWOSection.
136  void addUnitsForDWOSection(DWARFContext &C, const DWARFSection &DWOSection,
137  DWARFSectionKind SectionKind, bool Lazy = false);
138 
139  /// Add an existing DWARFUnit to this UnitVector. This is used by the DWARF
140  /// verifier to process unit separately.
141  DWARFUnit *addUnit(std::unique_ptr<DWARFUnit> Unit);
142 
143  /// Returns number of all units held by this instance.
144  unsigned getNumUnits() const { return size(); }
145  /// Returns number of units from all .debug_info[.dwo] sections.
146  unsigned getNumInfoUnits() const {
147  return NumInfoUnits == -1 ? size() : NumInfoUnits;
148  }
149  /// Returns number of units from all .debug_types[.dwo] sections.
150  unsigned getNumTypesUnits() const { return size() - NumInfoUnits; }
151  /// Indicate that parsing .debug_info[.dwo] is done, and remaining units
152  /// will be from .debug_types[.dwo].
153  void finishedInfoUnits() { NumInfoUnits = size(); }
154 
155 private:
156  void addUnitsImpl(DWARFContext &Context, const DWARFObject &Obj,
157  const DWARFSection &Section, const DWARFDebugAbbrev *DA,
158  const DWARFSection *RS, const DWARFSection *LocSection,
159  StringRef SS, const DWARFSection &SOS,
160  const DWARFSection *AOS, const DWARFSection &LS, bool LE,
161  bool IsDWO, bool Lazy, DWARFSectionKind SectionKind);
162 };
163 
164 /// Represents base address of the CU.
165 /// Represents a unit's contribution to the string offsets table.
167  uint64_t Base = 0;
168  /// The contribution size not including the header.
169  uint64_t Size = 0;
170  /// Format and version.
172 
173  StrOffsetsContributionDescriptor(uint64_t Base, uint64_t Size,
175  : Base(Base), Size(Size), FormParams({Version, 0, Format}) {}
176 
177  uint8_t getVersion() const { return FormParams.Version; }
178  dwarf::DwarfFormat getFormat() const { return FormParams.Format; }
179  uint8_t getDwarfOffsetByteSize() const {
180  return FormParams.getDwarfOffsetByteSize();
181  }
182  /// Determine whether a contribution to the string offsets table is
183  /// consistent with the relevant section size and that its length is
184  /// a multiple of the size of one of its entries.
186  validateContributionSize(DWARFDataExtractor &DA);
187 };
188 
189 class DWARFUnit {
191  /// Section containing this DWARFUnit.
192  const DWARFSection &InfoSection;
193 
194  DWARFUnitHeader Header;
195  const DWARFDebugAbbrev *Abbrev;
196  const DWARFSection *RangeSection;
197  uint32_t RangeSectionBase;
198  /// We either keep track of the location list section or its data, depending
199  /// on whether we are handling a split DWARF section or not.
200  union {
203  };
204  const DWARFSection &LineSection;
205  StringRef StringSection;
206  const DWARFSection &StringOffsetSection;
207  const DWARFSection *AddrOffsetSection;
208  uint32_t AddrOffsetSectionBase = 0;
209  bool isLittleEndian;
210  bool IsDWO;
211  const DWARFUnitVector &UnitVector;
212 
213  /// Start, length, and DWARF format of the unit's contribution to the string
214  /// offsets table (DWARF v5).
215  Optional<StrOffsetsContributionDescriptor> StringOffsetsTableContribution;
216 
217  /// A table of range lists (DWARF v5 and later).
219 
220  mutable const DWARFAbbreviationDeclarationSet *Abbrevs;
222  /// The compile unit debug information entry items.
223  std::vector<DWARFDebugInfoEntry> DieArray;
224 
225  /// Map from range's start address to end address and corresponding DIE.
226  /// IntervalMap does not support range removal, as a result, we use the
227  /// std::map::upper_bound for address range lookup.
228  std::map<uint64_t, std::pair<uint64_t, DWARFDie>> AddrDieMap;
229 
230  using die_iterator_range =
232 
233  std::shared_ptr<DWARFUnit> DWO;
234 
235  uint32_t getDIEIndex(const DWARFDebugInfoEntry *Die) {
236  auto First = DieArray.data();
237  assert(Die >= First && Die < First + DieArray.size());
238  return Die - First;
239  }
240 
241 protected:
242  const DWARFUnitHeader &getHeader() const { return Header; }
243 
244  /// Size in bytes of the parsed unit header.
245  uint32_t getHeaderSize() const { return Header.getSize(); }
246 
247  /// Find the unit's contribution to the string offsets table and determine its
248  /// length and form. The given offset is expected to be derived from the unit
249  /// DIE's DW_AT_str_offsets_base attribute.
251  determineStringOffsetsTableContribution(DWARFDataExtractor &DA);
252 
253  /// Find the unit's contribution to the string offsets table and determine its
254  /// length and form. The given offset is expected to be 0 in a dwo file or,
255  /// in a dwp file, the start of the unit's contribution to the string offsets
256  /// table section (as determined by the index table).
258  determineStringOffsetsTableContributionDWO(DWARFDataExtractor &DA);
259 
260 public:
261  DWARFUnit(DWARFContext &Context, const DWARFSection &Section,
262  const DWARFUnitHeader &Header, const DWARFDebugAbbrev *DA,
263  const DWARFSection *RS, const DWARFSection *LocSection,
264  StringRef SS, const DWARFSection &SOS, const DWARFSection *AOS,
265  const DWARFSection &LS, bool LE, bool IsDWO,
266  const DWARFUnitVector &UnitVector);
267 
268  virtual ~DWARFUnit();
269 
270  bool isDWOUnit() const { return IsDWO; }
271  DWARFContext& getContext() const { return Context; }
272  const DWARFSection &getInfoSection() const { return InfoSection; }
273  const DWARFSection *getLocSection() const { return LocSection; }
274  StringRef getLocSectionData() const { return LocSectionData; }
275  uint32_t getOffset() const { return Header.getOffset(); }
277  return Header.getFormParams();
278  }
279  uint16_t getVersion() const { return Header.getVersion(); }
280  uint8_t getAddressByteSize() const { return Header.getAddressByteSize(); }
281  uint8_t getRefAddrByteSize() const { return Header.getRefAddrByteSize(); }
282  uint8_t getDwarfOffsetByteSize() const {
283  return Header.getDwarfOffsetByteSize();
284  }
285  uint32_t getLength() const { return Header.getLength(); }
286  uint8_t getUnitType() const { return Header.getUnitType(); }
287  bool isTypeUnit() const { return Header.isTypeUnit(); }
288  uint32_t getNextUnitOffset() const { return Header.getNextUnitOffset(); }
289  const DWARFSection &getLineSection() const { return LineSection; }
290  StringRef getStringSection() const { return StringSection; }
292  return StringOffsetSection;
293  }
294 
296  AddrOffsetSection = AOS;
297  AddrOffsetSectionBase = Base;
298  }
299 
300  /// Recursively update address to Die map.
301  void updateAddressDieMap(DWARFDie Die);
302 
304  RangeSection = RS;
305  RangeSectionBase = Base;
306  }
307 
308  Optional<SectionedAddress> getAddrOffsetSectionItem(uint32_t Index) const;
309  Optional<uint64_t> getStringOffsetSectionItem(uint32_t Index) const;
310 
311  DWARFDataExtractor getDebugInfoExtractor() const;
312 
314  return DataExtractor(StringSection, false, 0);
315  }
316 
317  /// Extract the range list referenced by this compile unit from the
318  /// .debug_ranges section. If the extraction is unsuccessful, an error
319  /// is returned. Successful extraction requires that the compile unit
320  /// has already been extracted.
321  Error extractRangeList(uint32_t RangeListOffset,
322  DWARFDebugRangeList &RangeList) const;
323  void clear();
324 
327  return StringOffsetsTableContribution;
328  }
329 
331  assert(StringOffsetsTableContribution);
332  return StringOffsetsTableContribution->getDwarfOffsetByteSize();
333  }
334 
335  uint64_t getStringOffsetsBase() const {
336  assert(StringOffsetsTableContribution);
337  return StringOffsetsTableContribution->Base;
338  }
339 
340  const DWARFAbbreviationDeclarationSet *getAbbreviations() const;
341 
342  static bool isMatchingUnitTypeAndTag(uint8_t UnitType, dwarf::Tag Tag) {
343  switch (UnitType) {
344  case dwarf::DW_UT_compile:
345  return Tag == dwarf::DW_TAG_compile_unit;
346  case dwarf::DW_UT_type:
347  return Tag == dwarf::DW_TAG_type_unit;
348  case dwarf::DW_UT_partial:
349  return Tag == dwarf::DW_TAG_partial_unit;
350  case dwarf::DW_UT_skeleton:
351  return Tag == dwarf::DW_TAG_skeleton_unit;
352  case dwarf::DW_UT_split_compile:
353  case dwarf::DW_UT_split_type:
354  return dwarf::isUnitType(Tag);
355  }
356  return false;
357  }
358 
359  /// Return the number of bytes for the header of a unit of
360  /// UnitType type.
361  ///
362  /// This function must be called with a valid unit type which in
363  /// DWARF5 is defined as one of the following six types.
364  static uint32_t getDWARF5HeaderSize(uint8_t UnitType) {
365  switch (UnitType) {
366  case dwarf::DW_UT_compile:
367  case dwarf::DW_UT_partial:
368  return 12;
369  case dwarf::DW_UT_skeleton:
370  case dwarf::DW_UT_split_compile:
371  return 20;
372  case dwarf::DW_UT_type:
373  case dwarf::DW_UT_split_type:
374  return 24;
375  }
376  llvm_unreachable("Invalid UnitType.");
377  }
378 
379  llvm::Optional<SectionedAddress> getBaseAddress();
380 
381  DWARFDie getUnitDIE(bool ExtractUnitDIEOnly = true) {
382  extractDIEsIfNeeded(ExtractUnitDIEOnly);
383  if (DieArray.empty())
384  return DWARFDie();
385  return DWARFDie(this, &DieArray[0]);
386  }
387 
388  const char *getCompilationDir();
390  extractDIEsIfNeeded(/*CUDieOnly*/ true);
391  return getHeader().getDWOId();
392  }
393  void setDWOId(uint64_t NewID) { Header.setDWOId(NewID); }
394 
395  /// Return a vector of address ranges resulting from a (possibly encoded)
396  /// range list starting at a given offset in the appropriate ranges section.
397  Expected<DWARFAddressRangesVector> findRnglistFromOffset(uint32_t Offset);
398 
399  /// Return a vector of address ranges retrieved from an encoded range
400  /// list whose offset is found via a table lookup given an index (DWARF v5
401  /// and later).
402  Expected<DWARFAddressRangesVector> findRnglistFromIndex(uint32_t Index);
403 
404  /// Return a rangelist's offset based on an index. The index designates
405  /// an entry in the rangelist table's offset array and is supplied by
406  /// DW_FORM_rnglistx.
408  if (RngListTable)
409  return RngListTable->getOffsetEntry(Index);
410  return None;
411  }
412 
413  Expected<DWARFAddressRangesVector> collectAddressRanges();
414 
415  /// Returns subprogram DIE with address range encompassing the provided
416  /// address. The pointer is alive as long as parsed compile unit DIEs are not
417  /// cleared.
418  DWARFDie getSubroutineForAddress(uint64_t Address);
419 
420  /// getInlinedChainForAddress - fetches inlined chain for a given address.
421  /// Returns empty chain if there is no subprogram containing address. The
422  /// chain is valid as long as parsed compile unit DIEs are not cleared.
423  void getInlinedChainForAddress(uint64_t Address,
424  SmallVectorImpl<DWARFDie> &InlinedChain);
425 
426  /// Return the DWARFUnitVector containing this unit.
427  const DWARFUnitVector &getUnitVector() const { return UnitVector; }
428 
429  /// Returns the number of DIEs in the unit. Parses the unit
430  /// if necessary.
431  unsigned getNumDIEs() {
432  extractDIEsIfNeeded(false);
433  return DieArray.size();
434  }
435 
436  /// Return the index of a DIE inside the unit's DIE vector.
437  ///
438  /// It is illegal to call this method with a DIE that hasn't be
439  /// created by this unit. In other word, it's illegal to call this
440  /// method on a DIE that isn't accessible by following
441  /// children/sibling links starting from this unit's getUnitDIE().
443  return getDIEIndex(D.getDebugInfoEntry());
444  }
445 
446  /// Return the DIE object at the given index.
447  DWARFDie getDIEAtIndex(unsigned Index) {
448  assert(Index < DieArray.size());
449  return DWARFDie(this, &DieArray[Index]);
450  }
451 
453  DWARFDie getSibling(const DWARFDebugInfoEntry *Die);
454  DWARFDie getPreviousSibling(const DWARFDebugInfoEntry *Die);
455  DWARFDie getFirstChild(const DWARFDebugInfoEntry *Die);
456  DWARFDie getLastChild(const DWARFDebugInfoEntry *Die);
457 
458  /// Return the DIE object for a given offset inside the
459  /// unit's DIE vector.
460  ///
461  /// The unit needs to have its DIEs extracted for this method to work.
463  extractDIEsIfNeeded(false);
464  assert(!DieArray.empty());
465  auto it = std::lower_bound(
466  DieArray.begin(), DieArray.end(), Offset,
467  [](const DWARFDebugInfoEntry &LHS, uint32_t Offset) {
468  return LHS.getOffset() < Offset;
469  });
470  if (it != DieArray.end() && it->getOffset() == Offset)
471  return DWARFDie(this, &*it);
472  return DWARFDie();
473  }
474 
476  if (auto IndexEntry = Header.getIndexEntry())
477  if (const auto *Contrib = IndexEntry->getOffset(DW_SECT_LINE))
478  return Contrib->Offset;
479  return 0;
480  }
481 
483  extractDIEsIfNeeded(false);
484  return die_iterator_range(DieArray.begin(), DieArray.end());
485  }
486 
487  virtual void dump(raw_ostream &OS, DIDumpOptions DumpOpts) = 0;
488 private:
489  /// Size in bytes of the .debug_info data associated with this compile unit.
490  size_t getDebugInfoSize() const {
491  return Header.getLength() + 4 - getHeaderSize();
492  }
493 
494  /// extractDIEsIfNeeded - Parses a compile unit and indexes its DIEs if it
495  /// hasn't already been done. Returns the number of DIEs parsed at this call.
496  size_t extractDIEsIfNeeded(bool CUDieOnly);
497 
498  /// extractDIEsToVector - Appends all parsed DIEs to a vector.
499  void extractDIEsToVector(bool AppendCUDie, bool AppendNonCUDIEs,
500  std::vector<DWARFDebugInfoEntry> &DIEs) const;
501 
502  /// clearDIEs - Clear parsed DIEs to keep memory usage low.
503  void clearDIEs(bool KeepCUDie);
504 
505  /// parseDWO - Parses .dwo file for current compile unit. Returns true if
506  /// it was actually constructed.
507  bool parseDWO();
508 };
509 
510 } // end namespace llvm
511 
512 #endif // LLVM_DEBUGINFO_DWARF_DWARFUNIT_H
static bool isMatchingUnitTypeAndTag(uint8_t UnitType, dwarf::Tag Tag)
Definition: DWARFUnit.h:342
uint64_t CallInst * C
A helper struct providing information about the byte size of DW_FORM values that vary in size dependi...
Definition: Dwarf.h:499
LLVMContext & Context
This class represents lattice values for constants.
Definition: AllocatorList.h:24
Represents base address of the CU.
Definition: DWARFUnit.h:166
bool isUnitType(uint8_t UnitType)
Definition: Dwarf.h:344
bool isTypeUnit() const
Definition: DWARFUnit.h:287
This provides a very simple, boring adaptor for a begin and end iterator into a range type...
uint8_t getDwarfOffsetByteSize() const
Definition: DWARFUnit.h:83
uint8_t getRefAddrByteSize() const
The definition of the size of form DW_FORM_ref_addr depends on the version.
Definition: Dwarf.h:507
const DWARFSection * getLocSection() const
Definition: DWARFUnit.h:273
void setAddrOffsetSection(const DWARFSection *AOS, uint32_t Base)
Definition: DWARFUnit.h:295
const Optional< StrOffsetsContributionDescriptor > & getStringOffsetsTableContribution() const
Definition: DWARFUnit.h:326
unsigned getNumUnits() const
Returns number of all units held by this instance.
Definition: DWARFUnit.h:144
uint8_t getRefAddrByteSize() const
Definition: DWARFUnit.h:281
dwarf::DwarfFormat getFormat() const
Definition: DWARFUnit.h:178
uint8_t getDwarfStringOffsetsByteSize() const
Definition: DWARFUnit.h:330
const DWARFSection & getInfoSection() const
Definition: DWARFUnit.h:272
const dwarf::FormParams & getFormParams() const
Definition: DWARFUnit.h:276
uint32_t getOffset() const
Definition: DWARFUnit.h:77
uint32_t getNextUnitOffset() const
Definition: DWARFUnit.h:288
Optional< uint64_t > getDWOId() const
Definition: DWARFUnit.h:88
uint16_t getVersion() const
Definition: DWARFUnit.h:79
DwarfFormat
Constants that define the DWARF format as 32 or 64 bit.
Definition: Dwarf.h:66
uint64_t getAbbrOffset() const
Definition: DWARFUnit.h:87
const DWARFSection & getLineSection() const
Definition: DWARFUnit.h:289
Tagged union holding either a T or a Error.
Definition: CachePruning.h:23
const DWARFDebugInfoEntry * getDebugInfoEntry() const
Definition: DWARFDie.h:53
bool isTypeUnit() const
Definition: DWARFUnit.h:97
uint8_t getAddressByteSize() const
Definition: DWARFUnit.h:280
unsigned getNumDIEs()
Returns the number of DIEs in the unit.
Definition: DWARFUnit.h:431
bool isDWOUnit() const
Definition: DWARFUnit.h:270
uint32_t getTypeOffset() const
Definition: DWARFUnit.h:95
auto lower_bound(R &&Range, ForwardIt I) -> decltype(adl_begin(Range))
Provide wrappers to std::lower_bound which take ranges instead of having to pass begin/end explicitly...
Definition: STLExtras.h:1282
void setDWOId(uint64_t NewID)
Definition: DWARFUnit.h:393
const DWARFSection & getStringOffsetSection() const
Definition: DWARFUnit.h:291
uint16_t getVersion() const
Definition: DWARFUnit.h:279
Container for dump options that control which debug information will be dumped.
Definition: DIContext.h:159
die_iterator_range dies()
Definition: DWARFUnit.h:482
Utility class that carries the DWARF compile/type unit and the debug info entry in an object...
Definition: DWARFDie.h:43
void dump(const SparseBitVector< ElementSize > &LHS, raw_ostream &out)
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
DWARFSectionKind
struct UnitT Unit
uint8_t getUnitType() const
Definition: DWARFUnit.h:96
Optional< uint64_t > getDWOId()
Definition: DWARFUnit.h:389
static uint32_t getDWARF5HeaderSize(uint8_t UnitType)
Return the number of bytes for the header of a unit of UnitType type.
Definition: DWARFUnit.h:364
uint32_t getLength() const
Definition: DWARFUnit.h:86
bool extract(DWARFContext &Context, const DWARFDataExtractor &debug_info, uint32_t *offset_ptr, DWARFSectionKind Kind=DW_SECT_INFO, const DWARFUnitIndex *Index=nullptr, const DWARFUnitIndex::Entry *Entry=nullptr)
Parse a unit header from debug_info starting at offset_ptr.
Definition: DWARFUnit.cpp:235
StringRef getStringSection() const
Definition: DWARFUnit.h:290
uint32_t getDIEIndex(const DWARFDie &D)
Return the index of a DIE inside the unit&#39;s DIE vector.
Definition: DWARFUnit.h:442
SectionKind - This is a simple POD value that classifies the properties of a section.
Definition: SectionKind.h:23
DWARFContext & getContext() const
Definition: DWARFUnit.h:271
void setRangesSection(const DWARFSection *RS, uint32_t Base)
Definition: DWARFUnit.h:303
uint32_t getHeaderSize() const
Size in bytes of the parsed unit header.
Definition: DWARFUnit.h:245
typename UnitVector::iterator iterator
Definition: DWARFUnit.h:119
const dwarf::FormParams & getFormParams() const
Definition: DWARFUnit.h:78
const DWARFUnitIndex & getDWARFUnitIndex(DWARFContext &Context, DWARFSectionKind Kind)
Definition: DWARFUnit.cpp:650
Base class describing the header of any kind of "unit." Some information is specific to certain unit ...
Definition: DWARFUnit.h:47
StrOffsetsContributionDescriptor(uint64_t Base, uint64_t Size, uint8_t Version, dwarf::DwarfFormat Format)
Definition: DWARFUnit.h:173
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
uint8_t getAddressByteSize() const
Definition: DWARFUnit.h:81
dwarf::DwarfFormat getFormat() const
Definition: DWARFUnit.h:80
const DWARFSection * LocSection
Definition: DWARFUnit.h:201
const DWARFUnitVector & getUnitVector() const
Return the DWARFUnitVector containing this unit.
Definition: DWARFUnit.h:427
uint64_t getTypeHash() const
Definition: DWARFUnit.h:94
A DataExtractor (typically for an in-memory copy of an object-file section) plus a relocation map for...
uint64_t getStringOffsetsBase() const
Definition: DWARFUnit.h:335
DWARFDie getUnitDIE(bool ExtractUnitDIEOnly=true)
Definition: DWARFUnit.h:381
void setDWOId(uint64_t Id)
Definition: DWARFUnit.h:89
const DWARFUnitIndex::Entry * getIndexEntry() const
Definition: DWARFUnit.h:93
auto size(R &&Range, typename std::enable_if< std::is_same< typename std::iterator_traits< decltype(Range.begin())>::iterator_category, std::random_access_iterator_tag >::value, void >::type *=nullptr) -> decltype(std::distance(Range.begin(), Range.end()))
Get the size of a range.
Definition: STLExtras.h:1167
This is a &#39;vector&#39; (really, a variable-sized array), optimized for the case when the array is small...
Definition: SmallVector.h:847
DWARFContext This data structure is the top level entity that deals with dwarf debug information pars...
Definition: DWARFContext.h:59
static GCRegistry::Add< StatepointGC > D("statepoint-example", "an example strategy for statepoint")
Describe a collection of units.
Definition: DWARFUnit.h:110
StringRef getLocSectionData() const
Definition: DWARFUnit.h:274
A range adaptor for a pair of iterators.
This file contains constants used for implementing Dwarf debug support.
uint32_t getLength() const
Definition: DWARFUnit.h:285
static void clear(coro::Shape &Shape)
Definition: Coroutines.cpp:212
uint32_t getNextUnitOffset() const
Definition: DWARFUnit.h:102
DataExtractor getStringExtractor() const
Definition: DWARFUnit.h:313
void finishedInfoUnits()
Indicate that parsing .debug_info[.dwo] is done, and remaining units will be from ...
Definition: DWARFUnit.h:153
DWARFDie getDIEAtIndex(unsigned Index)
Return the DIE object at the given index.
Definition: DWARFUnit.h:447
uint8_t getRefAddrByteSize() const
Definition: DWARFUnit.h:82
uint32_t getOffset() const
Definition: DWARFUnit.h:275
uint8_t getSize() const
Definition: DWARFUnit.h:100
const unsigned Kind
uint8_t getUnitType() const
Definition: DWARFUnit.h:286
DWARFDie getDIEForOffset(uint32_t Offset)
Return the DIE object for a given offset inside the unit&#39;s DIE vector.
Definition: DWARFUnit.h:462
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
DwarfFormat Format
Definition: Dwarf.h:502
const DWARFUnitHeader & getHeader() const
Definition: DWARFUnit.h:242
DWARFDebugInfoEntry - A DIE with only the minimum required data.
unsigned getNumTypesUnits() const
Returns number of units from all .debug_types[.dwo] sections.
Definition: DWARFUnit.h:150
Lightweight error class with error context and mandatory checking.
Definition: Error.h:158
static const Function * getParent(const Value *V)
This class implements an extremely fast bulk output stream that can only output to a stream...
Definition: raw_ostream.h:46
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:49
uint8_t getDwarfOffsetByteSize() const
The size of a reference is determined by the DWARF 32/64-bit format.
Definition: Dwarf.h:514
Optional< uint32_t > getRnglistOffset(uint32_t Index)
Return a rangelist&#39;s offset based on an index.
Definition: DWARFUnit.h:407
const uint64_t Version
Definition: InstrProf.h:895
uint8_t getDwarfOffsetByteSize() const
Definition: DWARFUnit.h:282
uint32_t getLineTableOffset() const
Definition: DWARFUnit.h:475
unsigned getNumInfoUnits() const
Returns number of units from all .debug_info[.dwo] sections.
Definition: DWARFUnit.h:146
StringRef LocSectionData
Definition: DWARFUnit.h:202