summaryrefslogtreecommitdiffstats
path: root/lldb/include
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/include')
-rw-r--r--lldb/include/lldb/API/SBInstruction.h2
-rw-r--r--lldb/include/lldb/Core/Disassembler.h2
-rw-r--r--lldb/include/lldb/Core/EmulateInstruction.h92
-rw-r--r--lldb/include/lldb/Target/ArchDefaultUnwindPlan.h3
-rw-r--r--lldb/include/lldb/Target/UnwindAssembly.h6
-rw-r--r--lldb/include/lldb/lldb-enumerations.h7
-rw-r--r--lldb/include/lldb/lldb-private-enumerations.h13
-rw-r--r--lldb/include/lldb/lldb-private-interfaces.h2
8 files changed, 81 insertions, 46 deletions
diff --git a/lldb/include/lldb/API/SBInstruction.h b/lldb/include/lldb/API/SBInstruction.h
index 880cbe17202..79ffd8e27e2 100644
--- a/lldb/include/lldb/API/SBInstruction.h
+++ b/lldb/include/lldb/API/SBInstruction.h
@@ -53,7 +53,7 @@ public:
GetDescription (lldb::SBStream &description);
bool
- EmulateWithFrame (lldb::SBFrame &frame, bool auto_advance_pc);
+ EmulateWithFrame (lldb::SBFrame &frame, uint32_t evaluate_options);
bool
DumpEmulation (const char * triple); // triple is to specify the architecture, e.g. 'armv6' or 'arm-apple-darwin'
diff --git a/lldb/include/lldb/Core/Disassembler.h b/lldb/include/lldb/Core/Disassembler.h
index 8c5a0c1a686..2a0433cad8e 100644
--- a/lldb/include/lldb/Core/Disassembler.h
+++ b/lldb/include/lldb/Core/Disassembler.h
@@ -86,7 +86,7 @@ public:
bool
Emulate (const ArchSpec &arch,
- bool auto_advance_pc,
+ uint32_t evaluate_options,
void *baton,
EmulateInstruction::ReadMemory read_mem_callback,
EmulateInstruction::WriteMemory write_mem_calback,
diff --git a/lldb/include/lldb/Core/EmulateInstruction.h b/lldb/include/lldb/Core/EmulateInstruction.h
index 590fa18fa8e..a0ecdc91ce6 100644
--- a/lldb/include/lldb/Core/EmulateInstruction.h
+++ b/lldb/include/lldb/Core/EmulateInstruction.h
@@ -86,7 +86,9 @@ class EmulateInstruction :
public:
static EmulateInstruction*
- FindPlugin (const ArchSpec &arch, const char *plugin_name);
+ FindPlugin (const ArchSpec &arch,
+ InstructionType supported_inst_type,
+ const char *plugin_name);
enum ContextType
{
@@ -366,45 +368,43 @@ public:
static void
PrintContext (const char *context_type, const Context &context);
- typedef size_t (*ReadMemory) (void *baton,
+ typedef size_t (*ReadMemory) (EmulateInstruction *instruction,
+ void *baton,
const Context &context,
lldb::addr_t addr,
void *dst,
size_t length);
- typedef size_t (*WriteMemory) (void *baton,
+ typedef size_t (*WriteMemory) (EmulateInstruction *instruction,
+ void *baton,
const Context &context,
lldb::addr_t addr,
const void *dst,
size_t length);
- typedef bool (*ReadRegister) (void *baton,
+ typedef bool (*ReadRegister) (EmulateInstruction *instruction,
+ void *baton,
uint32_t reg_kind,
uint32_t reg_num,
uint64_t &reg_value);
- typedef bool (*WriteRegister) (void *baton,
+ typedef bool (*WriteRegister) (EmulateInstruction *instruction,
+ void *baton,
const Context &context,
uint32_t reg_kind,
uint32_t reg_num,
uint64_t reg_value);
- EmulateInstruction (lldb::ByteOrder byte_order,
- uint32_t addr_byte_size,
- const ArchSpec &arch,
- void *baton,
- ReadMemory read_mem_callback,
- WriteMemory write_mem_callback,
- ReadRegister read_reg_callback,
- WriteRegister write_reg_callback);
-
- EmulateInstruction (lldb::ByteOrder byte_order,
- uint32_t addr_byte_size,
- const ArchSpec &arch);
+ EmulateInstruction (const ArchSpec &arch);
virtual ~EmulateInstruction()
{
}
+ //----------------------------------------------------------------------
+ // Mandatory overrides
+ //----------------------------------------------------------------------
+ virtual bool
+ SupportsEmulatingIntructionsOfType (InstructionType inst_type) = 0;
virtual bool
SetTargetTriple (const ArchSpec &arch) = 0;
@@ -413,21 +413,20 @@ public:
ReadInstruction () = 0;
virtual bool
- SetInstruction (const Opcode &insn_opcode, const Address &inst_addr) = 0;
-
- virtual bool
- EvaluateInstruction () = 0;
+ EvaluateInstruction (uint32_t evaluate_options) = 0;
virtual bool
TestEmulation (Stream *out_stream, ArchSpec &arch, OptionValueDictionary *test_data) = 0;
+
+ virtual const char *
+ GetRegisterName (uint32_t reg_kind, uint32_t reg_num) = 0;
+ //----------------------------------------------------------------------
+ // Optional overrides
+ //----------------------------------------------------------------------
+ virtual bool
+ SetInstruction (const Opcode &insn_opcode, const Address &inst_addr, Target *target);
- bool
- GetAdvancePC () { return m_advance_pc; }
-
- void
- SetAdvancePC (bool value) { m_advance_pc = value; }
-
- static void
+ static const char *
TranslateRegister (uint32_t reg_kind, uint32_t reg_num, std::string &reg_name);
uint64_t
@@ -458,13 +457,13 @@ public:
uint32_t
GetAddressByteSize () const
{
- return m_addr_byte_size;
+ return m_arch.GetAddressByteSize();
}
lldb::ByteOrder
GetByteOrder () const
{
- return m_byte_order;
+ return m_arch.GetByteOrder();
}
const Opcode &
@@ -472,59 +471,73 @@ public:
{
return m_opcode;
}
+
+ const ArchSpec &
+ GetArchitecture () const
+ {
+ return m_arch;
+ }
static size_t
- ReadMemoryFrame (void *baton,
+ ReadMemoryFrame (EmulateInstruction *instruction,
+ void *baton,
const Context &context,
lldb::addr_t addr,
void *dst,
size_t length);
static size_t
- WriteMemoryFrame (void *baton,
+ WriteMemoryFrame (EmulateInstruction *instruction,
+ void *baton,
const Context &context,
lldb::addr_t addr,
const void *dst,
size_t length);
static bool
- ReadRegisterFrame (void *baton,
+ ReadRegisterFrame (EmulateInstruction *instruction,
+ void *baton,
uint32_t reg_kind,
uint32_t reg_num,
uint64_t &reg_value);
static bool
- WriteRegisterFrame (void *baton,
+ WriteRegisterFrame (EmulateInstruction *instruction,
+ void *baton,
const Context &context,
uint32_t reg_kind,
uint32_t reg_num,
uint64_t reg_value);
static size_t
- ReadMemoryDefault (void *baton,
+ ReadMemoryDefault (EmulateInstruction *instruction,
+ void *baton,
const Context &context,
lldb::addr_t addr,
void *dst,
size_t length);
static size_t
- WriteMemoryDefault (void *baton,
+ WriteMemoryDefault (EmulateInstruction *instruction,
+ void *baton,
const Context &context,
lldb::addr_t addr,
const void *dst,
size_t length);
static bool
- ReadRegisterDefault (void *baton,
+ ReadRegisterDefault (EmulateInstruction *instruction,
+ void *baton,
uint32_t reg_kind,
uint32_t reg_num,
uint64_t &reg_value);
static bool
- WriteRegisterDefault (void *baton,
+ WriteRegisterDefault (EmulateInstruction *instruction,
+ void *baton,
const Context &context,
uint32_t reg_kind,
uint32_t reg_num,
@@ -553,8 +566,6 @@ public:
protected:
- lldb::ByteOrder m_byte_order;
- uint32_t m_addr_byte_size;
ArchSpec m_arch;
void * m_baton;
ReadMemory m_read_mem_callback;
@@ -563,7 +574,6 @@ protected:
WriteRegister m_write_reg_callback;
lldb::addr_t m_opcode_pc;
Opcode m_opcode;
- bool m_advance_pc;
//------------------------------------------------------------------
// For EmulateInstruction only
//------------------------------------------------------------------
diff --git a/lldb/include/lldb/Target/ArchDefaultUnwindPlan.h b/lldb/include/lldb/Target/ArchDefaultUnwindPlan.h
index 932e4ef56ac..ad848fa8efe 100644
--- a/lldb/include/lldb/Target/ArchDefaultUnwindPlan.h
+++ b/lldb/include/lldb/Target/ArchDefaultUnwindPlan.h
@@ -24,7 +24,8 @@ public:
~ArchDefaultUnwindPlan();
virtual lldb::UnwindPlanSP
- GetArchDefaultUnwindPlan (Thread& thread, Address current_pc) = 0;
+ GetArchDefaultUnwindPlan (Thread& thread,
+ const Address &current_pc) = 0;
static lldb::ArchDefaultUnwindPlanSP
FindPlugin (const ArchSpec &arch);
diff --git a/lldb/include/lldb/Target/UnwindAssembly.h b/lldb/include/lldb/Target/UnwindAssembly.h
index 296f6376951..2630932bd51 100644
--- a/lldb/include/lldb/Target/UnwindAssembly.h
+++ b/lldb/include/lldb/Target/UnwindAssembly.h
@@ -11,6 +11,7 @@
#define utility_UnwindAssembly_h_
#include "lldb/lldb-private.h"
+#include "lldb/Core/ArchSpec.h"
#include "lldb/Core/PluginInterface.h"
namespace lldb_private {
@@ -43,8 +44,11 @@ public:
Address& first_non_prologue_insn) = 0;
protected:
- UnwindAssembly();
+ UnwindAssembly (const ArchSpec &arch);
+ ArchSpec m_arch;
+
private:
+ UnwindAssembly(); // Outlaw default constructor
DISALLOW_COPY_AND_ASSIGN (UnwindAssembly);
};
diff --git a/lldb/include/lldb/lldb-enumerations.h b/lldb/include/lldb/lldb-enumerations.h
index 7f3b30a374c..a3388b8873a 100644
--- a/lldb/include/lldb/lldb-enumerations.h
+++ b/lldb/include/lldb/lldb-enumerations.h
@@ -457,6 +457,13 @@ namespace lldb {
} SectionType;
+ typedef enum EmulateInstructionOptions
+ {
+ eEmulateInstructionOptionNone = (0u),
+ eEmulateInstructionOptionAutoAdvancePC = (1u << 0),
+ eEmulateInstructionOptionIgnoreConditions = (1u << 1)
+ } EmulateInstructionOptions;
+
} // namespace lldb
diff --git a/lldb/include/lldb/lldb-private-enumerations.h b/lldb/include/lldb/lldb-private-enumerations.h
index ba22e71ec4e..fddc02daefd 100644
--- a/lldb/include/lldb/lldb-private-enumerations.h
+++ b/lldb/include/lldb/lldb-private-enumerations.h
@@ -204,6 +204,19 @@ typedef enum NameMatchType
} NameMatchType;
+//------------------------------------------------------------------
+/// Instruction types
+//------------------------------------------------------------------
+typedef enum InstructionType
+{
+ eInstructionTypeAny, // Support for any instructions at all (at least one)
+ eInstructionTypePrologueEpilogue, // All prologue and epilogue instructons that push and pop register values and modify sp/fp
+ eInstructionTypePCModifying, // Any instruction that modifies the program counter/instruction pointer
+ eInstructionTypeAll // All instructions of any kind
+
+} InstructionType;
+
+
} // namespace lldb
diff --git a/lldb/include/lldb/lldb-private-interfaces.h b/lldb/include/lldb/lldb-private-interfaces.h
index c22371cbb51..0111c92bf15 100644
--- a/lldb/include/lldb/lldb-private-interfaces.h
+++ b/lldb/include/lldb/lldb-private-interfaces.h
@@ -22,7 +22,7 @@ namespace lldb_private
typedef ObjectContainer* (*ObjectContainerCreateInstance) (Module* module, lldb::DataBufferSP& dataSP, const FileSpec *file, lldb::addr_t offset, lldb::addr_t length);
typedef ObjectFile* (*ObjectFileCreateInstance) (Module* module, lldb::DataBufferSP& dataSP, const FileSpec* file, lldb::addr_t offset, lldb::addr_t length);
typedef LogChannel* (*LogChannelCreateInstance) ();
- typedef EmulateInstruction * (*EmulateInstructionCreateInstance) (const ArchSpec &arch);
+ typedef EmulateInstruction * (*EmulateInstructionCreateInstance) (const ArchSpec &arch, InstructionType inst_type);
typedef LanguageRuntime *(*LanguageRuntimeCreateInstance) (Process *process, lldb::LanguageType language);
typedef Platform* (*PlatformCreateInstance) ();
typedef Process* (*ProcessCreateInstance) (Target &target, Listener &listener);
OpenPOWER on IntegriCloud