diff options
Diffstat (limited to 'include/llvm/DebugInfo/DWARF/DWARFContext.h')
-rw-r--r-- | include/llvm/DebugInfo/DWARF/DWARFContext.h | 44 |
1 files changed, 31 insertions, 13 deletions
diff --git a/include/llvm/DebugInfo/DWARF/DWARFContext.h b/include/llvm/DebugInfo/DWARF/DWARFContext.h index 2ddbc4b91ba2..fe7430c9f04c 100644 --- a/include/llvm/DebugInfo/DWARF/DWARFContext.h +++ b/include/llvm/DebugInfo/DWARF/DWARFContext.h @@ -34,6 +34,7 @@ #include "llvm/DebugInfo/DWARF/DWARFUnitIndex.h" #include "llvm/Object/Binary.h" #include "llvm/Object/ObjectFile.h" +#include "llvm/Support/DataExtractor.h" #include "llvm/Support/Error.h" #include "llvm/Support/Host.h" #include <cstdint> @@ -43,7 +44,6 @@ namespace llvm { -class DataExtractor; class MCRegisterInfo; class MemoryBuffer; class raw_ostream; @@ -69,10 +69,11 @@ class DWARFContext : public DIContext { std::unique_ptr<DWARFDebugFrame> DebugFrame; std::unique_ptr<DWARFDebugFrame> EHFrame; std::unique_ptr<DWARFDebugMacro> Macro; - std::unique_ptr<DWARFAcceleratorTable> AppleNames; - std::unique_ptr<DWARFAcceleratorTable> AppleTypes; - std::unique_ptr<DWARFAcceleratorTable> AppleNamespaces; - std::unique_ptr<DWARFAcceleratorTable> AppleObjC; + std::unique_ptr<DWARFDebugNames> Names; + std::unique_ptr<AppleAcceleratorTable> AppleNames; + std::unique_ptr<AppleAcceleratorTable> AppleTypes; + std::unique_ptr<AppleAcceleratorTable> AppleNamespaces; + std::unique_ptr<AppleAcceleratorTable> AppleObjC; DWARFUnitSection<DWARFCompileUnit> DWOCUs; std::deque<DWARFUnitSection<DWARFTypeUnit>> DWOTUs; @@ -204,6 +205,9 @@ public: DWARFCompileUnit *getDWOCompileUnitForHash(uint64_t Hash); + /// Return the compile unit that includes an offset (relative to .debug_info). + DWARFCompileUnit *getCompileUnitForOffset(uint32_t Offset); + /// Get a DIE given an exact offset. DWARFDie getDIEForOffset(uint32_t Offset); @@ -243,19 +247,36 @@ public: const DWARFDebugMacro *getDebugMacro(); /// Get a reference to the parsed accelerator table object. - const DWARFAcceleratorTable &getAppleNames(); + const DWARFDebugNames &getDebugNames(); /// Get a reference to the parsed accelerator table object. - const DWARFAcceleratorTable &getAppleTypes(); + const AppleAcceleratorTable &getAppleNames(); /// Get a reference to the parsed accelerator table object. - const DWARFAcceleratorTable &getAppleNamespaces(); + const AppleAcceleratorTable &getAppleTypes(); /// Get a reference to the parsed accelerator table object. - const DWARFAcceleratorTable &getAppleObjC(); + const AppleAcceleratorTable &getAppleNamespaces(); + + /// Get a reference to the parsed accelerator table object. + const AppleAcceleratorTable &getAppleObjC(); + + /// Get a pointer to a parsed line table corresponding to a compile unit. + /// Report any parsing issues as warnings on stderr. + const DWARFDebugLine::LineTable *getLineTableForUnit(DWARFUnit *U); /// Get a pointer to a parsed line table corresponding to a compile unit. - const DWARFDebugLine::LineTable *getLineTableForUnit(DWARFUnit *cu); + /// Report any recoverable parsing problems using the callback. + Expected<const DWARFDebugLine::LineTable *> + getLineTableForUnit(DWARFUnit *U, + std::function<void(Error)> RecoverableErrorCallback); + + DataExtractor getStringExtractor() const { + return DataExtractor(DObj->getStringSection(), false, 0); + } + DataExtractor getLineStringExtractor() const { + return DataExtractor(DObj->getLineStringSection(), false, 0); + } /// Wraps the returned DIEs for a given address. struct DIEsForAddress { @@ -303,9 +324,6 @@ public: Error loadRegisterInfo(const object::ObjectFile &Obj); private: - /// Return the compile unit that includes an offset (relative to .debug_info). - DWARFCompileUnit *getCompileUnitForOffset(uint32_t Offset); - /// Return the compile unit which contains instruction with provided /// address. DWARFCompileUnit *getCompileUnitForAddress(uint64_t Address); |