ArmUnwindInfo.h revision 296417
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/Host/Mutex.h"
18#include "lldb/Symbol/ObjectFile.h"
19#include "lldb/lldb-private.h"
20
21/*
22 * Unwind information reader and parser for the ARM exception handling ABI
23 *
24 * Implemented based on:
25 *     Exception Handling ABI for the ARM Architecture
26 *     Document number: ARM IHI 0038A (current through ABI r2.09)
27 *     Date of Issue: 25th January 2007, reissued 30th November 2012
28 *     http://infocenter.arm.com/help/topic/com.arm.doc.ihi0038a/IHI0038A_ehabi.pdf
29 */
30
31namespace lldb_private {
32
33class ArmUnwindInfo
34{
35public:
36    ArmUnwindInfo(const ObjectFile& objfile,
37                  lldb::SectionSP& arm_exidx,
38                  lldb::SectionSP& arm_extab);
39
40    ~ArmUnwindInfo();
41
42    bool
43    GetUnwindPlan(Target &target, const Address& addr, UnwindPlan& unwind_plan);
44
45private:
46    struct ArmExidxEntry
47    {
48        ArmExidxEntry(uint32_t f, lldb::addr_t a, uint32_t d);
49
50        bool
51        operator<(const ArmExidxEntry& other) const;
52
53        uint32_t file_address;
54        lldb::addr_t address;
55        uint32_t data;
56    };
57
58    const uint8_t*
59    GetExceptionHandlingTableEntry(const Address& addr);
60
61    uint8_t
62    GetByteAtOffset(const uint32_t* data, uint16_t offset) const;
63
64    uint64_t
65    GetULEB128(const uint32_t* data, uint16_t& offset, uint16_t max_offset) const;
66
67    const lldb::ByteOrder m_byte_order;
68    lldb::SectionSP m_arm_exidx_sp; // .ARM.exidx section
69    lldb::SectionSP m_arm_extab_sp; // .ARM.extab section
70    DataExtractor m_arm_exidx_data; // .ARM.exidx section data
71    DataExtractor m_arm_extab_data; // .ARM.extab section data
72    std::vector<ArmExidxEntry> m_exidx_entries;
73};
74
75} // namespace lldb_private
76
77#endif  // liblldb_ArmUnwindInfo_h_
78