1292932Sdim//===-- ArmUnwindInfo.h -----------------------------------------*- C++ -*-===// 2292932Sdim// 3353358Sdim// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4353358Sdim// See https://llvm.org/LICENSE.txt for license information. 5353358Sdim// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6292932Sdim// 7292932Sdim//===----------------------------------------------------------------------===// 8292932Sdim 9292932Sdim#ifndef liblldb_ArmUnwindInfo_h_ 10292932Sdim#define liblldb_ArmUnwindInfo_h_ 11292932Sdim 12292932Sdim#include "lldb/Symbol/ObjectFile.h" 13321369Sdim#include "lldb/Utility/DataExtractor.h" 14353358Sdim#include "lldb/Utility/RangeMap.h" 15292932Sdim#include "lldb/lldb-private.h" 16353358Sdim#include <vector> 17292932Sdim 18292932Sdim/* 19292932Sdim * Unwind information reader and parser for the ARM exception handling ABI 20292932Sdim * 21292932Sdim * Implemented based on: 22292932Sdim * Exception Handling ABI for the ARM Architecture 23292932Sdim * Document number: ARM IHI 0038A (current through ABI r2.09) 24292932Sdim * Date of Issue: 25th January 2007, reissued 30th November 2012 25292932Sdim * http://infocenter.arm.com/help/topic/com.arm.doc.ihi0038a/IHI0038A_ehabi.pdf 26292932Sdim */ 27292932Sdim 28292932Sdimnamespace lldb_private { 29292932Sdim 30314564Sdimclass ArmUnwindInfo { 31292932Sdimpublic: 32327952Sdim ArmUnwindInfo(ObjectFile &objfile, lldb::SectionSP &arm_exidx, 33314564Sdim lldb::SectionSP &arm_extab); 34292932Sdim 35314564Sdim ~ArmUnwindInfo(); 36292932Sdim 37314564Sdim bool GetUnwindPlan(Target &target, const Address &addr, 38314564Sdim UnwindPlan &unwind_plan); 39292932Sdim 40292932Sdimprivate: 41314564Sdim struct ArmExidxEntry { 42314564Sdim ArmExidxEntry(uint32_t f, lldb::addr_t a, uint32_t d); 43292932Sdim 44314564Sdim bool operator<(const ArmExidxEntry &other) const; 45292932Sdim 46314564Sdim uint32_t file_address; 47314564Sdim lldb::addr_t address; 48314564Sdim uint32_t data; 49314564Sdim }; 50292932Sdim 51314564Sdim const uint8_t *GetExceptionHandlingTableEntry(const Address &addr); 52292932Sdim 53314564Sdim uint8_t GetByteAtOffset(const uint32_t *data, uint16_t offset) const; 54292932Sdim 55314564Sdim uint64_t GetULEB128(const uint32_t *data, uint16_t &offset, 56314564Sdim uint16_t max_offset) const; 57292932Sdim 58314564Sdim const lldb::ByteOrder m_byte_order; 59314564Sdim lldb::SectionSP m_arm_exidx_sp; // .ARM.exidx section 60314564Sdim lldb::SectionSP m_arm_extab_sp; // .ARM.extab section 61314564Sdim DataExtractor m_arm_exidx_data; // .ARM.exidx section data 62314564Sdim DataExtractor m_arm_extab_data; // .ARM.extab section data 63314564Sdim std::vector<ArmExidxEntry> m_exidx_entries; 64292932Sdim}; 65292932Sdim 66292932Sdim} // namespace lldb_private 67292932Sdim 68314564Sdim#endif // liblldb_ArmUnwindInfo_h_ 69