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