mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-14 11:32:34 +00:00
Add DWARFUnit::getNumDIEs() and getDIEIndex()
Parsed DIEs are stored in a vector and that makes it easy to get their indices. Having easy access to a DIE's index makes it possible to use arrays or vectors to efficiently store/access DIE related information. There's no test for that new functionality (I don't see how to test it standalone), but it'll be used in a subsequent dsymutil commit. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@227381 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
24373e35a4
commit
33c9f17f2c
@ -213,6 +213,26 @@ public:
|
|||||||
/// getUnitSection - Return the DWARFUnitSection containing this unit.
|
/// getUnitSection - Return the DWARFUnitSection containing this unit.
|
||||||
const DWARFUnitSectionBase &getUnitSection() const { return UnitSection; }
|
const DWARFUnitSectionBase &getUnitSection() const { return UnitSection; }
|
||||||
|
|
||||||
|
/// \brief Returns the number of DIEs in the unit. Parses the unit
|
||||||
|
/// if necessary.
|
||||||
|
unsigned getNumDIEs() {
|
||||||
|
extractDIEsIfNeeded(false);
|
||||||
|
return DieArray.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// \brief Return the index of a DIE inside the unit's DIE vector.
|
||||||
|
///
|
||||||
|
/// It is illegal to call this method with a DIE that hasn't be
|
||||||
|
/// created by this unit. In other word, it's illegal to call this
|
||||||
|
/// method on a DIE that isn't accessible by following
|
||||||
|
/// children/sibling links starting from this unit's
|
||||||
|
/// getCompileUnitDIE().
|
||||||
|
uint32_t getDIEIndex(const DWARFDebugInfoEntryMinimal *DIE) {
|
||||||
|
assert(!DieArray.empty() && DIE >= &DieArray[0] &&
|
||||||
|
DIE < &DieArray[0] + DieArray.size());
|
||||||
|
return DIE - &DieArray[0];
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/// Size in bytes of the .debug_info data associated with this compile unit.
|
/// Size in bytes of the .debug_info data associated with this compile unit.
|
||||||
size_t getDebugInfoSize() const { return Length + 4 - getHeaderSize(); }
|
size_t getDebugInfoSize() const { return Length + 4 - getHeaderSize(); }
|
||||||
|
Loading…
Reference in New Issue
Block a user