LLVM  8.0.0svn
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  uint32_t getOffset() const { return Offset; }
77  const dwarf::FormParams &getFormParams() const { return FormParams; }
78  uint16_t getVersion() const { return FormParams.Version; }
79  dwarf::DwarfFormat getFormat() const { return FormParams.Format; }
80  uint8_t getAddressByteSize() const { return FormParams.AddrSize; }
81  uint8_t getRefAddrByteSize() const { return FormParams.getRefAddrByteSize(); }
82  uint8_t getDwarfOffsetByteSize() const {
83  return FormParams.getDwarfOffsetByteSize();
84  }
85  uint32_t getLength() const { return Length; }
86  uint64_t getAbbrOffset() const { return AbbrOffset; }
87  Optional<uint64_t> getDWOId() const { return DWOId; }
88  void setDWOId(uint64_t Id) {
89  assert((!DWOId || *DWOId == Id) && "setting DWOId to a different value");
90  DWOId = Id;
91  }
92  const DWARFUnitIndex::Entry *getIndexEntry() const { return IndexEntry; }
93  uint64_t getTypeHash() const { return TypeHash; }
94  uint32_t getTypeOffset() const { return TypeOffset; }
95  uint8_t getUnitType() const { return UnitType; }
96  bool isTypeUnit() const {
97  return UnitType == dwarf::DW_UT_type || UnitType == dwarf::DW_UT_split_type;
98  }
99  uint8_t getSize() const { return Size; }
100  // FIXME: Support DWARF64.
101  uint32_t getNextUnitOffset() const { return Offset + Length + 4; }
102 };
103 
106 
107 /// Describe a collection of units. Intended to hold all units either from
108 /// .debug_info and .debug_types, or from .debug_info.dwo and .debug_types.dwo.
109 class DWARFUnitVector final : public SmallVector<std::unique_ptr<DWARFUnit>, 1> {
110  std::function<std::unique_ptr<DWARFUnit>(uint32_t, DWARFSectionKind,
111  const DWARFSection *)>
112  Parser;
113  int NumInfoUnits = -1;
114 
115 public:
117  using iterator = typename UnitVector::iterator;
119 
120  DWARFUnit *getUnitForOffset(uint32_t Offset) const;
121  DWARFUnit *getUnitForIndexEntry(const DWARFUnitIndex::Entry &E);
122 
123  /// Read units from a .debug_info or .debug_types section. Calls made
124  /// before finishedInfoUnits() are assumed to be for .debug_info sections,
125  /// calls after finishedInfoUnits() are for .debug_types sections. Caller
126  /// must not mix calls to addUnitsForSection and addUnitsForDWOSection.
127  void addUnitsForSection(DWARFContext &C, const DWARFSection &Section,
128  DWARFSectionKind SectionKind);
129  /// Read units from a .debug_info.dwo or .debug_types.dwo section. Calls
130  /// made before finishedInfoUnits() are assumed to be for .debug_info.dwo
131  /// sections, calls after finishedInfoUnits() are for .debug_types.dwo
132  /// sections. Caller must not mix calls to addUnitsForSection and
133  /// addUnitsForDWOSection.
134  void addUnitsForDWOSection(DWARFContext &C, const DWARFSection &DWOSection,
135  DWARFSectionKind SectionKind, bool Lazy = false);
136 
137  /// Returns number of all units held by this instance.
138  unsigned getNumUnits() const { return size(); }
139  /// Returns number of units from all .debug_info[.dwo] sections.
140  unsigned getNumInfoUnits() const {
141  return NumInfoUnits == -1 ? size() : NumInfoUnits;
142  }
143  /// Returns number of units from all .debug_types[.dwo] sections.
144  unsigned getNumTypesUnits() const { return size() - NumInfoUnits; }
145  /// Indicate that parsing .debug_info[.dwo] is done, and remaining units
146  /// will be from .debug_types[.dwo].
147  void finishedInfoUnits() { NumInfoUnits = size(); }
148 
149 private:
150  void addUnitsImpl(DWARFContext &Context, const DWARFObject &Obj,
151  const DWARFSection &Section, const DWARFDebugAbbrev *DA,
152  const DWARFSection *RS, StringRef SS,
153  const DWARFSection &SOS, const DWARFSection *AOS,
154  const DWARFSection &LS, bool LE, bool IsDWO, bool Lazy,
155  DWARFSectionKind SectionKind);
156 };
157 
158 /// Represents base address of the CU.
159 struct BaseAddress {
160  uint64_t Address;
161  uint64_t SectionIndex;
162 };
163 
164 /// Represents a unit's contribution to the string offsets table.
166  uint64_t Base = 0;
167  /// The contribution size not including the header.
168  uint64_t Size = 0;
169  /// Format and version.
171 
172  StrOffsetsContributionDescriptor(uint64_t Base, uint64_t Size,
174  : Base(Base), Size(Size), FormParams({Version, 0, Format}) {}
175 
176  uint8_t getVersion() const { return FormParams.Version; }
177  dwarf::DwarfFormat getFormat() const { return FormParams.Format; }
178  uint8_t getDwarfOffsetByteSize() const {
179  return FormParams.getDwarfOffsetByteSize();
180  }
181  /// Determine whether a contribution to the string offsets table is
182  /// consistent with the relevant section size and that its length is
183  /// a multiple of the size of one of its entries.
185  validateContributionSize(DWARFDataExtractor &DA);
186 };
187 
188 class DWARFUnit {
190  /// Section containing this DWARFUnit.
191  const DWARFSection &InfoSection;
192 
193  DWARFUnitHeader Header;
194  const DWARFDebugAbbrev *Abbrev;
195  const DWARFSection *RangeSection;
196  uint32_t RangeSectionBase;
197  const DWARFSection &LineSection;
198  StringRef StringSection;
199  const DWARFSection &StringOffsetSection;
200  const DWARFSection *AddrOffsetSection;
201  uint32_t AddrOffsetSectionBase = 0;
202  bool isLittleEndian;
203  bool isDWO;
204  const DWARFUnitVector &UnitVector;
205 
206  /// Start, length, and DWARF format of the unit's contribution to the string
207  /// offsets table (DWARF v5).
208  Optional<StrOffsetsContributionDescriptor> StringOffsetsTableContribution;
209 
210  /// A table of range lists (DWARF v5 and later).
212 
213  mutable const DWARFAbbreviationDeclarationSet *Abbrevs;
215  /// The compile unit debug information entry items.
216  std::vector<DWARFDebugInfoEntry> DieArray;
217 
218  /// Map from range's start address to end address and corresponding DIE.
219  /// IntervalMap does not support range removal, as a result, we use the
220  /// std::map::upper_bound for address range lookup.
221  std::map<uint64_t, std::pair<uint64_t, DWARFDie>> AddrDieMap;
222 
223  using die_iterator_range =
225 
226  std::shared_ptr<DWARFUnit> DWO;
227 
228  uint32_t getDIEIndex(const DWARFDebugInfoEntry *Die) {
229  auto First = DieArray.data();
230  assert(Die >= First && Die < First + DieArray.size());
231  return Die - First;
232  }
233 
234 protected:
235  const DWARFUnitHeader &getHeader() const { return Header; }
236 
237  /// Size in bytes of the parsed unit header.
238  uint32_t getHeaderSize() const { return Header.getSize(); }
239 
240  /// Find the unit's contribution to the string offsets table and determine its
241  /// length and form. The given offset is expected to be derived from the unit
242  /// DIE's DW_AT_str_offsets_base attribute.
244  determineStringOffsetsTableContribution(DWARFDataExtractor &DA,
245  uint64_t Offset);
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 0 in a dwo file or,
249  /// in a dwp file, the start of the unit's contribution to the string offsets
250  /// table section (as determined by the index table).
252  determineStringOffsetsTableContributionDWO(DWARFDataExtractor &DA,
253  uint64_t Offset);
254 
255 public:
256  DWARFUnit(DWARFContext &Context, const DWARFSection &Section,
257  const DWARFUnitHeader &Header,
258  const DWARFDebugAbbrev *DA, const DWARFSection *RS, StringRef SS,
259  const DWARFSection &SOS, const DWARFSection *AOS,
260  const DWARFSection &LS, bool LE, bool IsDWO,
261  const DWARFUnitVector &UnitVector);
262 
263  virtual ~DWARFUnit();
264 
265  DWARFContext& getContext() const { return Context; }
266  const DWARFSection &getInfoSection() const { return InfoSection; }
267  uint32_t getOffset() const { return Header.getOffset(); }
269  return Header.getFormParams();
270  }
271  uint16_t getVersion() const { return Header.getVersion(); }
272  uint8_t getAddressByteSize() const { return Header.getAddressByteSize(); }
273  uint8_t getRefAddrByteSize() const { return Header.getRefAddrByteSize(); }
274  uint8_t getDwarfOffsetByteSize() const {
275  return Header.getDwarfOffsetByteSize();
276  }
277  uint32_t getLength() const { return Header.getLength(); }
278  uint8_t getUnitType() const { return Header.getUnitType(); }
279  bool isTypeUnit() const { return Header.isTypeUnit(); }
280  uint32_t getNextUnitOffset() const { return Header.getNextUnitOffset(); }
281  const DWARFSection &getLineSection() const { return LineSection; }
282  StringRef getStringSection() const { return StringSection; }
284  return StringOffsetSection;
285  }
286 
288  AddrOffsetSection = AOS;
289  AddrOffsetSectionBase = Base;
290  }
291 
292  /// Recursively update address to Die map.
293  void updateAddressDieMap(DWARFDie Die);
294 
296  RangeSection = RS;
297  RangeSectionBase = Base;
298  }
299 
300  bool getAddrOffsetSectionItem(uint32_t Index, uint64_t &Result) const;
301  bool getStringOffsetSectionItem(uint32_t Index, uint64_t &Result) const;
302 
303  DWARFDataExtractor getDebugInfoExtractor() const;
304 
306  return DataExtractor(StringSection, false, 0);
307  }
308 
309  /// Extract the range list referenced by this compile unit from the
310  /// .debug_ranges section. If the extraction is unsuccessful, an error
311  /// is returned. Successful extraction requires that the compile unit
312  /// has already been extracted.
313  Error extractRangeList(uint32_t RangeListOffset,
314  DWARFDebugRangeList &RangeList) const;
315  void clear();
316 
319  return StringOffsetsTableContribution;
320  }
321 
323  assert(StringOffsetsTableContribution);
324  return StringOffsetsTableContribution->getDwarfOffsetByteSize();
325  }
326 
327  uint64_t getStringOffsetsBase() const {
328  assert(StringOffsetsTableContribution);
329  return StringOffsetsTableContribution->Base;
330  }
331 
332  const DWARFAbbreviationDeclarationSet *getAbbreviations() const;
333 
334  static bool isMatchingUnitTypeAndTag(uint8_t UnitType, dwarf::Tag Tag) {
335  switch (UnitType) {
336  case dwarf::DW_UT_compile:
337  return Tag == dwarf::DW_TAG_compile_unit;
338  case dwarf::DW_UT_type:
339  return Tag == dwarf::DW_TAG_type_unit;
340  case dwarf::DW_UT_partial:
341  return Tag == dwarf::DW_TAG_partial_unit;
342  case dwarf::DW_UT_skeleton:
343  return Tag == dwarf::DW_TAG_skeleton_unit;
344  case dwarf::DW_UT_split_compile:
345  case dwarf::DW_UT_split_type:
346  return dwarf::isUnitType(Tag);
347  }
348  return false;
349  }
350 
351  /// Return the number of bytes for the header of a unit of
352  /// UnitType type.
353  ///
354  /// This function must be called with a valid unit type which in
355  /// DWARF5 is defined as one of the following six types.
356  static uint32_t getDWARF5HeaderSize(uint8_t UnitType) {
357  switch (UnitType) {
358  case dwarf::DW_UT_compile:
359  case dwarf::DW_UT_partial:
360  return 12;
361  case dwarf::DW_UT_skeleton:
362  case dwarf::DW_UT_split_compile:
363  return 20;
364  case dwarf::DW_UT_type:
365  case dwarf::DW_UT_split_type:
366  return 24;
367  }
368  llvm_unreachable("Invalid UnitType.");
369  }
370 
371  llvm::Optional<BaseAddress> getBaseAddress();
372 
373  DWARFDie getUnitDIE(bool ExtractUnitDIEOnly = true) {
374  extractDIEsIfNeeded(ExtractUnitDIEOnly);
375  if (DieArray.empty())
376  return DWARFDie();
377  return DWARFDie(this, &DieArray[0]);
378  }
379 
380  const char *getCompilationDir();
382  extractDIEsIfNeeded(/*CUDieOnly*/ true);
383  return getHeader().getDWOId();
384  }
385  void setDWOId(uint64_t NewID) { Header.setDWOId(NewID); }
386 
387  /// Return a vector of address ranges resulting from a (possibly encoded)
388  /// range list starting at a given offset in the appropriate ranges section.
389  Expected<DWARFAddressRangesVector> findRnglistFromOffset(uint32_t Offset);
390 
391  /// Return a vector of address ranges retrieved from an encoded range
392  /// list whose offset is found via a table lookup given an index (DWARF v5
393  /// and later).
394  Expected<DWARFAddressRangesVector> findRnglistFromIndex(uint32_t Index);
395 
396  /// Return a rangelist's offset based on an index. The index designates
397  /// an entry in the rangelist table's offset array and is supplied by
398  /// DW_FORM_rnglistx.
400  if (RngListTable)
401  return RngListTable->getOffsetEntry(Index);
402  return None;
403  }
404 
405  void collectAddressRanges(DWARFAddressRangesVector &CURanges);
406 
407  /// Returns subprogram DIE with address range encompassing the provided
408  /// address. The pointer is alive as long as parsed compile unit DIEs are not
409  /// cleared.
410  DWARFDie getSubroutineForAddress(uint64_t Address);
411 
412  /// getInlinedChainForAddress - fetches inlined chain for a given address.
413  /// Returns empty chain if there is no subprogram containing address. The
414  /// chain is valid as long as parsed compile unit DIEs are not cleared.
415  void getInlinedChainForAddress(uint64_t Address,
416  SmallVectorImpl<DWARFDie> &InlinedChain);
417 
418  /// Return the DWARFUnitVector containing this unit.
419  const DWARFUnitVector &getUnitVector() const { return UnitVector; }
420 
421  /// Returns the number of DIEs in the unit. Parses the unit
422  /// if necessary.
423  unsigned getNumDIEs() {
424  extractDIEsIfNeeded(false);
425  return DieArray.size();
426  }
427 
428  /// Return the index of a DIE inside the unit's DIE vector.
429  ///
430  /// It is illegal to call this method with a DIE that hasn't be
431  /// created by this unit. In other word, it's illegal to call this
432  /// method on a DIE that isn't accessible by following
433  /// children/sibling links starting from this unit's getUnitDIE().
435  return getDIEIndex(D.getDebugInfoEntry());
436  }
437 
438  /// Return the DIE object at the given index.
439  DWARFDie getDIEAtIndex(unsigned Index) {
440  assert(Index < DieArray.size());
441  return DWARFDie(this, &DieArray[Index]);
442  }
443 
445  DWARFDie getSibling(const DWARFDebugInfoEntry *Die);
446  DWARFDie getPreviousSibling(const DWARFDebugInfoEntry *Die);
447  DWARFDie getFirstChild(const DWARFDebugInfoEntry *Die);
448  DWARFDie getLastChild(const DWARFDebugInfoEntry *Die);
449 
450  /// Return the DIE object for a given offset inside the
451  /// unit's DIE vector.
452  ///
453  /// The unit needs to have its DIEs extracted for this method to work.
455  extractDIEsIfNeeded(false);
456  assert(!DieArray.empty());
457  auto it = std::lower_bound(
458  DieArray.begin(), DieArray.end(), Offset,
459  [](const DWARFDebugInfoEntry &LHS, uint32_t Offset) {
460  return LHS.getOffset() < Offset;
461  });
462  if (it != DieArray.end() && it->getOffset() == Offset)
463  return DWARFDie(this, &*it);
464  return DWARFDie();
465  }
466 
468  if (auto IndexEntry = Header.getIndexEntry())
469  if (const auto *Contrib = IndexEntry->getOffset(DW_SECT_LINE))
470  return Contrib->Offset;
471  return 0;
472  }
473 
475  extractDIEsIfNeeded(false);
476  return die_iterator_range(DieArray.begin(), DieArray.end());
477  }
478 
479  virtual void dump(raw_ostream &OS, DIDumpOptions DumpOpts) = 0;
480 private:
481  /// Size in bytes of the .debug_info data associated with this compile unit.
482  size_t getDebugInfoSize() const {
483  return Header.getLength() + 4 - getHeaderSize();
484  }
485 
486  /// extractDIEsIfNeeded - Parses a compile unit and indexes its DIEs if it
487  /// hasn't already been done. Returns the number of DIEs parsed at this call.
488  size_t extractDIEsIfNeeded(bool CUDieOnly);
489 
490  /// extractDIEsToVector - Appends all parsed DIEs to a vector.
491  void extractDIEsToVector(bool AppendCUDie, bool AppendNonCUDIEs,
492  std::vector<DWARFDebugInfoEntry> &DIEs) const;
493 
494  /// clearDIEs - Clear parsed DIEs to keep memory usage low.
495  void clearDIEs(bool KeepCUDie);
496 
497  /// parseDWO - Parses .dwo file for current compile unit. Returns true if
498  /// it was actually constructed.
499  bool parseDWO();
500 };
501 
502 } // end namespace llvm
503 
504 #endif // LLVM_DEBUGINFO_DWARF_DWARFUNIT_H
static bool isMatchingUnitTypeAndTag(uint8_t UnitType, dwarf::Tag Tag)
Definition: DWARFUnit.h:334
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:494
LLVMContext & Context
Compute iterated dominance frontiers using a linear time algorithm.
Definition: AllocatorList.h:24
Represents a unit&#39;s contribution to the string offsets table.
Definition: DWARFUnit.h:165
bool isUnitType(uint8_t UnitType)
Definition: Dwarf.h:341
bool isTypeUnit() const
Definition: DWARFUnit.h:279
This provides a very simple, boring adaptor for a begin and end iterator into a range type...
uint8_t getDwarfOffsetByteSize() const
Definition: DWARFUnit.h:82
uint8_t getRefAddrByteSize() const
The definition of the size of form DW_FORM_ref_addr depends on the version.
Definition: Dwarf.h:502
void setAddrOffsetSection(const DWARFSection *AOS, uint32_t Base)
Definition: DWARFUnit.h:287
const Optional< StrOffsetsContributionDescriptor > & getStringOffsetsTableContribution() const
Definition: DWARFUnit.h:318
unsigned getNumUnits() const
Returns number of all units held by this instance.
Definition: DWARFUnit.h:138
uint8_t getRefAddrByteSize() const
Definition: DWARFUnit.h:273
dwarf::DwarfFormat getFormat() const
Definition: DWARFUnit.h:177
uint8_t getDwarfStringOffsetsByteSize() const
Definition: DWARFUnit.h:322
const DWARFSection & getInfoSection() const
Definition: DWARFUnit.h:266
const dwarf::FormParams & getFormParams() const
Definition: DWARFUnit.h:268
uint32_t getOffset() const
Definition: DWARFUnit.h:76
uint32_t getNextUnitOffset() const
Definition: DWARFUnit.h:280
Optional< uint64_t > getDWOId() const
Definition: DWARFUnit.h:87
uint16_t getVersion() const
Definition: DWARFUnit.h:78
DwarfFormat
Constants that define the DWARF format as 32 or 64 bit.
Definition: Dwarf.h:65
uint64_t getAbbrOffset() const
Definition: DWARFUnit.h:86
const DWARFSection & getLineSection() const
Definition: DWARFUnit.h:281
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:96
uint8_t getAddressByteSize() const
Definition: DWARFUnit.h:272
unsigned getNumDIEs()
Returns the number of DIEs in the unit.
Definition: DWARFUnit.h:423
uint64_t Address
Definition: DWARFUnit.h:160
uint32_t getTypeOffset() const
Definition: DWARFUnit.h:94
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:1138
void setDWOId(uint64_t NewID)
Definition: DWARFUnit.h:385
const DWARFSection & getStringOffsetSection() const
Definition: DWARFUnit.h:283
uint16_t getVersion() const
Definition: DWARFUnit.h:271
Container for dump options that control which debug information will be dumped.
Definition: DIContext.h:154
die_iterator_range dies()
Definition: DWARFUnit.h:474
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
uint8_t getUnitType() const
Definition: DWARFUnit.h:95
Optional< uint64_t > getDWOId()
Definition: DWARFUnit.h:381
static uint32_t getDWARF5HeaderSize(uint8_t UnitType)
Return the number of bytes for the header of a unit of UnitType type.
Definition: DWARFUnit.h:356
uint32_t getLength() const
Definition: DWARFUnit.h:85
StringRef getStringSection() const
Definition: DWARFUnit.h:282
uint32_t getDIEIndex(const DWARFDie &D)
Return the index of a DIE inside the unit&#39;s DIE vector.
Definition: DWARFUnit.h:434
SectionKind - This is a simple POD value that classifies the properties of a section.
Definition: SectionKind.h:23
DWARFContext & getContext() const
Definition: DWARFUnit.h:265
void setRangesSection(const DWARFSection *RS, uint32_t Base)
Definition: DWARFUnit.h:295
bool extract(DWARFContext &Context, const DWARFDataExtractor &debug_info, uint32_t *offset_ptr, DWARFSectionKind Kind=DW_SECT_INFO, const DWARFUnitIndex *Index=nullptr)
Parse a unit header from debug_info starting at offset_ptr.
Definition: DWARFUnit.cpp:202
uint32_t getHeaderSize() const
Size in bytes of the parsed unit header.
Definition: DWARFUnit.h:238
typename UnitVector::iterator iterator
Definition: DWARFUnit.h:117
const dwarf::FormParams & getFormParams() const
Definition: DWARFUnit.h:77
const DWARFUnitIndex & getDWARFUnitIndex(DWARFContext &Context, DWARFSectionKind Kind)
Definition: DWARFUnit.cpp:644
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:172
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
uint8_t getAddressByteSize() const
Definition: DWARFUnit.h:80
dwarf::DwarfFormat getFormat() const
Definition: DWARFUnit.h:79
uint64_t SectionIndex
Definition: DWARFUnit.h:161
const DWARFUnitVector & getUnitVector() const
Return the DWARFUnitVector containing this unit.
Definition: DWARFUnit.h:419
uint64_t getTypeHash() const
Definition: DWARFUnit.h:93
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:327
DWARFDie getUnitDIE(bool ExtractUnitDIEOnly=true)
Definition: DWARFUnit.h:373
void setDWOId(uint64_t Id)
Definition: DWARFUnit.h:88
const DWARFUnitIndex::Entry * getIndexEntry() const
Definition: DWARFUnit.h:92
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:1023
Represents base address of the CU.
Definition: DWARFUnit.h:159
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:109
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:277
static void clear(coro::Shape &Shape)
Definition: Coroutines.cpp:212
uint32_t getNextUnitOffset() const
Definition: DWARFUnit.h:101
DataExtractor getStringExtractor() const
Definition: DWARFUnit.h:305
void finishedInfoUnits()
Indicate that parsing .debug_info[.dwo] is done, and remaining units will be from ...
Definition: DWARFUnit.h:147
DWARFDie getDIEAtIndex(unsigned Index)
Return the DIE object at the given index.
Definition: DWARFUnit.h:439
uint8_t getRefAddrByteSize() const
Definition: DWARFUnit.h:81
uint32_t getOffset() const
Definition: DWARFUnit.h:267
uint8_t getSize() const
Definition: DWARFUnit.h:99
const unsigned Kind
uint8_t getUnitType() const
Definition: DWARFUnit.h:278
DWARFDie getDIEForOffset(uint32_t Offset)
Return the DIE object for a given offset inside the unit&#39;s DIE vector.
Definition: DWARFUnit.h:454
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
DwarfFormat Format
Definition: Dwarf.h:497
const DWARFUnitHeader & getHeader() const
Definition: DWARFUnit.h:235
std::vector< DWARFAddressRange > DWARFAddressRangesVector
DWARFAddressRangesVector - represents a set of absolute address ranges.
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:144
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:509
Optional< uint32_t > getRnglistOffset(uint32_t Index)
Return a rangelist&#39;s offset based on an index.
Definition: DWARFUnit.h:399
const uint64_t Version
Definition: InstrProf.h:895
uint8_t getDwarfOffsetByteSize() const
Definition: DWARFUnit.h:274
uint32_t getLineTableOffset() const
Definition: DWARFUnit.h:467
unsigned getNumInfoUnits() const
Returns number of units from all .debug_info[.dwo] sections.
Definition: DWARFUnit.h:140