summaryrefslogtreecommitdiff
path: root/lib/DebugInfo
diff options
context:
space:
mode:
authorAlexey Samsonov <samsonov@google.com>2014-04-24 23:08:56 +0000
committerAlexey Samsonov <samsonov@google.com>2014-04-24 23:08:56 +0000
commit1749b55006758b2b29c422dbbc936fce495dd126 (patch)
treef6bb022753ccbfd36c84c99f3fa381689a84b46f /lib/DebugInfo
parenta189d1ad57e712ff20167269b9014241ed2d84be (diff)
downloadllvm-1749b55006758b2b29c422dbbc936fce495dd126.tar.gz
llvm-1749b55006758b2b29c422dbbc936fce495dd126.tar.bz2
llvm-1749b55006758b2b29c422dbbc936fce495dd126.tar.xz
[DWARF parser] Make a few methods non-public
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207156 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/DebugInfo')
-rw-r--r--lib/DebugInfo/DWARFTypeUnit.h4
-rw-r--r--lib/DebugInfo/DWARFUnit.cpp8
-rw-r--r--lib/DebugInfo/DWARFUnit.h10
3 files changed, 12 insertions, 10 deletions
diff --git a/lib/DebugInfo/DWARFTypeUnit.h b/lib/DebugInfo/DWARFTypeUnit.h
index 365aa26996..cf773b8d8e 100644
--- a/lib/DebugInfo/DWARFTypeUnit.h
+++ b/lib/DebugInfo/DWARFTypeUnit.h
@@ -23,7 +23,9 @@ public:
StringRef SS, StringRef SOS, StringRef AOS,
const RelocAddrMap *M, bool LE)
: DWARFUnit(DA, IS, RS, SS, SOS, AOS, M, LE) {}
- uint32_t getSize() const override { return DWARFUnit::getSize() + 12; }
+ uint32_t getHeaderSize() const override {
+ return DWARFUnit::getHeaderSize() + 12;
+ }
void dump(raw_ostream &OS);
protected:
bool extractImpl(DataExtractor debug_info, uint32_t *offset_ptr) override;
diff --git a/lib/DebugInfo/DWARFUnit.cpp b/lib/DebugInfo/DWARFUnit.cpp
index 41b6a252a2..c49020ad62 100644
--- a/lib/DebugInfo/DWARFUnit.cpp
+++ b/lib/DebugInfo/DWARFUnit.cpp
@@ -168,13 +168,13 @@ void DWARFUnit::extractDIEsToVector(
// Set the offset to that of the first DIE and calculate the start of the
// next compilation unit header.
- uint32_t Offset = getFirstDIEOffset();
+ uint32_t DIEOffset = Offset + getHeaderSize();
uint32_t NextCUOffset = getNextUnitOffset();
DWARFDebugInfoEntryMinimal DIE;
uint32_t Depth = 0;
bool IsCUDie = true;
- while (Offset < NextCUOffset && DIE.extractFast(this, &Offset)) {
+ while (DIEOffset < NextCUOffset && DIE.extractFast(this, &DIEOffset)) {
if (IsCUDie) {
if (AppendCUDie)
Dies.push_back(DIE);
@@ -207,9 +207,9 @@ void DWARFUnit::extractDIEsToVector(
// Give a little bit of info if we encounter corrupt DWARF (our offset
// should always terminate at or before the start of the next compilation
// unit header).
- if (Offset > NextCUOffset)
+ if (DIEOffset > NextCUOffset)
fprintf(stderr, "warning: DWARF compile unit extends beyond its "
- "bounds cu 0x%8.8x at 0x%8.8x'\n", getOffset(), Offset);
+ "bounds cu 0x%8.8x at 0x%8.8x'\n", getOffset(), DIEOffset);
}
size_t DWARFUnit::extractDIEsIfNeeded(bool CUDieOnly) {
diff --git a/lib/DebugInfo/DWARFUnit.h b/lib/DebugInfo/DWARFUnit.h
index 9743b22f72..374eceaed2 100644
--- a/lib/DebugInfo/DWARFUnit.h
+++ b/lib/DebugInfo/DWARFUnit.h
@@ -59,6 +59,8 @@ class DWARFUnit {
protected:
virtual bool extractImpl(DataExtractor debug_info, uint32_t *offset_ptr);
+ /// Size in bytes of the unit header.
+ virtual uint32_t getHeaderSize() const { return 11; }
public:
DWARFUnit(const DWARFDebugAbbrev *DA, StringRef IS, StringRef RS,
@@ -100,12 +102,7 @@ public:
DWARFDebugRangeList &RangeList) const;
void clear();
uint32_t getOffset() const { return Offset; }
- /// Size in bytes of the compile unit header.
- virtual uint32_t getSize() const { return 11; }
- uint32_t getFirstDIEOffset() const { return Offset + getSize(); }
uint32_t getNextUnitOffset() const { return Offset + Length + 4; }
- /// Size in bytes of the .debug_info data associated with this compile unit.
- size_t getDebugInfoSize() const { return Length + 4 - getSize(); }
uint32_t getLength() const { return Length; }
uint16_t getVersion() const { return Version; }
const DWARFAbbreviationDeclarationSet *getAbbreviations() const {
@@ -135,6 +132,9 @@ public:
DWARFDebugInfoEntryInlinedChain getInlinedChainForAddress(uint64_t Address);
private:
+ /// Size in bytes of the .debug_info data associated with this compile unit.
+ size_t getDebugInfoSize() const { return Length + 4 - getHeaderSize(); }
+
/// extractDIEsIfNeeded - Parses a compile unit and indexes its DIEs if it
/// hasn't already been done. Returns the number of DIEs parsed at this call.
size_t extractDIEsIfNeeded(bool CUDieOnly);