llvm.org GIT mirror llvm / 7d82b42
DWARFUnit: kill dead code and make a couple of functions private. No functionality change. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193780 91177308-0d34-0410-b5e6-96231b3b80d8 Alexey Samsonov 5 years ago
2 changed file(s) with 7 addition(s) and 38 deletion(s). Raw diff Collapse all Expand all
8282 }
8383
8484 return false;
85 }
86
87 uint32_t
88 DWARFUnit::extract(uint32_t offset, DataExtractor debug_info_data,
89 const DWARFAbbreviationDeclarationSet *abbrevs) {
90 clear();
91
92 Offset = offset;
93
94 if (debug_info_data.isValidOffset(offset)) {
95 Length = debug_info_data.getU32(&offset);
96 Version = debug_info_data.getU16(&offset);
97 bool abbrevsOK = debug_info_data.getU32(&offset) == abbrevs->getOffset();
98 Abbrevs = abbrevs;
99 AddrSize = debug_info_data.getU8(&offset);
100
101 bool versionOK = DWARFContext::isSupportedVersion(Version);
102 bool addrSizeOK = AddrSize == 4 || AddrSize == 8;
103
104 if (versionOK && addrSizeOK && abbrevsOK &&
105 debug_info_data.isValidOffset(offset))
106 return offset;
107 }
108 return 0;
10985 }
11086
11187 bool DWARFUnit::extractRangeList(uint32_t RangeListOffset,
9494 const RelocAddrMap *getRelocMap() const { return RelocMap; }
9595
9696 bool extract(DataExtractor debug_info, uint32_t* offset_ptr);
97 uint32_t extract(uint32_t offset, DataExtractor debug_info_data,
98 const DWARFAbbreviationDeclarationSet *abbrevs);
9997
100 /// extractDIEsIfNeeded - Parses a compile unit and indexes its DIEs if it
101 /// hasn't already been done. Returns the number of DIEs parsed at this call.
102 size_t extractDIEsIfNeeded(bool CUDieOnly);
10398 /// extractRangeList - extracts the range list referenced by this compile
10499 /// unit from .debug_ranges section. Returns true on success.
105100 /// Requires that compile unit is already extracted.
109104 uint32_t getOffset() const { return Offset; }
110105 /// Size in bytes of the compile unit header.
111106 virtual uint32_t getSize() const { return 11; }
112 bool containsDIEOffset(uint32_t die_offset) const {
113 return die_offset >= getFirstDIEOffset() &&
114 die_offset < getNextUnitOffset();
115 }
116107 uint32_t getFirstDIEOffset() const { return Offset + getSize(); }
117108 uint32_t getNextUnitOffset() const { return Offset + Length + 4; }
118109 /// Size in bytes of the .debug_info data associated with this compile unit.
138129 const char *getCompilationDir();
139130 uint64_t getDWOId();
140131
141 /// setDIERelations - We read in all of the DIE entries into our flat list
142 /// of DIE entries and now we need to go back through all of them and set the
143 /// parent, sibling and child pointers for quick DIE navigation.
144 void setDIERelations();
145
146132 void buildAddressRangeTable(DWARFDebugAranges *debug_aranges,
147133 bool clear_dies_if_already_not_parsed,
148134 uint32_t CUOffsetInAranges);
153139 DWARFDebugInfoEntryInlinedChain getInlinedChainForAddress(uint64_t Address);
154140
155141 private:
142 /// extractDIEsIfNeeded - Parses a compile unit and indexes its DIEs if it
143 /// hasn't already been done. Returns the number of DIEs parsed at this call.
144 size_t extractDIEsIfNeeded(bool CUDieOnly);
156145 /// extractDIEsToVector - Appends all parsed DIEs to a vector.
157146 void extractDIEsToVector(bool AppendCUDie, bool AppendNonCUDIEs,
158147 std::vector &DIEs) const;
148 /// setDIERelations - We read in all of the DIE entries into our flat list
149 /// of DIE entries and now we need to go back through all of them and set the
150 /// parent, sibling and child pointers for quick DIE navigation.
151 void setDIERelations();
159152 /// clearDIEs - Clear parsed DIEs to keep memory usage low.
160153 void clearDIEs(bool KeepCUDie);
161154