aboutsummaryrefslogtreecommitdiff
path: root/include/lldb/Symbol/ArmUnwindInfo.h
blob: 8c40f19d2859219b7756bc71c3bf612739d2fba5 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
//===-- ArmUnwindInfo.h -----------------------------------------*- C++ -*-===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

#ifndef liblldb_ArmUnwindInfo_h_
#define liblldb_ArmUnwindInfo_h_

#include <vector>

#include "lldb/Core/DataExtractor.h"
#include "lldb/Core/RangeMap.h"
#include "lldb/Symbol/ObjectFile.h"
#include "lldb/lldb-private.h"

/*
 * Unwind information reader and parser for the ARM exception handling ABI
 *
 * Implemented based on:
 *     Exception Handling ABI for the ARM Architecture
 *     Document number: ARM IHI 0038A (current through ABI r2.09)
 *     Date of Issue: 25th January 2007, reissued 30th November 2012
 *     http://infocenter.arm.com/help/topic/com.arm.doc.ihi0038a/IHI0038A_ehabi.pdf
 */

namespace lldb_private {

class ArmUnwindInfo
{
public:
    ArmUnwindInfo(const ObjectFile& objfile,
                  lldb::SectionSP& arm_exidx,
                  lldb::SectionSP& arm_extab);

    ~ArmUnwindInfo();

    bool
    GetUnwindPlan(Target &target, const Address& addr, UnwindPlan& unwind_plan);

private:
    struct ArmExidxEntry
    {
        ArmExidxEntry(uint32_t f, lldb::addr_t a, uint32_t d);

        bool
        operator<(const ArmExidxEntry& other) const;

        uint32_t file_address;
        lldb::addr_t address;
        uint32_t data;
    };

    const uint8_t*
    GetExceptionHandlingTableEntry(const Address& addr);

    uint8_t
    GetByteAtOffset(const uint32_t* data, uint16_t offset) const;

    uint64_t
    GetULEB128(const uint32_t* data, uint16_t& offset, uint16_t max_offset) const;

    const lldb::ByteOrder m_byte_order;
    lldb::SectionSP m_arm_exidx_sp; // .ARM.exidx section
    lldb::SectionSP m_arm_extab_sp; // .ARM.extab section
    DataExtractor m_arm_exidx_data; // .ARM.exidx section data
    DataExtractor m_arm_extab_data; // .ARM.extab section data
    std::vector<ArmExidxEntry> m_exidx_entries;
};

} // namespace lldb_private

#endif  // liblldb_ArmUnwindInfo_h_