ArmUnwindInfo.h revision 309124
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/DataExtractor.h"
16#include "lldb/Core/RangeMap.h"
17#include "lldb/Symbol/ObjectFile.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
33{
34public:
35    ArmUnwindInfo(const ObjectFile& objfile,
36                  lldb::SectionSP& arm_exidx,
37                  lldb::SectionSP& arm_extab);
38
39    ~ArmUnwindInfo();
40
41    bool
42    GetUnwindPlan(Target &target, const Address& addr, UnwindPlan& unwind_plan);
43
44private:
45    struct ArmExidxEntry
46    {
47        ArmExidxEntry(uint32_t f, lldb::addr_t a, uint32_t d);
48
49        bool
50        operator<(const ArmExidxEntry& other) const;
51
52        uint32_t file_address;
53        lldb::addr_t address;
54        uint32_t data;
55    };
56
57    const uint8_t*
58    GetExceptionHandlingTableEntry(const Address& addr);
59
60    uint8_t
61    GetByteAtOffset(const uint32_t* data, uint16_t offset) const;
62
63    uint64_t
64    GetULEB128(const uint32_t* data, uint16_t& offset, uint16_t max_offset) const;
65
66    const lldb::ByteOrder m_byte_order;
67    lldb::SectionSP m_arm_exidx_sp; // .ARM.exidx section
68    lldb::SectionSP m_arm_extab_sp; // .ARM.extab section
69    DataExtractor m_arm_exidx_data; // .ARM.exidx section data
70    DataExtractor m_arm_extab_data; // .ARM.extab section data
71    std::vector<ArmExidxEntry> m_exidx_entries;
72};
73
74} // namespace lldb_private
75
76#endif  // liblldb_ArmUnwindInfo_h_
77