summaryrefslogtreecommitdiff
path: root/lib/DebugInfo/DWARFCompileUnit.h
diff options
context:
space:
mode:
authorAlexey Samsonov <samsonov@google.com>2013-08-27 09:20:22 +0000
committerAlexey Samsonov <samsonov@google.com>2013-08-27 09:20:22 +0000
commit63fd2af3892a81026f40374d08b5124e72ccff4e (patch)
tree8587e5f891d29f8cf006b2d3e39adebe47fa7a7b /lib/DebugInfo/DWARFCompileUnit.h
parent1567abe74f519e542786bdb82664f68b10afda0b (diff)
downloadllvm-63fd2af3892a81026f40374d08b5124e72ccff4e.tar.gz
llvm-63fd2af3892a81026f40374d08b5124e72ccff4e.tar.bz2
llvm-63fd2af3892a81026f40374d08b5124e72ccff4e.tar.xz
Add support for DebugFission to DWARF parser
Summary: 1) Make llvm-symbolizer properly symbolize files with split debug info (by using stanalone .dwo files). 2) Make DWARFCompileUnit parse and store corresponding .dwo file, if necessary. 3) Make bits of DWARF parsing more CompileUnit-oriented. Reviewers: echristo Reviewed By: echristo CC: bkramer, llvm-commits Differential Revision: http://llvm-reviews.chandlerc.com/D1164 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@189329 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/DebugInfo/DWARFCompileUnit.h')
-rw-r--r--lib/DebugInfo/DWARFCompileUnit.h53
1 files changed, 50 insertions, 3 deletions
diff --git a/lib/DebugInfo/DWARFCompileUnit.h b/lib/DebugInfo/DWARFCompileUnit.h
index 97f847962e..09167d128f 100644
--- a/lib/DebugInfo/DWARFCompileUnit.h
+++ b/lib/DebugInfo/DWARFCompileUnit.h
@@ -10,6 +10,7 @@
#ifndef LLVM_DEBUGINFO_DWARFCOMPILEUNIT_H
#define LLVM_DEBUGINFO_DWARFCOMPILEUNIT_H
+#include "llvm/ADT/OwningPtr.h"
#include "DWARFDebugAbbrev.h"
#include "DWARFDebugInfoEntry.h"
#include "DWARFDebugRangeList.h"
@@ -18,6 +19,10 @@
namespace llvm {
+namespace object {
+class ObjectFile;
+}
+
class DWARFDebugAbbrev;
class StringRef;
class raw_ostream;
@@ -30,9 +35,11 @@ class DWARFCompileUnit {
StringRef InfoSection;
StringRef AbbrevSection;
StringRef RangeSection;
+ uint32_t RangeSectionBase;
StringRef StringSection;
StringRef StringOffsetSection;
StringRef AddrOffsetSection;
+ uint32_t AddrOffsetSectionBase;
const RelocAddrMap *RelocMap;
bool isLittleEndian;
@@ -44,6 +51,17 @@ class DWARFCompileUnit {
uint64_t BaseAddr;
// The compile unit debug information entry items.
std::vector<DWARFDebugInfoEntryMinimal> DieArray;
+
+ class DWOHolder {
+ OwningPtr<object::ObjectFile> DWOFile;
+ OwningPtr<DWARFContext> DWOContext;
+ DWARFCompileUnit *DWOCU;
+ public:
+ DWOHolder(object::ObjectFile *DWOFile);
+ DWARFCompileUnit *getCU() const { return DWOCU; }
+ };
+ OwningPtr<DWOHolder> DWO;
+
public:
DWARFCompileUnit(const DWARFDebugAbbrev *DA, StringRef IS, StringRef AS,
@@ -57,9 +75,27 @@ public:
StringRef getStringSection() const { return StringSection; }
StringRef getStringOffsetSection() const { return StringOffsetSection; }
- StringRef getAddrOffsetSection() const { return AddrOffsetSection; }
+ void setAddrOffsetSection(StringRef AOS, uint32_t Base) {
+ AddrOffsetSection = AOS;
+ AddrOffsetSectionBase = Base;
+ }
+ void setRangesSection(StringRef RS, uint32_t Base) {
+ RangeSection = RS;
+ RangeSectionBase = Base;
+ }
+
+ bool getAddrOffsetSectionItem(uint32_t Index, uint64_t &Result) const;
+ // FIXME: Result should be uint64_t in DWARF64.
+ bool getStringOffsetSectionItem(uint32_t Index, uint32_t &Result) const;
+
+ DataExtractor getDebugInfoExtractor() const {
+ return DataExtractor(InfoSection, isLittleEndian, AddrSize);
+ }
+ DataExtractor getStringExtractor() const {
+ return DataExtractor(StringSection, false, 0);
+ }
+
const RelocAddrMap *getRelocMap() const { return RelocMap; }
- DataExtractor getDebugInfoExtractor() const;
bool extract(DataExtractor debug_info, uint32_t* offset_ptr);
uint32_t extract(uint32_t offset, DataExtractor debug_info_data,
@@ -105,6 +141,7 @@ public:
}
const char *getCompilationDir();
+ uint64_t getDWOId();
/// setDIERelations - We read in all of the DIE entries into our flat list
/// of DIE entries and now we need to go back through all of them and set the
@@ -112,7 +149,8 @@ public:
void setDIERelations();
void buildAddressRangeTable(DWARFDebugAranges *debug_aranges,
- bool clear_dies_if_already_not_parsed);
+ bool clear_dies_if_already_not_parsed,
+ uint32_t CUOffsetInAranges);
/// getInlinedChainForAddress - fetches inlined chain for a given address.
/// Returns empty chain if there is no subprogram containing address. The
@@ -125,6 +163,15 @@ private:
std::vector<DWARFDebugInfoEntryMinimal> &DIEs) const;
/// clearDIEs - Clear parsed DIEs to keep memory usage low.
void clearDIEs(bool KeepCUDie);
+
+ /// parseDWO - Parses .dwo file for current compile unit. Returns true if
+ /// it was actually constructed.
+ bool parseDWO();
+
+ /// getSubprogramForAddress - Returns subprogram DIE with address range
+ /// encompassing the provided address. The pointer is alive as long as parsed
+ /// compile unit DIEs are not cleared.
+ const DWARFDebugInfoEntryMinimal *getSubprogramForAddress(uint64_t Address);
};
}