diff options
Diffstat (limited to 'include/llvm/DebugInfo/DWARF')
| -rw-r--r-- | include/llvm/DebugInfo/DWARF/DWARFContext.h | 18 | ||||
| -rw-r--r-- | include/llvm/DebugInfo/DWARF/DWARFDebugRangeList.h | 3 | ||||
| -rw-r--r-- | include/llvm/DebugInfo/DWARF/DWARFDie.h | 3 | ||||
| -rw-r--r-- | include/llvm/DebugInfo/DWARF/DWARFFormValue.h | 2 | ||||
| -rw-r--r-- | include/llvm/DebugInfo/DWARF/DWARFRelocMap.h | 3 | ||||
| -rw-r--r-- | include/llvm/DebugInfo/DWARF/DWARFUnit.h | 12 |
6 files changed, 28 insertions, 13 deletions
diff --git a/include/llvm/DebugInfo/DWARF/DWARFContext.h b/include/llvm/DebugInfo/DWARF/DWARFContext.h index d3a63edf10ffe..7fa68f3f2314e 100644 --- a/include/llvm/DebugInfo/DWARF/DWARFContext.h +++ b/include/llvm/DebugInfo/DWARF/DWARFContext.h @@ -46,7 +46,8 @@ class raw_ostream; /// Reads a value from data extractor and applies a relocation to the result if /// one exists for the given offset. uint64_t getRelocatedValue(const DataExtractor &Data, uint32_t Size, - uint32_t *Off, const RelocAddrMap *Relocs); + uint32_t *Off, const RelocAddrMap *Relocs, + uint64_t *SecNdx = nullptr); /// DWARFContext /// This data structure is the top level entity that deals with dwarf debug @@ -71,6 +72,14 @@ class DWARFContext : public DIContext { std::unique_ptr<DWARFDebugAbbrev> AbbrevDWO; std::unique_ptr<DWARFDebugLocDWO> LocDWO; + struct DWOFile { + object::OwningBinary<object::ObjectFile> File; + std::unique_ptr<DWARFContext> Context; + }; + StringMap<std::weak_ptr<DWOFile>> DWOFiles; + std::weak_ptr<DWOFile> DWP; + bool CheckedForDWP = false; + /// Read compile units from the debug_info section (if necessary) /// and store them in CUs. void parseCompileUnits(); @@ -165,6 +174,8 @@ public: return DWOCUs[index].get(); } + DWARFCompileUnit *getDWOCompileUnitForHash(uint64_t Hash); + /// Get a DIE given an exact offset. DWARFDie getDIEForOffset(uint32_t Offset); @@ -206,6 +217,7 @@ public: DIInliningInfo getInliningInfoForAddress(uint64_t Address, DILineInfoSpecifier Specifier = DILineInfoSpecifier()) override; + virtual StringRef getFileName() const = 0; virtual bool isLittleEndian() const = 0; virtual uint8_t getAddressSize() const = 0; virtual const DWARFSection &getInfoSection() = 0; @@ -248,6 +260,8 @@ public: return version == 2 || version == 3 || version == 4 || version == 5; } + std::shared_ptr<DWARFContext> getDWOContext(StringRef AbsolutePath); + private: /// Return the compile unit that includes an offset (relative to .debug_info). DWARFCompileUnit *getCompileUnitForOffset(uint32_t Offset); @@ -263,6 +277,7 @@ private: class DWARFContextInMemory : public DWARFContext { virtual void anchor(); + StringRef FileName; bool IsLittleEndian; uint8_t AddressSize; DWARFSection InfoSection; @@ -316,6 +331,7 @@ public: uint8_t AddrSize, bool isLittleEndian = sys::IsLittleEndianHost); + StringRef getFileName() const override { return FileName; } bool isLittleEndian() const override { return IsLittleEndian; } uint8_t getAddressSize() const override { return AddressSize; } const DWARFSection &getInfoSection() override { return InfoSection; } diff --git a/include/llvm/DebugInfo/DWARF/DWARFDebugRangeList.h b/include/llvm/DebugInfo/DWARF/DWARFDebugRangeList.h index 95ec1be62a790..b436711ae6ed7 100644 --- a/include/llvm/DebugInfo/DWARF/DWARFDebugRangeList.h +++ b/include/llvm/DebugInfo/DWARF/DWARFDebugRangeList.h @@ -25,6 +25,7 @@ class raw_ostream; struct DWARFAddressRange { uint64_t LowPC; uint64_t HighPC; + uint64_t SectionIndex; }; /// DWARFAddressRangesVector - represents a set of absolute address ranges. @@ -44,6 +45,8 @@ public: /// address past the end of the address range. The ending address must /// be greater than or equal to the beginning address. uint64_t EndAddress; + /// A section index this range belongs to. + uint64_t SectionIndex; /// The end of any given range list is marked by an end of list entry, /// which consists of a 0 for the beginning address offset diff --git a/include/llvm/DebugInfo/DWARF/DWARFDie.h b/include/llvm/DebugInfo/DWARF/DWARFDie.h index ca94a90fabfc8..fa41b9e293c0b 100644 --- a/include/llvm/DebugInfo/DWARF/DWARFDie.h +++ b/include/llvm/DebugInfo/DWARF/DWARFDie.h @@ -195,7 +195,8 @@ public: /// Retrieves DW_AT_low_pc and DW_AT_high_pc from CU. /// Returns true if both attributes are present. - bool getLowAndHighPC(uint64_t &LowPC, uint64_t &HighPC) const; + bool getLowAndHighPC(uint64_t &LowPC, uint64_t &HighPC, + uint64_t &SectionIndex) const; /// Get the address ranges for this DIE. /// diff --git a/include/llvm/DebugInfo/DWARF/DWARFFormValue.h b/include/llvm/DebugInfo/DWARF/DWARFFormValue.h index a30e0be9c3c35..3a781dde8929a 100644 --- a/include/llvm/DebugInfo/DWARF/DWARFFormValue.h +++ b/include/llvm/DebugInfo/DWARF/DWARFFormValue.h @@ -47,6 +47,7 @@ private: const char *cstr; }; const uint8_t *data = nullptr; + uint64_t SectionIndex; /// Section index for reference forms. }; dwarf::Form Form; /// Form for this value. @@ -58,6 +59,7 @@ public: dwarf::Form getForm() const { return Form; } uint64_t getRawUValue() const { return Value.uval; } + uint64_t getSectionIndex() const { return Value.SectionIndex; } void setForm(dwarf::Form F) { Form = F; } void setUValue(uint64_t V) { Value.uval = V; } void setSValue(int64_t V) { Value.sval = V; } diff --git a/include/llvm/DebugInfo/DWARF/DWARFRelocMap.h b/include/llvm/DebugInfo/DWARF/DWARFRelocMap.h index fabacc0abcea9..f143de334737a 100644 --- a/include/llvm/DebugInfo/DWARF/DWARFRelocMap.h +++ b/include/llvm/DebugInfo/DWARF/DWARFRelocMap.h @@ -16,7 +16,10 @@ namespace llvm { +/// RelocAddrEntry contains relocated value and section index. +/// Section index is -1LL if relocation points to absolute symbol. struct RelocAddrEntry { + uint64_t SectionIndex; uint64_t Value; }; diff --git a/include/llvm/DebugInfo/DWARF/DWARFUnit.h b/include/llvm/DebugInfo/DWARF/DWARFUnit.h index ae7fd24ce5bb9..d0f7bd0d623f0 100644 --- a/include/llvm/DebugInfo/DWARF/DWARFUnit.h +++ b/include/llvm/DebugInfo/DWARF/DWARFUnit.h @@ -143,17 +143,7 @@ class DWARFUnit { typedef iterator_range<std::vector<DWARFDebugInfoEntry>::iterator> die_iterator_range; - class DWOHolder { - object::OwningBinary<object::ObjectFile> DWOFile; - std::unique_ptr<DWARFContext> DWOContext; - DWARFUnit *DWOU = nullptr; - - public: - DWOHolder(StringRef DWOPath, uint64_t DWOId); - - DWARFUnit *getUnit() const { return DWOU; } - }; - std::unique_ptr<DWOHolder> DWO; + std::shared_ptr<DWARFUnit> DWO; const DWARFUnitIndex::Entry *IndexEntry; |
