diff options
author | Christopher Ferris <cferris@google.com> | 2017-11-03 14:50:27 -0700 |
---|---|---|
committer | Christopher Ferris <cferris@google.com> | 2017-11-07 13:22:39 -0800 |
commit | a1f6e9f7865ae7f5ae6f56bcc7d5d823801136be (patch) | |
tree | aef746793f10832631e54dac5d6505144397d640 /libunwindstack/include/unwindstack/DwarfSection.h | |
parent | 95b748c244ac51aff106fa16fe8e0b5a387c7b37 (diff) | |
download | unwinding-a1f6e9f7865ae7f5ae6f56bcc7d5d823801136be.tar.gz |
Add support for only a .eh_frame.
Static executables only have a .eh_frame section and no .eh_frame_hdr
section. Add support for this by rearranging the class hierarchy and
creating a DwarfEhFrameWithHdr class and a DwarfEhFrame class to handle
the different cases.
Add new unit tests for DwarfEhFrame and for the new functionality.
Bug: 68820189
Test: Passes new unit tests, unwinds static executables.
Change-Id: I63d7cb8c52a686e96579a2266e18c0d06bbb6e63
Diffstat (limited to 'libunwindstack/include/unwindstack/DwarfSection.h')
-rw-r--r-- | libunwindstack/include/unwindstack/DwarfSection.h | 32 |
1 files changed, 28 insertions, 4 deletions
diff --git a/libunwindstack/include/unwindstack/DwarfSection.h b/libunwindstack/include/unwindstack/DwarfSection.h index 1e843c3..10be6b4 100644 --- a/libunwindstack/include/unwindstack/DwarfSection.h +++ b/libunwindstack/include/unwindstack/DwarfSection.h @@ -90,10 +90,6 @@ class DwarfSection { virtual bool GetCfaLocationInfo(uint64_t pc, const DwarfFde* fde, dwarf_loc_regs_t* loc_regs) = 0; - virtual bool IsCie32(uint32_t value32) = 0; - - virtual bool IsCie64(uint64_t value64) = 0; - virtual uint64_t GetCieOffsetFromFde32(uint32_t pointer) = 0; virtual uint64_t GetCieOffsetFromFde64(uint64_t pointer) = 0; @@ -106,6 +102,9 @@ class DwarfSection { DwarfMemory memory_; DwarfError last_error_; + uint32_t cie32_value_ = 0; + uint64_t cie64_value_ = 0; + uint64_t fde_count_ = 0; std::unordered_map<uint64_t, DwarfFde> fde_entries_; std::unordered_map<uint64_t, DwarfCie> cie_entries_; @@ -115,9 +114,24 @@ class DwarfSection { template <typename AddressType> class DwarfSectionImpl : public DwarfSection { public: + struct FdeInfo { + FdeInfo(uint64_t offset, uint64_t start, uint64_t length) + : offset(offset), start(start), end(start + length) {} + + uint64_t offset; + AddressType start; + AddressType end; + }; + DwarfSectionImpl(Memory* memory) : DwarfSection(memory) {} virtual ~DwarfSectionImpl() = default; + bool Init(uint64_t offset, uint64_t size) override; + + bool GetFdeOffsetFromPc(uint64_t pc, uint64_t* fde_offset) override; + + const DwarfFde* GetFdeFromIndex(size_t index) override; + bool Eval(const DwarfCie* cie, Memory* regular_memory, const dwarf_loc_regs_t& loc_regs, Regs* regs, bool* finished) override; @@ -134,6 +148,16 @@ class DwarfSectionImpl : public DwarfSection { protected: bool EvalExpression(const DwarfLocation& loc, uint8_t version, Memory* regular_memory, AddressType* value); + + bool GetCieInfo(uint8_t* segment_size, uint8_t* encoding); + + bool AddFdeInfo(uint64_t entry_offset, uint8_t segment_size, uint8_t encoding); + + bool CreateSortedFdeList(); + + std::vector<FdeInfo> fdes_; + uint64_t entries_offset_; + uint64_t entries_end_; }; } // namespace unwindstack |