[Lldb-commits] [lldb] r124563 - in /lldb/trunk/source/Plugins/Process/Utility: EmulateInstruction.h EmulateInstructionARM.cpp EmulateInstructionARM.h
Greg Clayton
gclayton at apple.com
Sun Jan 30 12:03:57 PST 2011
Author: gclayton
Date: Sun Jan 30 14:03:56 2011
New Revision: 124563
URL: http://llvm.org/viewvc/llvm-project?rev=124563&view=rev
Log:
Added the start of the plug-in interface to EmulateInstruction
and implemented it for the EmulateInstructionARM class.
Modified:
lldb/trunk/source/Plugins/Process/Utility/EmulateInstruction.h
lldb/trunk/source/Plugins/Process/Utility/EmulateInstructionARM.cpp
lldb/trunk/source/Plugins/Process/Utility/EmulateInstructionARM.h
Modified: lldb/trunk/source/Plugins/Process/Utility/EmulateInstruction.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/EmulateInstruction.h?rev=124563&r1=124562&r2=124563&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Utility/EmulateInstruction.h (original)
+++ lldb/trunk/source/Plugins/Process/Utility/EmulateInstruction.h Sun Jan 30 14:03:56 2011
@@ -11,7 +11,7 @@
#define lldb_EmulateInstruction_h_
#include "lldb/lldb-include.h"
-
+#include "lldb/Core/PluginInterface.h"
//----------------------------------------------------------------------
/// @class EmulateInstruction EmulateInstruction.h "lldb/Core/EmulateInstruction.h"
@@ -75,9 +75,14 @@
namespace lldb_private {
-class EmulateInstruction
+class EmulateInstruction :
+ public PluginInterface
{
-public:
+public:
+
+ static Disassembler*
+ FindPlugin (const ArchSpec &arch);
+
enum ContextType
{
eContextInvalid = 0,
@@ -188,6 +193,9 @@
{
}
+ virtual bool
+ SetTargetTriple (const ConstString &triple) = 0;
+
virtual bool
ReadInstruction () = 0;
Modified: lldb/trunk/source/Plugins/Process/Utility/EmulateInstructionARM.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/EmulateInstructionARM.cpp?rev=124563&r1=124562&r2=124563&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Utility/EmulateInstructionARM.cpp (original)
+++ lldb/trunk/source/Plugins/Process/Utility/EmulateInstructionARM.cpp Sun Jan 30 14:03:56 2011
@@ -10,6 +10,7 @@
#include "EmulateInstructionARM.h"
#include "ARMDefines.h"
#include "ARMUtils.h"
+#include "lldb/Core/ConstString.h"
using namespace lldb;
using namespace lldb_private;
@@ -881,6 +882,44 @@
static const size_t k_num_arm_opcodes = sizeof(g_arm_opcodes)/sizeof(ARMOpcode);
static const size_t k_num_thumb_opcodes = sizeof(g_thumb_opcodes)/sizeof(ARMOpcode);
+bool
+EmulateInstructionARM::SetTargetTriple (const ConstString &triple)
+{
+ m_arm_isa = 0;
+ const char *triple_cstr = triple.GetCString();
+ if (triple_cstr)
+ {
+ const char *dash = ::strchr (triple_cstr, '-');
+ if (dash)
+ {
+ std::string arch (triple_cstr, dash);
+ const char *arch_cstr = arch.c_str();
+ if (strcasecmp(arch_cstr, "armv4t") == 0)
+ m_arm_isa = ARMv4T;
+ else if (strcasecmp(arch_cstr, "armv4") == 0)
+ m_arm_isa = ARMv4;
+ else if (strcasecmp(arch_cstr, "armv5tej") == 0)
+ m_arm_isa = ARMv5TEJ;
+ else if (strcasecmp(arch_cstr, "armv5te") == 0)
+ m_arm_isa = ARMv5TE;
+ else if (strcasecmp(arch_cstr, "armv5t") == 0)
+ m_arm_isa = ARMv5T;
+ else if (strcasecmp(arch_cstr, "armv6k") == 0)
+ m_arm_isa = ARMv6K;
+ else if (strcasecmp(arch_cstr, "armv6") == 0)
+ m_arm_isa = ARMv6;
+ else if (strcasecmp(arch_cstr, "armv6t2") == 0)
+ m_arm_isa = ARMv6T2;
+ else if (strcasecmp(arch_cstr, "armv7") == 0)
+ m_arm_isa = ARMv7;
+ else if (strcasecmp(arch_cstr, "armv8") == 0)
+ m_arm_isa = ARMv8;
+ }
+ }
+ return m_arm_isa != 0;
+}
+
+
bool
EmulateInstructionARM::ReadInstruction ()
{
Modified: lldb/trunk/source/Plugins/Process/Utility/EmulateInstructionARM.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/EmulateInstructionARM.h?rev=124563&r1=124562&r2=124563&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Utility/EmulateInstructionARM.h (original)
+++ lldb/trunk/source/Plugins/Process/Utility/EmulateInstructionARM.h Sun Jan 30 14:03:56 2011
@@ -13,11 +13,51 @@
#include "EmulateInstruction.h"
#include "ARM_DWARF_Registers.h"
+#include "lldb/Core/Error.h"
+
namespace lldb_private {
class EmulateInstructionARM : public EmulateInstruction
{
public:
+
+ virtual const char *
+ GetPluginName()
+ {
+ return "EmulateInstructionARM";
+ }
+
+ virtual const char *
+ GetShortPluginName()
+ {
+ return "lldb.emulate-instruction.arm";
+ }
+
+ virtual uint32_t
+ GetPluginVersion()
+ {
+ return 1;
+ }
+
+ virtual void
+ GetPluginCommandHelp (const char *command, Stream *strm)
+ {
+ }
+
+ virtual lldb_private::Error
+ ExecutePluginCommand (Args &command, Stream *strm)
+ {
+ Error error;
+ error.SetErrorString("no plug-in commands are supported");
+ return error;
+ }
+
+ virtual Log *
+ EnablePluginLogging (Stream *strm, Args &command)
+ {
+ return NULL;
+ }
+
enum Mode
{
eModeInvalid,
@@ -37,9 +77,15 @@
write_mem_callback,
read_reg_callback,
write_reg_callback),
- m_inst_mode (eModeInvalid)
+ m_arm_isa (0),
+ m_inst_mode (eModeInvalid),
+ m_inst_cpsr (0)
{
}
+
+
+ virtual bool
+ SetTargetTriple (const ConstString &triple);
virtual bool
ReadInstruction ();
@@ -54,7 +100,7 @@
CurrentCond ();
protected:
-
+ uint32_t m_arm_isa;
Mode m_inst_mode;
uint32_t m_inst_cpsr;
More information about the lldb-commits
mailing list