LLVM  15.0.0git
DWARFDie.h
Go to the documentation of this file.
1 //===- DWARFDie.h -----------------------------------------------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #ifndef LLVM_DEBUGINFO_DWARF_DWARFDIE_H
10 #define LLVM_DEBUGINFO_DWARF_DWARFDIE_H
11 
12 #include "llvm/ADT/ArrayRef.h"
13 #include "llvm/ADT/Optional.h"
14 #include "llvm/ADT/iterator.h"
22 #include <cassert>
23 #include <cstdint>
24 #include <iterator>
25 
26 namespace llvm {
27 
28 class DWARFUnit;
29 class raw_ostream;
30 
31 //===----------------------------------------------------------------------===//
32 /// Utility class that carries the DWARF compile/type unit and the debug info
33 /// entry in an object.
34 ///
35 /// When accessing information from a debug info entry we always need to DWARF
36 /// compile/type unit in order to extract the info correctly as some information
37 /// is relative to the compile/type unit. Prior to this class the DWARFUnit and
38 /// the DWARFDebugInfoEntry was passed around separately and there was the
39 /// possibility for error if the wrong DWARFUnit was used to extract a unit
40 /// relative offset. This class helps to ensure that this doesn't happen and
41 /// also simplifies the attribute extraction calls by not having to specify the
42 /// DWARFUnit for each call.
43 class DWARFDie {
44  DWARFUnit *U = nullptr;
45  const DWARFDebugInfoEntry *Die = nullptr;
46 
47 public:
48  DWARFDie() = default;
49  DWARFDie(DWARFUnit *Unit, const DWARFDebugInfoEntry *D) : U(Unit), Die(D) {}
50 
51  bool isValid() const { return U && Die; }
52  explicit operator bool() const { return isValid(); }
53  const DWARFDebugInfoEntry *getDebugInfoEntry() const { return Die; }
54  DWARFUnit *getDwarfUnit() const { return U; }
55 
56  /// Get the abbreviation declaration for this DIE.
57  ///
58  /// \returns the abbreviation declaration or NULL for null tags.
60  assert(isValid() && "must check validity prior to calling");
61  return Die->getAbbreviationDeclarationPtr();
62  }
63 
64  /// Get the absolute offset into the debug info or types section.
65  ///
66  /// \returns the DIE offset or -1U if invalid.
67  uint64_t getOffset() const {
68  assert(isValid() && "must check validity prior to calling");
69  return Die->getOffset();
70  }
71 
72  dwarf::Tag getTag() const {
73  auto AbbrevDecl = getAbbreviationDeclarationPtr();
74  if (AbbrevDecl)
75  return AbbrevDecl->getTag();
76  return dwarf::DW_TAG_null;
77  }
78 
79  bool hasChildren() const {
80  assert(isValid() && "must check validity prior to calling");
81  return Die->hasChildren();
82  }
83 
84  /// Returns true for a valid DIE that terminates a sibling chain.
85  bool isNULL() const { return getAbbreviationDeclarationPtr() == nullptr; }
86 
87  /// Returns true if DIE represents a subprogram (not inlined).
88  bool isSubprogramDIE() const;
89 
90  /// Returns true if DIE represents a subprogram or an inlined subroutine.
91  bool isSubroutineDIE() const;
92 
93  /// Get the parent of this DIE object.
94  ///
95  /// \returns a valid DWARFDie instance if this object has a parent or an
96  /// invalid DWARFDie instance if it doesn't.
97  DWARFDie getParent() const;
98 
99  /// Get the sibling of this DIE object.
100  ///
101  /// \returns a valid DWARFDie instance if this object has a sibling or an
102  /// invalid DWARFDie instance if it doesn't.
103  DWARFDie getSibling() const;
104 
105  /// Get the previous sibling of this DIE object.
106  ///
107  /// \returns a valid DWARFDie instance if this object has a sibling or an
108  /// invalid DWARFDie instance if it doesn't.
110 
111  /// Get the first child of this DIE object.
112  ///
113  /// \returns a valid DWARFDie instance if this object has children or an
114  /// invalid DWARFDie instance if it doesn't.
115  DWARFDie getFirstChild() const;
116 
117  /// Get the last child of this DIE object.
118  ///
119  /// \returns a valid null DWARFDie instance if this object has children or an
120  /// invalid DWARFDie instance if it doesn't.
121  DWARFDie getLastChild() const;
122 
123  /// Dump the DIE and all of its attributes to the supplied stream.
124  ///
125  /// \param OS the stream to use for output.
126  /// \param indent the number of characters to indent each line that is output.
127  void dump(raw_ostream &OS, unsigned indent = 0,
128  DIDumpOptions DumpOpts = DIDumpOptions()) const;
129 
130  /// Convenience zero-argument overload for debugging.
131  LLVM_DUMP_METHOD void dump() const;
132 
133  /// Extract the specified attribute from this DIE.
134  ///
135  /// Extract an attribute value from this DIE only. This call doesn't look
136  /// for the attribute value in any DW_AT_specification or
137  /// DW_AT_abstract_origin referenced DIEs.
138  ///
139  /// \param Attr the attribute to extract.
140  /// \returns an optional DWARFFormValue that will have the form value if the
141  /// attribute was successfully extracted.
143 
144  /// Extract the first value of any attribute in Attrs from this DIE.
145  ///
146  /// Extract the first attribute that matches from this DIE only. This call
147  /// doesn't look for the attribute value in any DW_AT_specification or
148  /// DW_AT_abstract_origin referenced DIEs. The attributes will be searched
149  /// linearly in the order they are specified within Attrs.
150  ///
151  /// \param Attrs an array of DWARF attribute to look for.
152  /// \returns an optional that has a valid DWARFFormValue for the first
153  /// matching attribute in Attrs, or None if none of the attributes in Attrs
154  /// exist in this DIE.
156 
157  /// Extract the first value of any attribute in Attrs from this DIE and
158  /// recurse into any DW_AT_specification or DW_AT_abstract_origin referenced
159  /// DIEs.
160  ///
161  /// \param Attrs an array of DWARF attribute to look for.
162  /// \returns an optional that has a valid DWARFFormValue for the first
163  /// matching attribute in Attrs, or None if none of the attributes in Attrs
164  /// exist in this DIE or in any DW_AT_specification or DW_AT_abstract_origin
165  /// DIEs.
168 
169  /// Extract the specified attribute from this DIE as the referenced DIE.
170  ///
171  /// Regardless of the reference type, return the correct DWARFDie instance if
172  /// the attribute exists. The returned DWARFDie object might be from another
173  /// DWARFUnit, but that is all encapsulated in the new DWARFDie object.
174  ///
175  /// Extract an attribute value from this DIE only. This call doesn't look
176  /// for the attribute value in any DW_AT_specification or
177  /// DW_AT_abstract_origin referenced DIEs.
178  ///
179  /// \param Attr the attribute to extract.
180  /// \returns a valid DWARFDie instance if the attribute exists, or an invalid
181  /// DWARFDie object if it doesn't.
184 
186 
187  /// Extract the range base attribute from this DIE as absolute section offset.
188  ///
189  /// This is a utility function that checks for either the DW_AT_rnglists_base
190  /// or DW_AT_GNU_ranges_base attribute.
191  ///
192  /// \returns anm optional absolute section offset value for the attribute.
195 
196  /// Get the DW_AT_high_pc attribute value as an address.
197  ///
198  /// In DWARF version 4 and later the high PC can be encoded as an offset from
199  /// the DW_AT_low_pc. This function takes care of extracting the value as an
200  /// address or offset and adds it to the low PC if needed and returns the
201  /// value as an optional in case the DIE doesn't have a DW_AT_high_pc
202  /// attribute.
203  ///
204  /// \param LowPC the low PC that might be needed to calculate the high PC.
205  /// \returns an optional address value for the attribute.
207 
208  /// Retrieves DW_AT_low_pc and DW_AT_high_pc from CU.
209  /// Returns true if both attributes are present.
210  bool getLowAndHighPC(uint64_t &LowPC, uint64_t &HighPC,
211  uint64_t &SectionIndex) const;
212 
213  /// Get the address ranges for this DIE.
214  ///
215  /// Get the hi/low PC range if both attributes are available or exrtracts the
216  /// non-contiguous address ranges from the DW_AT_ranges attribute.
217  ///
218  /// Extracts the range information from this DIE only. This call doesn't look
219  /// for the range in any DW_AT_specification or DW_AT_abstract_origin DIEs.
220  ///
221  /// \returns a address range vector that might be empty if no address range
222  /// information is available.
224 
225  bool addressRangeContainsAddress(const uint64_t Address) const;
226 
228  getLocations(dwarf::Attribute Attr) const;
229 
230  /// If a DIE represents a subprogram (or inlined subroutine), returns its
231  /// mangled name (or short name, if mangled is missing). This name may be
232  /// fetched from specification or abstract origin for this subprogram.
233  /// Returns null if no name is found.
234  const char *getSubroutineName(DINameKind Kind) const;
235 
236  /// Return the DIE name resolving DW_AT_specification or DW_AT_abstract_origin
237  /// references if necessary. For the LinkageName case it additionaly searches
238  /// for ShortName if LinkageName is not found.
239  /// Returns null if no name is found.
240  const char *getName(DINameKind Kind) const;
242  std::string *OriginalFullName = nullptr) const;
243 
244  /// Return the DIE short name resolving DW_AT_specification or
245  /// DW_AT_abstract_origin references if necessary. Returns null if no name
246  /// is found.
247  const char *getShortName() const;
248 
249  /// Return the DIE linkage name resolving DW_AT_specification or
250  /// DW_AT_abstract_origin references if necessary. Returns null if no name
251  /// is found.
252  const char *getLinkageName() const;
253 
254  /// Returns the declaration line (start line) for a DIE, assuming it specifies
255  /// a subprogram. This may be fetched from specification or abstract origin
256  /// for this subprogram by resolving DW_AT_sepcification or
257  /// DW_AT_abstract_origin references if necessary.
258  uint64_t getDeclLine() const;
260 
261  /// Retrieves values of DW_AT_call_file, DW_AT_call_line and DW_AT_call_column
262  /// from DIE (or zeroes if they are missing). This function looks for
263  /// DW_AT_call attributes in this DIE only, it will not resolve the attribute
264  /// values in any DW_AT_specification or DW_AT_abstract_origin DIEs.
265  /// \param CallFile filled in with non-zero if successful, zero if there is no
266  /// DW_AT_call_file attribute in this DIE.
267  /// \param CallLine filled in with non-zero if successful, zero if there is no
268  /// DW_AT_call_line attribute in this DIE.
269  /// \param CallColumn filled in with non-zero if successful, zero if there is
270  /// no DW_AT_call_column attribute in this DIE.
271  /// \param CallDiscriminator filled in with non-zero if successful, zero if
272  /// there is no DW_AT_GNU_discriminator attribute in this DIE.
273  void getCallerFrame(uint32_t &CallFile, uint32_t &CallLine,
274  uint32_t &CallColumn, uint32_t &CallDiscriminator) const;
275 
276  class attribute_iterator;
277 
278  /// Get an iterator range to all attributes in the current DIE only.
279  ///
280  /// \returns an iterator range for the attributes of the current DIE.
282 
283  /// Gets the type size (in bytes) for this DIE.
284  ///
285  /// \param PointerSize the pointer size of the containing CU.
286  /// \returns if this is a type DIE, or this DIE contains a DW_AT_type, returns
287  /// the size of the type.
289 
290  class iterator;
291 
292  iterator begin() const;
293  iterator end() const;
294 
295  std::reverse_iterator<iterator> rbegin() const;
296  std::reverse_iterator<iterator> rend() const;
297 
299 };
300 
302  : public iterator_facade_base<attribute_iterator, std::forward_iterator_tag,
303  const DWARFAttribute> {
304  /// The DWARF DIE we are extracting attributes from.
305  DWARFDie Die;
306  /// The value vended to clients via the operator*() or operator->().
307  DWARFAttribute AttrValue;
308  /// The attribute index within the abbreviation declaration in Die.
309  uint32_t Index;
310 
311  friend bool operator==(const attribute_iterator &LHS,
312  const attribute_iterator &RHS);
313 
314  /// Update the attribute index and attempt to read the attribute value. If the
315  /// attribute is able to be read, update AttrValue and the Index member
316  /// variable. If the attribute value is not able to be read, an appropriate
317  /// error will be set if the Err member variable is non-NULL and the iterator
318  /// will be set to the end value so iteration stops.
319  void updateForIndex(const DWARFAbbreviationDeclaration &AbbrDecl, uint32_t I);
320 
321 public:
322  attribute_iterator() = delete;
323  explicit attribute_iterator(DWARFDie D, bool End);
324 
327  explicit operator bool() const { return AttrValue.isValid(); }
328  const DWARFAttribute &operator*() const { return AttrValue; }
329 };
330 
333  return LHS.Index == RHS.Index;
334 }
335 
338  return !(LHS == RHS);
339 }
340 
341 inline bool operator==(const DWARFDie &LHS, const DWARFDie &RHS) {
342  return LHS.getDebugInfoEntry() == RHS.getDebugInfoEntry() &&
343  LHS.getDwarfUnit() == RHS.getDwarfUnit();
344 }
345 
346 inline bool operator!=(const DWARFDie &LHS, const DWARFDie &RHS) {
347  return !(LHS == RHS);
348 }
349 
350 inline bool operator<(const DWARFDie &LHS, const DWARFDie &RHS) {
351  return LHS.getOffset() < RHS.getOffset();
352 }
353 
355  : public iterator_facade_base<iterator, std::bidirectional_iterator_tag,
356  const DWARFDie> {
357  DWARFDie Die;
358 
360  friend bool operator==(const DWARFDie::iterator &LHS,
361  const DWARFDie::iterator &RHS);
362 
363 public:
364  iterator() = default;
365 
366  explicit iterator(DWARFDie D) : Die(D) {}
367 
369  Die = Die.getSibling();
370  return *this;
371  }
372 
374  Die = Die.getPreviousSibling();
375  return *this;
376  }
377 
378  const DWARFDie &operator*() const { return Die; }
379 };
380 
381 inline bool operator==(const DWARFDie::iterator &LHS,
382  const DWARFDie::iterator &RHS) {
383  return LHS.Die == RHS.Die;
384 }
385 
386 // These inline functions must follow the DWARFDie::iterator definition above
387 // as they use functions from that class.
389  return iterator(getFirstChild());
390 }
391 
393  return iterator(getLastChild());
394 }
395 
397  return make_range(begin(), end());
398 }
399 
400 } // end namespace llvm
401 
402 namespace std {
403 
404 template <>
405 class reverse_iterator<llvm::DWARFDie::iterator>
407  reverse_iterator<llvm::DWARFDie::iterator>,
408  bidirectional_iterator_tag, const llvm::DWARFDie> {
409 
410 private:
411  llvm::DWARFDie Die;
412  bool AtEnd;
413 
414 public:
416  : Die(It.Die), AtEnd(!It.Die.getPreviousSibling()) {
417  if (!AtEnd)
418  Die = Die.getPreviousSibling();
419  }
420 
422  return llvm::DWARFDie::iterator(AtEnd ? Die : Die.getSibling());
423  }
424 
426  assert(!AtEnd && "Incrementing rend");
428  if (D)
429  Die = D;
430  else
431  AtEnd = true;
432  return *this;
433  }
434 
436  if (AtEnd) {
437  AtEnd = false;
438  return *this;
439  }
440  Die = Die.getSibling();
441  assert(!Die.isNULL() && "Decrementing rbegin");
442  return *this;
443  }
444 
445  const llvm::DWARFDie &operator*() const {
446  assert(Die.isValid());
447  return Die;
448  }
449 
450  // FIXME: We should be able to specify the equals operator as a friend, but
451  // that causes the compiler to think the operator overload is ambiguous
452  // with the friend declaration and the actual definition as candidates.
454  return Die == RHS.Die && AtEnd == RHS.AtEnd;
455  }
456 };
457 
458 } // namespace std
459 
460 namespace llvm {
461 
462 inline bool operator==(const std::reverse_iterator<DWARFDie::iterator> &LHS,
463  const std::reverse_iterator<DWARFDie::iterator> &RHS) {
464  return LHS.equals(RHS);
465 }
466 
467 inline bool operator!=(const std::reverse_iterator<DWARFDie::iterator> &LHS,
468  const std::reverse_iterator<DWARFDie::iterator> &RHS) {
469  return !(LHS == RHS);
470 }
471 
472 inline std::reverse_iterator<DWARFDie::iterator> DWARFDie::rbegin() const {
473  return std::make_reverse_iterator(end());
474 }
475 
476 inline std::reverse_iterator<DWARFDie::iterator> DWARFDie::rend() const {
477  return std::make_reverse_iterator(begin());
478 }
479 
482  std::string *OriginalFullName = nullptr);
483 
484 } // end namespace llvm
485 
486 #endif // LLVM_DEBUGINFO_DWARF_DWARFDIE_H
llvm::DWARFDie::rend
std::reverse_iterator< iterator > rend() const
Definition: DWARFDie.h:476
Attrs
Function Attrs
Definition: README_ALTIVEC.txt:215
llvm::DWARFDie::DWARFDie
DWARFDie(DWARFUnit *Unit, const DWARFDebugInfoEntry *D)
Definition: DWARFDie.h:49
std::reverse_iterator< llvm::DWARFDie::iterator >::operator*
const llvm::DWARFDie & operator*() const
Definition: DWARFDie.h:445
DWARFAttribute.h
llvm::DWARFDie::isValid
bool isValid() const
Definition: DWARFDie.h:51
LLVM_DUMP_METHOD
#define LLVM_DUMP_METHOD
Mark debug helper function definitions like dump() that should not be stripped from debug builds.
Definition: Compiler.h:494
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:17
llvm::DWARFDie::getPreviousSibling
DWARFDie getPreviousSibling() const
Get the previous sibling of this DIE object.
Definition: DWARFDie.cpp:632
llvm::DWARFDie::getRangesBaseAttribute
Optional< uint64_t > getRangesBaseAttribute() const
Extract the range base attribute from this DIE as absolute section offset.
Definition: DWARFDie.cpp:333
llvm::make_range
iterator_range< T > make_range(T x, T y)
Convenience function for iterating over sub-ranges.
Definition: iterator_range.h:53
Optional.h
llvm::DWARFDie::getLinkageName
const char * getLinkageName() const
Return the DIE linkage name resolving DW_AT_specification or DW_AT_abstract_origin references if nece...
Definition: DWARFDie.cpp:458
llvm::DWARFDie::dump
LLVM_DUMP_METHOD void dump() const
Convenience zero-argument overload for debugging.
Definition: DWARFDie.cpp:618
llvm::DWARFDie::iterator::iterator
iterator()=default
llvm::DWARFDie::resolveTypeUnitReference
DWARFDie resolveTypeUnitReference() const
Definition: DWARFDie.cpp:322
llvm::raw_string_ostream
A raw_ostream that writes to an std::string.
Definition: raw_ostream.h:632
llvm::DWARFDie::getShortName
const char * getShortName() const
Return the DIE short name resolving DW_AT_specification or DW_AT_abstract_origin references if necess...
Definition: DWARFDie.cpp:451
llvm::DWARFDie::rbegin
std::reverse_iterator< iterator > rbegin() const
Definition: DWARFDie.h:472
llvm::DWARFDie::getAbbreviationDeclarationPtr
const DWARFAbbreviationDeclaration * getAbbreviationDeclarationPtr() const
Get the abbreviation declaration for this DIE.
Definition: DWARFDie.h:59
DWARFAddressRange.h
llvm::DWARFDie::attribute_iterator::operator==
friend bool operator==(const attribute_iterator &LHS, const attribute_iterator &RHS)
Definition: DWARFDie.h:331
llvm::operator!=
bool operator!=(uint64_t V1, const APInt &V2)
Definition: APInt.h:1992
llvm::Optional
Definition: APInt.h:33
llvm::DWARFDie::iterator::operator==
friend bool operator==(const DWARFDie::iterator &LHS, const DWARFDie::iterator &RHS)
Definition: DWARFDie.h:381
llvm::DWARFDie::addressRangeContainsAddress
bool addressRangeContainsAddress(const uint64_t Address) const
Definition: DWARFDie.cpp:390
llvm::DIE
A structured debug information entry.
Definition: DIE.h:739
llvm::Expected
Tagged union holding either a T or a Error.
Definition: APFloat.h:41
llvm::DWARFDebugInfoEntry::getAbbreviationDeclarationPtr
const DWARFAbbreviationDeclaration * getAbbreviationDeclarationPtr() const
Definition: DWARFDebugInfoEntry.h:72
llvm::DWARFDebugInfoEntry
DWARFDebugInfoEntry - A DIE with only the minimum required data.
Definition: DWARFDebugInfoEntry.h:22
llvm::DWARFDie::getDebugInfoEntry
const DWARFDebugInfoEntry * getDebugInfoEntry() const
Definition: DWARFDie.h:53
RHS
Value * RHS
Definition: X86PartialReduction.cpp:76
llvm::dwarf::Tag
Tag
Definition: Dwarf.h:105
llvm::DWARFDie::isNULL
bool isNULL() const
Returns true for a valid DIE that terminates a sibling chain.
Definition: DWARFDie.h:85
llvm::DWARFDie::children
iterator_range< iterator > children() const
Definition: DWARFDie.h:396
llvm::dwarf::Attribute
Attribute
Attributes.
Definition: Dwarf.h:125
std::reverse_iterator< llvm::DWARFDie::iterator >::operator++
reverse_iterator< llvm::DWARFDie::iterator > & operator++()
Definition: DWARFDie.h:425
llvm::DWARFDie::iterator::operator++
iterator & operator++()
Definition: DWARFDie.h:368
llvm::DWARFDie::getLastChild
DWARFDie getLastChild() const
Get the last child of this DIE object.
Definition: DWARFDie.cpp:644
LHS
Value * LHS
Definition: X86PartialReduction.cpp:75
llvm::DWARFAttribute
Encapsulates a DWARF attribute value and all of the data required to describe the attribute value.
Definition: DWARFAttribute.h:24
std::reverse_iterator< llvm::DWARFDie::iterator >::reverse_iterator
reverse_iterator(llvm::DWARFDie::iterator It)
Definition: DWARFDie.h:415
llvm::DINameKind
DINameKind
A DINameKind is passed to name search methods to specify a preference regarding the type of name reso...
Definition: DIContext.h:135
llvm::DWARFDie::end
iterator end() const
Definition: DWARFDie.h:392
llvm::DWARFDie::isSubroutineDIE
bool isSubroutineDIE() const
Returns true if DIE represents a subprogram or an inlined subroutine.
Definition: DWARFDie.cpp:240
llvm::DWARFDie::iterator::iterator
iterator(DWARFDie D)
Definition: DWARFDie.h:366
llvm::dwarf::Index
Index
Definition: Dwarf.h:472
llvm::DWARFDie::getCallerFrame
void getCallerFrame(uint32_t &CallFile, uint32_t &CallLine, uint32_t &CallColumn, uint32_t &CallDiscriminator) const
Retrieves values of DW_AT_call_file, DW_AT_call_line and DW_AT_call_column from DIE (or zeroes if the...
Definition: DWARFDie.cpp:479
llvm::DWARFDie::getDeclFile
std::string getDeclFile(DILineInfoSpecifier::FileLineInfoKind Kind) const
Definition: DWARFDie.cpp:472
llvm::raw_ostream
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition: raw_ostream.h:54
llvm::DWARFFormValue
Definition: DWARFFormValue.h:28
llvm::DWARFDie::attribute_iterator
Definition: DWARFDie.h:301
llvm::lltok::Kind
Kind
Definition: LLToken.h:18
llvm::DWARFDie::iterator
Definition: DWARFDie.h:354
std::reverse_iterator< llvm::DWARFDie::iterator >::operator--
reverse_iterator< llvm::DWARFDie::iterator > & operator--()
Definition: DWARFDie.h:435
uint64_t
D
static GCRegistry::Add< StatepointGC > D("statepoint-example", "an example strategy for statepoint")
llvm::DWARFDie::getDeclLine
uint64_t getDeclLine() const
Returns the declaration line (start line) for a DIE, assuming it specifies a subprogram.
Definition: DWARFDie.cpp:467
llvm::DWARFDie::iterator::operator--
iterator & operator--()
Definition: DWARFDie.h:373
llvm::DWARFDie::getAddressRanges
Expected< DWARFAddressRangesVector > getAddressRanges() const
Get the address ranges for this DIE.
Definition: DWARFDie.cpp:373
llvm::dumpTypeUnqualifiedName
void dumpTypeUnqualifiedName(const DWARFDie &DIE, raw_ostream &OS, std::string *OriginalFullName=nullptr)
Definition: DWARFDie.cpp:764
llvm::operator<
bool operator<(int64_t V1, const APSInt &V2)
Definition: APSInt.h:339
llvm::DWARFDebugInfoEntry::getOffset
uint64_t getOffset() const
Definition: DWARFDebugInfoEntry.h:45
iterator.h
I
#define I(x, y, z)
Definition: MD5.cpp:58
llvm::iterator_facade_base
CRTP base class which implements the entire standard iterator facade in terms of a minimal subset of ...
Definition: iterator.h:80
llvm::DWARFDie::find
Optional< DWARFFormValue > find(dwarf::Attribute Attr) const
Extract the specified attribute from this DIE.
Definition: DWARFDie.cpp:245
llvm::DWARFDie::getOffset
uint64_t getOffset() const
Get the absolute offset into the debug info or types section.
Definition: DWARFDie.h:67
llvm::DILineInfoSpecifier::FileLineInfoKind
FileLineInfoKind
Definition: DIContext.h:140
ArrayRef.h
llvm::DWARFDie::attribute_iterator::operator*
const DWARFAttribute & operator*() const
Definition: DWARFDie.h:328
assert
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
llvm::operator==
bool operator==(uint64_t V1, const APInt &V2)
Definition: APInt.h:1990
iterator_range.h
llvm::DWARFDie::findRecursively
Optional< DWARFFormValue > findRecursively(ArrayRef< dwarf::Attribute > Attrs) const
Extract the first value of any attribute in Attrs from this DIE and recurse into any DW_AT_specificat...
Definition: DWARFDie.cpp:269
llvm::DWARFDie::getLowAndHighPC
bool getLowAndHighPC(uint64_t &LowPC, uint64_t &HighPC, uint64_t &SectionIndex) const
Retrieves DW_AT_low_pc and DW_AT_high_pc from CU.
Definition: DWARFDie.cpp:358
std::reverse_iterator< llvm::DWARFDie::iterator >
Definition: DWARFDie.h:405
llvm::DWARFDie::getLocations
Expected< DWARFLocationExpressionsVector > getLocations(dwarf::Attribute Attr) const
Definition: DWARFDie.cpp:404
llvm::DWARFDie::DWARFDie
DWARFDie()=default
llvm::ArrayRef
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition: APInt.h:32
llvm::DWARFDie::hasChildren
bool hasChildren() const
Definition: DWARFDie.h:79
Dwarf.h
std::reverse_iterator< llvm::DWARFDie::iterator >::base
llvm::DWARFDie::iterator base() const
Definition: DWARFDie.h:421
llvm::DWARFDie::getDwarfUnit
DWARFUnit * getDwarfUnit() const
Definition: DWARFDie.h:54
uint32_t
llvm::DWARFDie::getName
const char * getName(DINameKind Kind) const
Return the DIE name resolving DW_AT_specification or DW_AT_abstract_origin references if necessary.
Definition: DWARFDie.cpp:440
DWARFDebugInfoEntry.h
llvm::DWARFDie::getLocBaseAttribute
Optional< uint64_t > getLocBaseAttribute() const
Definition: DWARFDie.cpp:337
llvm::DWARFDie::getSibling
DWARFDie getSibling() const
Get the sibling of this DIE object.
Definition: DWARFDie.cpp:626
DWARFLocationExpression.h
llvm::DWARFDie::attribute_iterator::operator++
attribute_iterator & operator++()
Definition: DWARFDie.cpp:696
llvm::DWARFAttribute::isValid
bool isValid() const
Definition: DWARFAttribute.h:34
llvm::DWARFDie::getParent
DWARFDie getParent() const
Get the parent of this DIE object.
Definition: DWARFDie.cpp:620
DIContext.h
std
Definition: BitVector.h:851
llvm::dumpTypeQualifiedName
void dumpTypeQualifiedName(const DWARFDie &DIE, raw_ostream &OS)
Definition: DWARFDie.cpp:760
llvm::DWARFAbbreviationDeclaration
Definition: DWARFAbbreviationDeclaration.h:27
llvm::DWARFUnit
Definition: DWARFUnit.h:207
llvm::DWARFDie::iterator::operator*
const DWARFDie & operator*() const
Definition: DWARFDie.h:378
llvm::DWARFDie::begin
iterator begin() const
Definition: DWARFDie.h:388
llvm::DWARFDie::getFullName
void getFullName(raw_string_ostream &, std::string *OriginalFullName=nullptr) const
Definition: DWARFDie.cpp:228
std::reverse_iterator< llvm::DWARFDie::iterator >::equals
bool equals(const reverse_iterator< llvm::DWARFDie::iterator > &RHS) const
Definition: DWARFDie.h:453
llvm::DWARFDie::getAttributeValueAsReferencedDie
DWARFDie getAttributeValueAsReferencedDie(dwarf::Attribute Attr) const
Extract the specified attribute from this DIE as the referenced DIE.
Definition: DWARFDie.cpp:302
llvm::DWARFDie::getTag
dwarf::Tag getTag() const
Definition: DWARFDie.h:72
llvm::DWARFDie::attributes
iterator_range< attribute_iterator > attributes() const
Get an iterator range to all attributes in the current DIE only.
Definition: DWARFDie.cpp:650
llvm::DWARFDie::getTypeSize
Optional< uint64_t > getTypeSize(uint64_t PointerSize)
Gets the type size (in bytes) for this DIE.
Definition: DWARFDie.cpp:488
llvm::iterator_range
A range adaptor for a pair of iterators.
Definition: iterator_range.h:30
llvm::DWARFDie::attribute_iterator::attribute_iterator
attribute_iterator()=delete
llvm::DWARFDie::attribute_iterator::operator--
attribute_iterator & operator--()
llvm::DWARFDie::getHighPC
Optional< uint64_t > getHighPC(uint64_t LowPC) const
Get the DW_AT_high_pc attribute value as an address.
Definition: DWARFDie.cpp:341
llvm::DWARFDie
Utility class that carries the DWARF compile/type unit and the debug info entry in an object.
Definition: DWARFDie.h:43
llvm::DWARFDie::isSubprogramDIE
bool isSubprogramDIE() const
Returns true if DIE represents a subprogram (not inlined).
Definition: DWARFDie.cpp:238
llvm::DWARFDebugInfoEntry::hasChildren
bool hasChildren() const
Definition: DWARFDebugInfoEntry.h:70
llvm::DWARFDie::getFirstChild
DWARFDie getFirstChild() const
Get the first child of this DIE object.
Definition: DWARFDie.cpp:638
llvm::DWARFDie::getSubroutineName
const char * getSubroutineName(DINameKind Kind) const
If a DIE represents a subprogram (or inlined subroutine), returns its mangled name (or short name,...
Definition: DWARFDie.cpp:434
llvm::DIDumpOptions
Container for dump options that control which debug information will be dumped.
Definition: DIContext.h:188