diff options
author | Pete Cooper <peter_cooper@apple.com> | 2015-12-18 18:51:08 +0000 |
---|---|---|
committer | Pete Cooper <peter_cooper@apple.com> | 2015-12-18 18:51:08 +0000 |
commit | 3c9c3bf29125d42c1d6aeda4076ecc11aefd7a9a (patch) | |
tree | b7455ffbc39492e316e8fef5c3da6a1d9c8fce18 /include | |
parent | 4aba1843f2bbb421d8c4018be67b234019d72a2f (diff) |
Improve DWARFDebugFrame::parse to also handle __eh_frame.
LLVM MC has single methods which can handle the output of EH frame and DWARF CIE's and FDE's.
This code improves DWARFDebugFrame::parse to do the same for parsing.
This also allows llvm-objdump to support the --dwarf=frames option which objdump supports. This
option dumps the .eh_frame section using the new code in DWARFDebugFrame::parse.
http://reviews.llvm.org/D15535
Reviewed by Rafael Espindola.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@256008 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r-- | include/llvm/DebugInfo/DIContext.h | 3 | ||||
-rw-r--r-- | include/llvm/DebugInfo/DWARF/DWARFContext.h | 10 | ||||
-rw-r--r-- | include/llvm/DebugInfo/DWARF/DWARFDebugFrame.h | 6 | ||||
-rw-r--r-- | include/llvm/DebugInfo/PDB/PDBContext.h | 3 |
4 files changed, 17 insertions, 5 deletions
diff --git a/include/llvm/DebugInfo/DIContext.h b/include/llvm/DebugInfo/DIContext.h index 6659a97a042..769c45d4b20 100644 --- a/include/llvm/DebugInfo/DIContext.h +++ b/include/llvm/DebugInfo/DIContext.h @@ -140,7 +140,8 @@ public: DIContext(DIContextKind K) : Kind(K) {} virtual ~DIContext() {} - virtual void dump(raw_ostream &OS, DIDumpType DumpType = DIDT_All) = 0; + virtual void dump(raw_ostream &OS, DIDumpType DumpType = DIDT_All, + bool DumpEH = false) = 0; virtual DILineInfo getLineInfoForAddress(uint64_t Address, DILineInfoSpecifier Specifier = DILineInfoSpecifier()) = 0; diff --git a/include/llvm/DebugInfo/DWARF/DWARFContext.h b/include/llvm/DebugInfo/DWARF/DWARFContext.h index ce253a05bf8..71d5f25a420 100644 --- a/include/llvm/DebugInfo/DWARF/DWARFContext.h +++ b/include/llvm/DebugInfo/DWARF/DWARFContext.h @@ -48,6 +48,7 @@ class DWARFContext : public DIContext { std::unique_ptr<DWARFDebugAranges> Aranges; std::unique_ptr<DWARFDebugLine> Line; std::unique_ptr<DWARFDebugFrame> DebugFrame; + std::unique_ptr<DWARFDebugFrame> EHFrame; std::unique_ptr<DWARFDebugMacro> Macro; DWARFUnitSection<DWARFCompileUnit> DWOCUs; @@ -81,7 +82,8 @@ public: return DICtx->getKind() == CK_DWARF; } - void dump(raw_ostream &OS, DIDumpType DumpType = DIDT_All) override; + void dump(raw_ostream &OS, DIDumpType DumpType = DIDT_All, + bool DumpEH = false) override; typedef DWARFUnitSection<DWARFCompileUnit>::iterator_range cu_iterator_range; typedef DWARFUnitSection<DWARFTypeUnit>::iterator_range tu_iterator_range; @@ -168,6 +170,9 @@ public: /// Get a pointer to the parsed frame information object. const DWARFDebugFrame *getDebugFrame(); + /// Get a pointer to the parsed eh frame information object. + const DWARFDebugFrame *getEHFrame(); + /// Get a pointer to the parsed DebugMacro object. const DWARFDebugMacro *getDebugMacro(); @@ -191,6 +196,7 @@ public: virtual const DWARFSection &getLocSection() = 0; virtual StringRef getARangeSection() = 0; virtual StringRef getDebugFrameSection() = 0; + virtual StringRef getEHFrameSection() = 0; virtual const DWARFSection &getLineSection() = 0; virtual StringRef getStringSection() = 0; virtual StringRef getRangeSection() = 0; @@ -242,6 +248,7 @@ class DWARFContextInMemory : public DWARFContext { DWARFSection LocSection; StringRef ARangeSection; StringRef DebugFrameSection; + StringRef EHFrameSection; DWARFSection LineSection; StringRef StringSection; StringRef RangeSection; @@ -281,6 +288,7 @@ public: const DWARFSection &getLocSection() override { return LocSection; } StringRef getARangeSection() override { return ARangeSection; } StringRef getDebugFrameSection() override { return DebugFrameSection; } + StringRef getEHFrameSection() override { return EHFrameSection; } const DWARFSection &getLineSection() override { return LineSection; } StringRef getStringSection() override { return StringSection; } StringRef getRangeSection() override { return RangeSection; } diff --git a/include/llvm/DebugInfo/DWARF/DWARFDebugFrame.h b/include/llvm/DebugInfo/DWARF/DWARFDebugFrame.h index be925cbe751..cd76c909dda 100644 --- a/include/llvm/DebugInfo/DWARF/DWARFDebugFrame.h +++ b/include/llvm/DebugInfo/DWARF/DWARFDebugFrame.h @@ -19,11 +19,13 @@ namespace llvm { class FrameEntry; -/// \brief A parsed .debug_frame section +/// \brief A parsed .debug_frame or .eh_frame section /// class DWARFDebugFrame { + // True if this is parsing an eh_frame section. + bool IsEH; public: - DWARFDebugFrame(); + DWARFDebugFrame(bool IsEH); ~DWARFDebugFrame(); /// \brief Dump the section data into the given stream. diff --git a/include/llvm/DebugInfo/PDB/PDBContext.h b/include/llvm/DebugInfo/PDB/PDBContext.h index 9404a592244..2034e3b004b 100644 --- a/include/llvm/DebugInfo/PDB/PDBContext.h +++ b/include/llvm/DebugInfo/PDB/PDBContext.h @@ -38,7 +38,8 @@ public: return DICtx->getKind() == CK_PDB; } - void dump(raw_ostream &OS, DIDumpType DumpType = DIDT_All) override; + void dump(raw_ostream &OS, DIDumpType DumpType = DIDT_All, + bool DumpEH = false) override; DILineInfo getLineInfoForAddress( uint64_t Address, |