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