Benjamin Kramer | aa2f78f | 2011-09-13 19:42:23 +0000 | [diff] [blame] | 1 | //===-- DWARFContext.h ------------------------------------------*- C++ -*-===// |
| 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
| 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
| 7 | // |
| 8 | //===----------------------------------------------------------------------===/ |
| 9 | |
| 10 | #ifndef LLVM_DEBUGINFO_DWARFCONTEXT_H |
| 11 | #define LLVM_DEBUGINFO_DWARFCONTEXT_H |
| 12 | |
| 13 | #include "DWARFCompileUnit.h" |
Benjamin Kramer | a6002fd | 2011-09-14 01:09:52 +0000 | [diff] [blame] | 14 | #include "DWARFDebugAranges.h" |
Eli Bendersky | fd08bc1 | 2013-02-05 23:30:58 +0000 | [diff] [blame] | 15 | #include "DWARFDebugFrame.h" |
Benjamin Kramer | 5acab50 | 2011-09-15 02:12:05 +0000 | [diff] [blame] | 16 | #include "DWARFDebugLine.h" |
David Blaikie | 18e7350 | 2013-06-19 21:37:13 +0000 | [diff] [blame] | 17 | #include "DWARFDebugLoc.h" |
Alexey Samsonov | 034e57a | 2012-08-27 07:17:47 +0000 | [diff] [blame] | 18 | #include "DWARFDebugRangeList.h" |
David Blaikie | 03c089c | 2013-09-23 22:44:47 +0000 | [diff] [blame] | 19 | #include "DWARFTypeUnit.h" |
Chandler Carruth | 8a8cd2b | 2014-01-07 11:48:04 +0000 | [diff] [blame] | 20 | #include "llvm/ADT/MapVector.h" |
Benjamin Kramer | aa2f78f | 2011-09-13 19:42:23 +0000 | [diff] [blame] | 21 | #include "llvm/ADT/SmallVector.h" |
Chandler Carruth | 802d755 | 2012-12-04 07:12:27 +0000 | [diff] [blame] | 22 | #include "llvm/DebugInfo/DIContext.h" |
Benjamin Kramer | aa2f78f | 2011-09-13 19:42:23 +0000 | [diff] [blame] | 23 | |
| 24 | namespace llvm { |
| 25 | |
Benjamin Kramer | aa2f78f | 2011-09-13 19:42:23 +0000 | [diff] [blame] | 26 | /// DWARFContext |
| 27 | /// This data structure is the top level entity that deals with dwarf debug |
| 28 | /// information parsing. The actual data is supplied through pure virtual |
| 29 | /// methods that a concrete implementation provides. |
| 30 | class DWARFContext : public DIContext { |
Alexey Samsonov | 96dc29c | 2014-03-13 08:19:59 +0000 | [diff] [blame] | 31 | typedef SmallVector<std::unique_ptr<DWARFCompileUnit>, 1> CUVector; |
| 32 | typedef SmallVector<std::unique_ptr<DWARFTypeUnit>, 1> TUVector; |
Alexey Samsonov | 1eabf98 | 2014-03-13 07:52:54 +0000 | [diff] [blame] | 33 | |
| 34 | CUVector CUs; |
| 35 | TUVector TUs; |
Ahmed Charles | 56440fd | 2014-03-06 05:51:42 +0000 | [diff] [blame] | 36 | std::unique_ptr<DWARFDebugAbbrev> Abbrev; |
| 37 | std::unique_ptr<DWARFDebugLoc> Loc; |
| 38 | std::unique_ptr<DWARFDebugAranges> Aranges; |
| 39 | std::unique_ptr<DWARFDebugLine> Line; |
| 40 | std::unique_ptr<DWARFDebugFrame> DebugFrame; |
Benjamin Kramer | aa2f78f | 2011-09-13 19:42:23 +0000 | [diff] [blame] | 41 | |
Alexey Samsonov | 1eabf98 | 2014-03-13 07:52:54 +0000 | [diff] [blame] | 42 | CUVector DWOCUs; |
| 43 | TUVector DWOTUs; |
Ahmed Charles | 56440fd | 2014-03-06 05:51:42 +0000 | [diff] [blame] | 44 | std::unique_ptr<DWARFDebugAbbrev> AbbrevDWO; |
David Blaikie | 9c550ac | 2014-03-25 01:44:02 +0000 | [diff] [blame] | 45 | std::unique_ptr<DWARFDebugLocDWO> LocDWO; |
Eric Christopher | da4b219 | 2013-01-02 23:52:13 +0000 | [diff] [blame] | 46 | |
Craig Topper | b1d83e8 | 2012-09-18 02:01:41 +0000 | [diff] [blame] | 47 | DWARFContext(DWARFContext &) LLVM_DELETED_FUNCTION; |
| 48 | DWARFContext &operator=(DWARFContext &) LLVM_DELETED_FUNCTION; |
Benjamin Kramer | aa2f78f | 2011-09-13 19:42:23 +0000 | [diff] [blame] | 49 | |
Alexey Samsonov | 1eabf98 | 2014-03-13 07:52:54 +0000 | [diff] [blame] | 50 | /// Read compile units from the debug_info section (if necessary) |
| 51 | /// and store them in CUs. |
Benjamin Kramer | aa2f78f | 2011-09-13 19:42:23 +0000 | [diff] [blame] | 52 | void parseCompileUnits(); |
Eric Christopher | 7370b55 | 2012-11-12 21:40:38 +0000 | [diff] [blame] | 53 | |
Alexey Samsonov | 1eabf98 | 2014-03-13 07:52:54 +0000 | [diff] [blame] | 54 | /// Read type units from the debug_types sections (if necessary) |
| 55 | /// and store them in TUs. |
David Blaikie | 03c089c | 2013-09-23 22:44:47 +0000 | [diff] [blame] | 56 | void parseTypeUnits(); |
| 57 | |
Alexey Samsonov | 1eabf98 | 2014-03-13 07:52:54 +0000 | [diff] [blame] | 58 | /// Read compile units from the debug_info.dwo section (if necessary) |
| 59 | /// and store them in DWOCUs. |
Eric Christopher | da4b219 | 2013-01-02 23:52:13 +0000 | [diff] [blame] | 60 | void parseDWOCompileUnits(); |
| 61 | |
Alexey Samsonov | 1eabf98 | 2014-03-13 07:52:54 +0000 | [diff] [blame] | 62 | /// Read type units from the debug_types.dwo section (if necessary) |
| 63 | /// and store them in DWOTUs. |
David Blaikie | 92d9d62 | 2014-01-09 05:08:24 +0000 | [diff] [blame] | 64 | void parseDWOTypeUnits(); |
| 65 | |
Benjamin Kramer | aa2f78f | 2011-09-13 19:42:23 +0000 | [diff] [blame] | 66 | public: |
David Blaikie | 1b5ee5d | 2013-09-23 17:42:01 +0000 | [diff] [blame] | 67 | struct Section { |
| 68 | StringRef Data; |
| 69 | RelocAddrMap Relocs; |
| 70 | }; |
| 71 | |
Alexey Samsonov | c2e0087 | 2013-08-06 10:32:39 +0000 | [diff] [blame] | 72 | DWARFContext() : DIContext(CK_DWARF) {} |
| 73 | |
| 74 | static bool classof(const DIContext *DICtx) { |
| 75 | return DICtx->getKind() == CK_DWARF; |
| 76 | } |
| 77 | |
Craig Topper | 8548299 | 2014-03-05 07:52:44 +0000 | [diff] [blame] | 78 | void dump(raw_ostream &OS, DIDumpType DumpType = DIDT_All) override; |
Eric Christopher | 7c678de | 2012-11-07 23:22:07 +0000 | [diff] [blame] | 79 | |
Alexey Samsonov | 1eabf98 | 2014-03-13 07:52:54 +0000 | [diff] [blame] | 80 | typedef iterator_range<CUVector::iterator> cu_iterator_range; |
| 81 | typedef iterator_range<TUVector::iterator> tu_iterator_range; |
| 82 | |
| 83 | /// Get compile units in this context. |
| 84 | cu_iterator_range compile_units() { |
| 85 | parseCompileUnits(); |
| 86 | return cu_iterator_range(CUs.begin(), CUs.end()); |
| 87 | } |
| 88 | |
| 89 | /// Get type units in this context. |
| 90 | tu_iterator_range type_units() { |
| 91 | parseTypeUnits(); |
| 92 | return tu_iterator_range(TUs.begin(), TUs.end()); |
| 93 | } |
| 94 | |
| 95 | /// Get compile units in the DWO context. |
| 96 | cu_iterator_range dwo_compile_units() { |
| 97 | parseDWOCompileUnits(); |
| 98 | return cu_iterator_range(DWOCUs.begin(), DWOCUs.end()); |
| 99 | } |
| 100 | |
| 101 | /// Get type units in the DWO context. |
| 102 | tu_iterator_range dwo_type_units() { |
| 103 | parseDWOTypeUnits(); |
| 104 | return tu_iterator_range(DWOTUs.begin(), DWOTUs.end()); |
| 105 | } |
| 106 | |
Benjamin Kramer | aa2f78f | 2011-09-13 19:42:23 +0000 | [diff] [blame] | 107 | /// Get the number of compile units in this context. |
| 108 | unsigned getNumCompileUnits() { |
Alexey Samsonov | 1eabf98 | 2014-03-13 07:52:54 +0000 | [diff] [blame] | 109 | parseCompileUnits(); |
Benjamin Kramer | aa2f78f | 2011-09-13 19:42:23 +0000 | [diff] [blame] | 110 | return CUs.size(); |
| 111 | } |
Eric Christopher | da4b219 | 2013-01-02 23:52:13 +0000 | [diff] [blame] | 112 | |
David Blaikie | 03c089c | 2013-09-23 22:44:47 +0000 | [diff] [blame] | 113 | /// Get the number of compile units in this context. |
| 114 | unsigned getNumTypeUnits() { |
Alexey Samsonov | 1eabf98 | 2014-03-13 07:52:54 +0000 | [diff] [blame] | 115 | parseTypeUnits(); |
David Blaikie | 03c089c | 2013-09-23 22:44:47 +0000 | [diff] [blame] | 116 | return TUs.size(); |
| 117 | } |
| 118 | |
Eric Christopher | da4b219 | 2013-01-02 23:52:13 +0000 | [diff] [blame] | 119 | /// Get the number of compile units in the DWO context. |
| 120 | unsigned getNumDWOCompileUnits() { |
Alexey Samsonov | 1eabf98 | 2014-03-13 07:52:54 +0000 | [diff] [blame] | 121 | parseDWOCompileUnits(); |
Eric Christopher | da4b219 | 2013-01-02 23:52:13 +0000 | [diff] [blame] | 122 | return DWOCUs.size(); |
| 123 | } |
| 124 | |
David Blaikie | 92d9d62 | 2014-01-09 05:08:24 +0000 | [diff] [blame] | 125 | /// Get the number of compile units in the DWO context. |
| 126 | unsigned getNumDWOTypeUnits() { |
Alexey Samsonov | 1eabf98 | 2014-03-13 07:52:54 +0000 | [diff] [blame] | 127 | parseDWOTypeUnits(); |
David Blaikie | 92d9d62 | 2014-01-09 05:08:24 +0000 | [diff] [blame] | 128 | return DWOTUs.size(); |
| 129 | } |
| 130 | |
Benjamin Kramer | aa2f78f | 2011-09-13 19:42:23 +0000 | [diff] [blame] | 131 | /// Get the compile unit at the specified index for this compile unit. |
| 132 | DWARFCompileUnit *getCompileUnitAtIndex(unsigned index) { |
Alexey Samsonov | 1eabf98 | 2014-03-13 07:52:54 +0000 | [diff] [blame] | 133 | parseCompileUnits(); |
Alexey Samsonov | 96dc29c | 2014-03-13 08:19:59 +0000 | [diff] [blame] | 134 | return CUs[index].get(); |
Benjamin Kramer | aa2f78f | 2011-09-13 19:42:23 +0000 | [diff] [blame] | 135 | } |
| 136 | |
Eric Christopher | da4b219 | 2013-01-02 23:52:13 +0000 | [diff] [blame] | 137 | /// Get the compile unit at the specified index for the DWO compile units. |
| 138 | DWARFCompileUnit *getDWOCompileUnitAtIndex(unsigned index) { |
Alexey Samsonov | 1eabf98 | 2014-03-13 07:52:54 +0000 | [diff] [blame] | 139 | parseDWOCompileUnits(); |
Alexey Samsonov | 96dc29c | 2014-03-13 08:19:59 +0000 | [diff] [blame] | 140 | return DWOCUs[index].get(); |
Eric Christopher | da4b219 | 2013-01-02 23:52:13 +0000 | [diff] [blame] | 141 | } |
| 142 | |
Benjamin Kramer | aa2f78f | 2011-09-13 19:42:23 +0000 | [diff] [blame] | 143 | /// Get a pointer to the parsed DebugAbbrev object. |
| 144 | const DWARFDebugAbbrev *getDebugAbbrev(); |
| 145 | |
David Blaikie | 18e7350 | 2013-06-19 21:37:13 +0000 | [diff] [blame] | 146 | /// Get a pointer to the parsed DebugLoc object. |
| 147 | const DWARFDebugLoc *getDebugLoc(); |
| 148 | |
Eric Christopher | da4b219 | 2013-01-02 23:52:13 +0000 | [diff] [blame] | 149 | /// Get a pointer to the parsed dwo abbreviations object. |
| 150 | const DWARFDebugAbbrev *getDebugAbbrevDWO(); |
| 151 | |
David Blaikie | 9c550ac | 2014-03-25 01:44:02 +0000 | [diff] [blame] | 152 | /// Get a pointer to the parsed DebugLoc object. |
| 153 | const DWARFDebugLocDWO *getDebugLocDWO(); |
| 154 | |
Benjamin Kramer | a6002fd | 2011-09-14 01:09:52 +0000 | [diff] [blame] | 155 | /// Get a pointer to the parsed DebugAranges object. |
| 156 | const DWARFDebugAranges *getDebugAranges(); |
| 157 | |
Eli Bendersky | fd08bc1 | 2013-02-05 23:30:58 +0000 | [diff] [blame] | 158 | /// Get a pointer to the parsed frame information object. |
| 159 | const DWARFDebugFrame *getDebugFrame(); |
| 160 | |
Benjamin Kramer | 679e175 | 2011-09-15 20:43:18 +0000 | [diff] [blame] | 161 | /// Get a pointer to a parsed line table corresponding to a compile unit. |
| 162 | const DWARFDebugLine::LineTable * |
| 163 | getLineTableForCompileUnit(DWARFCompileUnit *cu); |
Benjamin Kramer | 5acab50 | 2011-09-15 02:12:05 +0000 | [diff] [blame] | 164 | |
Craig Topper | 8548299 | 2014-03-05 07:52:44 +0000 | [diff] [blame] | 165 | DILineInfo getLineInfoForAddress(uint64_t Address, |
| 166 | DILineInfoSpecifier Specifier = DILineInfoSpecifier()) override; |
| 167 | DILineInfoTable getLineInfoForAddressRange(uint64_t Address, uint64_t Size, |
| 168 | DILineInfoSpecifier Specifier = DILineInfoSpecifier()) override; |
| 169 | DIInliningInfo getInliningInfoForAddress(uint64_t Address, |
| 170 | DILineInfoSpecifier Specifier = DILineInfoSpecifier()) override; |
Benjamin Kramer | 2602ca6 | 2011-09-15 20:43:22 +0000 | [diff] [blame] | 171 | |
Eric Christopher | 7370b55 | 2012-11-12 21:40:38 +0000 | [diff] [blame] | 172 | virtual bool isLittleEndian() const = 0; |
Eli Bendersky | fd08bc1 | 2013-02-05 23:30:58 +0000 | [diff] [blame] | 173 | virtual uint8_t getAddressSize() const = 0; |
David Blaikie | 1b5ee5d | 2013-09-23 17:42:01 +0000 | [diff] [blame] | 174 | virtual const Section &getInfoSection() = 0; |
David Blaikie | bc56327 | 2013-12-13 21:33:40 +0000 | [diff] [blame] | 175 | typedef MapVector<object::SectionRef, Section, |
| 176 | std::map<object::SectionRef, unsigned> > TypeSectionMap; |
| 177 | virtual const TypeSectionMap &getTypesSections() = 0; |
Benjamin Kramer | aa2f78f | 2011-09-13 19:42:23 +0000 | [diff] [blame] | 178 | virtual StringRef getAbbrevSection() = 0; |
David Blaikie | 1b5ee5d | 2013-09-23 17:42:01 +0000 | [diff] [blame] | 179 | virtual const Section &getLocSection() = 0; |
David Blaikie | 9c550ac | 2014-03-25 01:44:02 +0000 | [diff] [blame] | 180 | virtual const Section &getLocDWOSection() = 0; |
Benjamin Kramer | aa2f78f | 2011-09-13 19:42:23 +0000 | [diff] [blame] | 181 | virtual StringRef getARangeSection() = 0; |
Eli Bendersky | fd08bc1 | 2013-02-05 23:30:58 +0000 | [diff] [blame] | 182 | virtual StringRef getDebugFrameSection() = 0; |
David Blaikie | 1b5ee5d | 2013-09-23 17:42:01 +0000 | [diff] [blame] | 183 | virtual const Section &getLineSection() = 0; |
David Blaikie | 1d4736e | 2014-02-24 23:58:54 +0000 | [diff] [blame] | 184 | virtual const Section &getLineDWOSection() = 0; |
Benjamin Kramer | aa2f78f | 2011-09-13 19:42:23 +0000 | [diff] [blame] | 185 | virtual StringRef getStringSection() = 0; |
Alexey Samsonov | 034e57a | 2012-08-27 07:17:47 +0000 | [diff] [blame] | 186 | virtual StringRef getRangeSection() = 0; |
Krzysztof Parzyszek | 97438dc | 2013-02-12 16:20:28 +0000 | [diff] [blame] | 187 | virtual StringRef getPubNamesSection() = 0; |
Eric Christopher | 4c7e6ba | 2013-09-25 23:02:41 +0000 | [diff] [blame] | 188 | virtual StringRef getPubTypesSection() = 0; |
David Blaikie | 404d304 | 2013-09-19 23:01:29 +0000 | [diff] [blame] | 189 | virtual StringRef getGnuPubNamesSection() = 0; |
David Blaikie | ecd21ff | 2013-09-24 19:50:00 +0000 | [diff] [blame] | 190 | virtual StringRef getGnuPubTypesSection() = 0; |
Benjamin Kramer | aa2f78f | 2011-09-13 19:42:23 +0000 | [diff] [blame] | 191 | |
Eric Christopher | da4b219 | 2013-01-02 23:52:13 +0000 | [diff] [blame] | 192 | // Sections for DWARF5 split dwarf proposal. |
David Blaikie | 1b5ee5d | 2013-09-23 17:42:01 +0000 | [diff] [blame] | 193 | virtual const Section &getInfoDWOSection() = 0; |
David Blaikie | 92d9d62 | 2014-01-09 05:08:24 +0000 | [diff] [blame] | 194 | virtual const TypeSectionMap &getTypesDWOSections() = 0; |
Eric Christopher | da4b219 | 2013-01-02 23:52:13 +0000 | [diff] [blame] | 195 | virtual StringRef getAbbrevDWOSection() = 0; |
| 196 | virtual StringRef getStringDWOSection() = 0; |
Eric Christopher | 2cbd576 | 2013-01-07 19:32:41 +0000 | [diff] [blame] | 197 | virtual StringRef getStringOffsetDWOSection() = 0; |
Eric Christopher | da4b219 | 2013-01-02 23:52:13 +0000 | [diff] [blame] | 198 | virtual StringRef getRangeDWOSection() = 0; |
Eric Christopher | 962c908 | 2013-01-15 23:56:56 +0000 | [diff] [blame] | 199 | virtual StringRef getAddrSection() = 0; |
Eric Christopher | da4b219 | 2013-01-02 23:52:13 +0000 | [diff] [blame] | 200 | |
Benjamin Kramer | aa2f78f | 2011-09-13 19:42:23 +0000 | [diff] [blame] | 201 | static bool isSupportedVersion(unsigned version) { |
Eric Christopher | f7d848d | 2013-08-06 01:38:27 +0000 | [diff] [blame] | 202 | return version == 2 || version == 3 || version == 4; |
Benjamin Kramer | aa2f78f | 2011-09-13 19:42:23 +0000 | [diff] [blame] | 203 | } |
Alexey Samsonov | 45be793 | 2012-08-30 07:49:50 +0000 | [diff] [blame] | 204 | private: |
| 205 | /// Return the compile unit that includes an offset (relative to .debug_info). |
| 206 | DWARFCompileUnit *getCompileUnitForOffset(uint32_t Offset); |
Benjamin Kramer | aa2f78f | 2011-09-13 19:42:23 +0000 | [diff] [blame] | 207 | |
Alexey Samsonov | 45be793 | 2012-08-30 07:49:50 +0000 | [diff] [blame] | 208 | /// Return the compile unit which contains instruction with provided |
| 209 | /// address. |
| 210 | DWARFCompileUnit *getCompileUnitForAddress(uint64_t Address); |
Alexey Samsonov | 45be793 | 2012-08-30 07:49:50 +0000 | [diff] [blame] | 211 | }; |
Benjamin Kramer | aa2f78f | 2011-09-13 19:42:23 +0000 | [diff] [blame] | 212 | |
| 213 | /// DWARFContextInMemory is the simplest possible implementation of a |
| 214 | /// DWARFContext. It assumes all content is available in memory and stores |
| 215 | /// pointers to it. |
| 216 | class DWARFContextInMemory : public DWARFContext { |
David Blaikie | a379b181 | 2011-12-20 02:50:00 +0000 | [diff] [blame] | 217 | virtual void anchor(); |
Eric Christopher | 7370b55 | 2012-11-12 21:40:38 +0000 | [diff] [blame] | 218 | bool IsLittleEndian; |
Eli Bendersky | fd08bc1 | 2013-02-05 23:30:58 +0000 | [diff] [blame] | 219 | uint8_t AddressSize; |
David Blaikie | 1b5ee5d | 2013-09-23 17:42:01 +0000 | [diff] [blame] | 220 | Section InfoSection; |
David Blaikie | bc56327 | 2013-12-13 21:33:40 +0000 | [diff] [blame] | 221 | TypeSectionMap TypesSections; |
Benjamin Kramer | aa2f78f | 2011-09-13 19:42:23 +0000 | [diff] [blame] | 222 | StringRef AbbrevSection; |
David Blaikie | 1b5ee5d | 2013-09-23 17:42:01 +0000 | [diff] [blame] | 223 | Section LocSection; |
David Blaikie | 9c550ac | 2014-03-25 01:44:02 +0000 | [diff] [blame] | 224 | Section LocDWOSection; |
Benjamin Kramer | aa2f78f | 2011-09-13 19:42:23 +0000 | [diff] [blame] | 225 | StringRef ARangeSection; |
Eli Bendersky | fd08bc1 | 2013-02-05 23:30:58 +0000 | [diff] [blame] | 226 | StringRef DebugFrameSection; |
David Blaikie | 1b5ee5d | 2013-09-23 17:42:01 +0000 | [diff] [blame] | 227 | Section LineSection; |
David Blaikie | 1d4736e | 2014-02-24 23:58:54 +0000 | [diff] [blame] | 228 | Section LineDWOSection; |
Benjamin Kramer | aa2f78f | 2011-09-13 19:42:23 +0000 | [diff] [blame] | 229 | StringRef StringSection; |
Alexey Samsonov | 034e57a | 2012-08-27 07:17:47 +0000 | [diff] [blame] | 230 | StringRef RangeSection; |
Krzysztof Parzyszek | 97438dc | 2013-02-12 16:20:28 +0000 | [diff] [blame] | 231 | StringRef PubNamesSection; |
Eric Christopher | 4c7e6ba | 2013-09-25 23:02:41 +0000 | [diff] [blame] | 232 | StringRef PubTypesSection; |
David Blaikie | 404d304 | 2013-09-19 23:01:29 +0000 | [diff] [blame] | 233 | StringRef GnuPubNamesSection; |
David Blaikie | ecd21ff | 2013-09-24 19:50:00 +0000 | [diff] [blame] | 234 | StringRef GnuPubTypesSection; |
Eric Christopher | da4b219 | 2013-01-02 23:52:13 +0000 | [diff] [blame] | 235 | |
| 236 | // Sections for DWARF5 split dwarf proposal. |
David Blaikie | 1b5ee5d | 2013-09-23 17:42:01 +0000 | [diff] [blame] | 237 | Section InfoDWOSection; |
David Blaikie | 92d9d62 | 2014-01-09 05:08:24 +0000 | [diff] [blame] | 238 | TypeSectionMap TypesDWOSections; |
Eric Christopher | da4b219 | 2013-01-02 23:52:13 +0000 | [diff] [blame] | 239 | StringRef AbbrevDWOSection; |
| 240 | StringRef StringDWOSection; |
Eric Christopher | 2cbd576 | 2013-01-07 19:32:41 +0000 | [diff] [blame] | 241 | StringRef StringOffsetDWOSection; |
Eric Christopher | da4b219 | 2013-01-02 23:52:13 +0000 | [diff] [blame] | 242 | StringRef RangeDWOSection; |
Eric Christopher | 962c908 | 2013-01-15 23:56:56 +0000 | [diff] [blame] | 243 | StringRef AddrSection; |
Eric Christopher | da4b219 | 2013-01-02 23:52:13 +0000 | [diff] [blame] | 244 | |
Alexey Samsonov | 96dc29c | 2014-03-13 08:19:59 +0000 | [diff] [blame] | 245 | SmallVector<std::unique_ptr<MemoryBuffer>, 4> UncompressedSections; |
Alexey Samsonov | 068fc8a | 2013-04-23 10:17:34 +0000 | [diff] [blame] | 246 | |
Benjamin Kramer | aa2f78f | 2011-09-13 19:42:23 +0000 | [diff] [blame] | 247 | public: |
Eric Christopher | 7370b55 | 2012-11-12 21:40:38 +0000 | [diff] [blame] | 248 | DWARFContextInMemory(object::ObjectFile *); |
Craig Topper | 8548299 | 2014-03-05 07:52:44 +0000 | [diff] [blame] | 249 | bool isLittleEndian() const override { return IsLittleEndian; } |
| 250 | uint8_t getAddressSize() const override { return AddressSize; } |
| 251 | const Section &getInfoSection() override { return InfoSection; } |
| 252 | const TypeSectionMap &getTypesSections() override { return TypesSections; } |
| 253 | StringRef getAbbrevSection() override { return AbbrevSection; } |
| 254 | const Section &getLocSection() override { return LocSection; } |
David Blaikie | 9c550ac | 2014-03-25 01:44:02 +0000 | [diff] [blame] | 255 | const Section &getLocDWOSection() override { return LocDWOSection; } |
Craig Topper | 8548299 | 2014-03-05 07:52:44 +0000 | [diff] [blame] | 256 | StringRef getARangeSection() override { return ARangeSection; } |
| 257 | StringRef getDebugFrameSection() override { return DebugFrameSection; } |
| 258 | const Section &getLineSection() override { return LineSection; } |
| 259 | const Section &getLineDWOSection() override { return LineDWOSection; } |
| 260 | StringRef getStringSection() override { return StringSection; } |
| 261 | StringRef getRangeSection() override { return RangeSection; } |
| 262 | StringRef getPubNamesSection() override { return PubNamesSection; } |
| 263 | StringRef getPubTypesSection() override { return PubTypesSection; } |
| 264 | StringRef getGnuPubNamesSection() override { return GnuPubNamesSection; } |
| 265 | StringRef getGnuPubTypesSection() override { return GnuPubTypesSection; } |
Eric Christopher | da4b219 | 2013-01-02 23:52:13 +0000 | [diff] [blame] | 266 | |
| 267 | // Sections for DWARF5 split dwarf proposal. |
Craig Topper | 8548299 | 2014-03-05 07:52:44 +0000 | [diff] [blame] | 268 | const Section &getInfoDWOSection() override { return InfoDWOSection; } |
| 269 | const TypeSectionMap &getTypesDWOSections() override { |
David Blaikie | 92d9d62 | 2014-01-09 05:08:24 +0000 | [diff] [blame] | 270 | return TypesDWOSections; |
| 271 | } |
Craig Topper | 8548299 | 2014-03-05 07:52:44 +0000 | [diff] [blame] | 272 | StringRef getAbbrevDWOSection() override { return AbbrevDWOSection; } |
| 273 | StringRef getStringDWOSection() override { return StringDWOSection; } |
| 274 | StringRef getStringOffsetDWOSection() override { |
Eric Christopher | 2cbd576 | 2013-01-07 19:32:41 +0000 | [diff] [blame] | 275 | return StringOffsetDWOSection; |
| 276 | } |
Craig Topper | 8548299 | 2014-03-05 07:52:44 +0000 | [diff] [blame] | 277 | StringRef getRangeDWOSection() override { return RangeDWOSection; } |
| 278 | StringRef getAddrSection() override { |
Eric Christopher | 962c908 | 2013-01-15 23:56:56 +0000 | [diff] [blame] | 279 | return AddrSection; |
| 280 | } |
Benjamin Kramer | aa2f78f | 2011-09-13 19:42:23 +0000 | [diff] [blame] | 281 | }; |
| 282 | |
| 283 | } |
| 284 | |
| 285 | #endif |