EmulateInstructionARM.h revision 8482dedc1d0fb4669d1ec63ec259d1cb8eaeb20f
1//===-- lldb_EmulateInstructionARM.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 lldb_EmulateInstructionARM_h_
11#define lldb_EmulateInstructionARM_h_
12
13#include "lldb/Core/EmulateInstruction.h"
14#include "lldb/Core/Error.h"
15
16namespace lldb_private {
17
18class EmulateInstructionARM : public EmulateInstruction
19{
20public:
21
22    virtual const char *
23    GetPluginName()
24    {
25        return "EmulateInstructionARM";
26    }
27
28    virtual const char *
29    GetShortPluginName()
30    {
31        return "lldb.emulate-instruction.arm";
32    }
33
34    virtual uint32_t
35    GetPluginVersion()
36    {
37        return 1;
38    }
39
40    virtual void
41    GetPluginCommandHelp (const char *command, Stream *strm)
42    {
43    }
44
45    virtual lldb_private::Error
46    ExecutePluginCommand (Args &command, Stream *strm)
47    {
48        Error error;
49        error.SetErrorString("no plug-in commands are supported");
50        return error;
51    }
52
53    virtual Log *
54    EnablePluginLogging (Stream *strm, Args &command)
55    {
56        return NULL;
57    }
58
59    enum Mode
60    {
61        eModeInvalid,
62        eModeARM,
63        eModeThumb
64    };
65
66    EmulateInstructionARM (void *baton,
67                           ReadMemory read_mem_callback,
68                           WriteMemory write_mem_callback,
69                           ReadRegister read_reg_callback,
70                           WriteRegister write_reg_callback) :
71        EmulateInstruction (lldb::eByteOrderLittle, // Byte order for ARM
72                            4,                      // Address size in byte
73                            baton,
74                            read_mem_callback,
75                            write_mem_callback,
76                            read_reg_callback,
77                            write_reg_callback),
78        m_arm_isa (0),
79        m_inst_mode (eModeInvalid),
80        m_inst_cpsr (0)
81    {
82    }
83
84
85    virtual bool
86    SetTargetTriple (const ConstString &triple);
87
88    virtual bool
89    ReadInstruction ();
90
91    virtual bool
92    EvaluateInstruction ();
93
94    bool
95    ConditionPassed ();
96
97    uint32_t
98    CurrentCond ();
99
100protected:
101    uint32_t m_arm_isa;
102    Mode m_inst_mode;
103    uint32_t m_inst_cpsr;
104
105};
106
107}   // namespace lldb_private
108
109#endif  // lldb_EmulateInstructionARM_h_
110