ArmUnwindInfo.h revision 327952
1292932Sdim//===-- ArmUnwindInfo.h -----------------------------------------*- C++ -*-===//
2292932Sdim//
3292932Sdim//                     The LLVM Compiler Infrastructure
4292932Sdim//
5292932Sdim// This file is distributed under the University of Illinois Open Source
6292932Sdim// License. See LICENSE.TXT for details.
7292932Sdim//
8292932Sdim//===----------------------------------------------------------------------===//
9292932Sdim
10292932Sdim#ifndef liblldb_ArmUnwindInfo_h_
11292932Sdim#define liblldb_ArmUnwindInfo_h_
12292932Sdim
13292932Sdim#include <vector>
14292932Sdim
15292932Sdim#include "lldb/Core/RangeMap.h"
16292932Sdim#include "lldb/Symbol/ObjectFile.h"
17321369Sdim#include "lldb/Utility/DataExtractor.h"
18292932Sdim#include "lldb/lldb-private.h"
19292932Sdim
20292932Sdim/*
21292932Sdim * Unwind information reader and parser for the ARM exception handling ABI
22292932Sdim *
23292932Sdim * Implemented based on:
24292932Sdim *     Exception Handling ABI for the ARM Architecture
25292932Sdim *     Document number: ARM IHI 0038A (current through ABI r2.09)
26292932Sdim *     Date of Issue: 25th January 2007, reissued 30th November 2012
27292932Sdim *     http://infocenter.arm.com/help/topic/com.arm.doc.ihi0038a/IHI0038A_ehabi.pdf
28292932Sdim */
29292932Sdim
30292932Sdimnamespace lldb_private {
31292932Sdim
32314564Sdimclass ArmUnwindInfo {
33292932Sdimpublic:
34327952Sdim  ArmUnwindInfo(ObjectFile &objfile, lldb::SectionSP &arm_exidx,
35314564Sdim                lldb::SectionSP &arm_extab);
36292932Sdim
37314564Sdim  ~ArmUnwindInfo();
38292932Sdim
39314564Sdim  bool GetUnwindPlan(Target &target, const Address &addr,
40314564Sdim                     UnwindPlan &unwind_plan);
41292932Sdim
42292932Sdimprivate:
43314564Sdim  struct ArmExidxEntry {
44314564Sdim    ArmExidxEntry(uint32_t f, lldb::addr_t a, uint32_t d);
45292932Sdim
46314564Sdim    bool operator<(const ArmExidxEntry &other) const;
47292932Sdim
48314564Sdim    uint32_t file_address;
49314564Sdim    lldb::addr_t address;
50314564Sdim    uint32_t data;
51314564Sdim  };
52292932Sdim
53314564Sdim  const uint8_t *GetExceptionHandlingTableEntry(const Address &addr);
54292932Sdim
55314564Sdim  uint8_t GetByteAtOffset(const uint32_t *data, uint16_t offset) const;
56292932Sdim
57314564Sdim  uint64_t GetULEB128(const uint32_t *data, uint16_t &offset,
58314564Sdim                      uint16_t max_offset) const;
59292932Sdim
60314564Sdim  const lldb::ByteOrder m_byte_order;
61314564Sdim  lldb::SectionSP m_arm_exidx_sp; // .ARM.exidx section
62314564Sdim  lldb::SectionSP m_arm_extab_sp; // .ARM.extab section
63314564Sdim  DataExtractor m_arm_exidx_data; // .ARM.exidx section data
64314564Sdim  DataExtractor m_arm_extab_data; // .ARM.extab section data
65314564Sdim  std::vector<ArmExidxEntry> m_exidx_entries;
66292932Sdim};
67292932Sdim
68292932Sdim} // namespace lldb_private
69292932Sdim
70314564Sdim#endif // liblldb_ArmUnwindInfo_h_
71