1 //===-- ArmUnwindInfo.h -----------------------------------------*- C++ -*-===// 2 // 3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4 // See https://llvm.org/LICENSE.txt for license information. 5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6 // 7 //===----------------------------------------------------------------------===// 8 9 #ifndef LLDB_SYMBOL_ARMUNWINDINFO_H 10 #define LLDB_SYMBOL_ARMUNWINDINFO_H 11 12 #include "lldb/Symbol/ObjectFile.h" 13 #include "lldb/Utility/DataExtractor.h" 14 #include "lldb/Utility/RangeMap.h" 15 #include "lldb/lldb-private.h" 16 #include <vector> 17 18 /* 19 * Unwind information reader and parser for the ARM exception handling ABI 20 * 21 * Implemented based on: 22 * Exception Handling ABI for the ARM Architecture 23 * Document number: ARM IHI 0038A (current through ABI r2.09) 24 * Date of Issue: 25th January 2007, reissued 30th November 2012 25 * http://infocenter.arm.com/help/topic/com.arm.doc.ihi0038a/IHI0038A_ehabi.pdf 26 */ 27 28 namespace lldb_private { 29 30 class ArmUnwindInfo { 31 public: 32 ArmUnwindInfo(ObjectFile &objfile, lldb::SectionSP &arm_exidx, 33 lldb::SectionSP &arm_extab); 34 35 ~ArmUnwindInfo(); 36 37 bool GetUnwindPlan(Target &target, const Address &addr, 38 UnwindPlan &unwind_plan); 39 40 private: 41 struct ArmExidxEntry { 42 ArmExidxEntry(uint32_t f, lldb::addr_t a, uint32_t d); 43 44 bool operator<(const ArmExidxEntry &other) const; 45 46 uint32_t file_address; 47 lldb::addr_t address; 48 uint32_t data; 49 }; 50 51 const uint8_t *GetExceptionHandlingTableEntry(const Address &addr); 52 53 uint8_t GetByteAtOffset(const uint32_t *data, uint16_t offset) const; 54 55 uint64_t GetULEB128(const uint32_t *data, uint16_t &offset, 56 uint16_t max_offset) const; 57 58 const lldb::ByteOrder m_byte_order; 59 lldb::SectionSP m_arm_exidx_sp; // .ARM.exidx section 60 lldb::SectionSP m_arm_extab_sp; // .ARM.extab section 61 DataExtractor m_arm_exidx_data; // .ARM.exidx section data 62 DataExtractor m_arm_extab_data; // .ARM.extab section data 63 std::vector<ArmExidxEntry> m_exidx_entries; 64 }; 65 66 } // namespace lldb_private 67 68 #endif // LLDB_SYMBOL_ARMUNWINDINFO_H 69