Files
clang-p2996/lldb/source/Plugins/Process/Utility/EmulateInstructionARM.h
Greg Clayton 6da4ca83b0 Added the start of opcode emulation for ARM instructions. This class is designed
to be fed 4 callbacks: read/write memory, and read/write registers. After this,
you can tell the object to read an instruction. This will cause the class to read
the PC, and read and instruction. Then you can emulate the instruction by calling
EvaluateInstruction. This will cause the class to figure out exactly what an opcode
does, and call the read/write mem/regs functions with actual values which allows one
to emulate an instruction without running a process, or it allows one to watch the
context information (the memory write is a pushing register 3 onto the stack at offset
12) so it can be used for generating call frame information. This way, in the future,
we will have one class that can be used to emulate instructions and generate our
unwind info from assembly.

llvm-svn: 123998
2011-01-21 22:02:52 +00:00

66 lines
1.6 KiB
C++

//===-- lldb_EmulateInstructionARM.h ------------------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#ifndef lldb_EmulateInstructionARM_h_
#define lldb_EmulateInstructionARM_h_
#include "EmulateInstruction.h"
#include "ARM_DWARF_Registers.h"
namespace lldb_private {
class EmulateInstructionARM : public EmulateInstruction
{
public:
enum Mode
{
eModeInvalid,
eModeARM,
eModeThumb
};
EmulateInstructionARM (void *baton,
ReadMemory read_mem_callback,
WriteMemory write_mem_callback,
ReadRegister read_reg_callback,
WriteRegister write_reg_callback) :
EmulateInstruction (lldb::eByteOrderLittle, // Byte order for ARM
4, // Address size in byte
baton,
read_mem_callback,
write_mem_callback,
read_reg_callback,
write_reg_callback),
m_inst_mode (eModeInvalid)
{
}
virtual bool
ReadInstruction ();
virtual bool
EvaluateInstruction ();
bool
ConditionPassed ();
uint32_t
CurrentCond ();
protected:
Mode m_inst_mode;
uint32_t m_inst_cpsr;
};
} // namespace lldb_private
#endif // lldb_EmulateInstructionARM_h_