summaryrefslogtreecommitdiffstats
path: root/lldb/include
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/include')
-rw-r--r--lldb/include/lldb/API/SBAddress.h1
-rw-r--r--lldb/include/lldb/API/SBFunction.h4
-rw-r--r--lldb/include/lldb/API/SBInstruction.h34
-rw-r--r--lldb/include/lldb/API/SBInstructionList.h16
-rw-r--r--lldb/include/lldb/API/SBProcess.h1
-rw-r--r--lldb/include/lldb/API/SBStream.h2
-rw-r--r--lldb/include/lldb/API/SBSymbol.h5
-rw-r--r--lldb/include/lldb/API/SBTarget.h2
-rw-r--r--lldb/include/lldb/Core/Disassembler.h107
-rw-r--r--lldb/include/lldb/lldb-forward-rtti.h2
-rw-r--r--lldb/include/lldb/lldb-forward.h1
11 files changed, 108 insertions, 67 deletions
diff --git a/lldb/include/lldb/API/SBAddress.h b/lldb/include/lldb/API/SBAddress.h
index ffafdf179bb..b5386cafa6d 100644
--- a/lldb/include/lldb/API/SBAddress.h
+++ b/lldb/include/lldb/API/SBAddress.h
@@ -51,6 +51,7 @@ protected:
friend class SBFrame;
friend class SBLineEntry;
+ friend class SBInstruction;
friend class SBModule;
friend class SBSymbolContext;
friend class SBThread;
diff --git a/lldb/include/lldb/API/SBFunction.h b/lldb/include/lldb/API/SBFunction.h
index 643d5273471..eb42ded518a 100644
--- a/lldb/include/lldb/API/SBFunction.h
+++ b/lldb/include/lldb/API/SBFunction.h
@@ -11,6 +11,7 @@
#define LLDB_SBFunction_h_
#include "lldb/API/SBDefines.h"
+#include "lldb/API/SBInstructionList.h"
namespace lldb {
@@ -31,6 +32,9 @@ public:
const char *
GetMangledName () const;
+ lldb::SBInstructionList
+ GetInstructions (lldb::SBTarget target);
+
#ifndef SWIG
bool
operator == (const lldb::SBFunction &rhs) const;
diff --git a/lldb/include/lldb/API/SBInstruction.h b/lldb/include/lldb/API/SBInstruction.h
index d64a4d3da0d..7ebdcfc4756 100644
--- a/lldb/include/lldb/API/SBInstruction.h
+++ b/lldb/include/lldb/API/SBInstruction.h
@@ -17,43 +17,45 @@
// There's a lot to be fixed here, but need to wait for underlying insn implementation
// to be revised & settle down first.
-//class lldb_private::Disassembler::Instruction;
-
namespace lldb {
class SBInstruction
{
public:
- //SBInstruction (lldb_private::Disassembler::Instruction *lldb_insn);
-
SBInstruction ();
~SBInstruction ();
- //bool
- //IsValid();
+ bool
+ IsValid();
- //size_t
- //GetByteSize ();
+ SBAddress
+ GetAddress();
- //void
- //SetByteSize (size_t byte_size);
+ size_t
+ GetByteSize ();
- //bool
- //DoesBranch ();
+ bool
+ DoesBranch ();
void
Print (FILE *out);
- //bool
- //GetDescription (lldb::SBStream &description);
+ bool
+ GetDescription (lldb::SBStream &description);
-private:
+protected:
+ friend class SBInstructionList;
- //lldb_private::Disassembler::Instruction::SharedPtr m_opaque_sp;
+ SBInstruction (const lldb::InstructionSP &inst_sp);
+ void
+ SetOpaque (const lldb::InstructionSP &inst_sp);
+
+private:
+ lldb::InstructionSP m_opaque_sp;
};
diff --git a/lldb/include/lldb/API/SBInstructionList.h b/lldb/include/lldb/API/SBInstructionList.h
index ba91420bff5..f8c0abba6df 100644
--- a/lldb/include/lldb/API/SBInstructionList.h
+++ b/lldb/include/lldb/API/SBInstructionList.h
@@ -36,17 +36,21 @@ public:
void
AppendInstruction (lldb::SBInstruction inst);
-
void
Print (FILE *out);
-private:
+ bool
+ GetDescription (lldb::SBStream &description);
- // If we have an instruction list, it will need to be backed by an
- // lldb_private class that contains the list, we can't inherit from
- // std::vector here...
- //std::vector <SBInstruction> m_insn_list;
+protected:
+ friend class SBFunction;
+ friend class SBSymbol;
+
+ void
+ SetDisassembler (const lldb::DisassemblerSP &opaque_sp);
+private:
+ lldb::DisassemblerSP m_opaque_sp;
};
diff --git a/lldb/include/lldb/API/SBProcess.h b/lldb/include/lldb/API/SBProcess.h
index 0e462ce3e92..440622b3526 100644
--- a/lldb/include/lldb/API/SBProcess.h
+++ b/lldb/include/lldb/API/SBProcess.h
@@ -161,6 +161,7 @@ protected:
friend class SBBreakpointLocation;
friend class SBCommandInterpreter;
friend class SBDebugger;
+ friend class SBFunction;
friend class SBTarget;
friend class SBThread;
friend class SBValue;
diff --git a/lldb/include/lldb/API/SBStream.h b/lldb/include/lldb/API/SBStream.h
index 6c46c1a0482..206fbbb658d 100644
--- a/lldb/include/lldb/API/SBStream.h
+++ b/lldb/include/lldb/API/SBStream.h
@@ -63,6 +63,8 @@ protected:
friend class SBEvent;
friend class SBFrame;
friend class SBFunction;
+ friend class SBInstruction;
+ friend class SBInstructionList;
friend class SBModule;
friend class SBSymbol;
friend class SBSymbolContext;
diff --git a/lldb/include/lldb/API/SBSymbol.h b/lldb/include/lldb/API/SBSymbol.h
index 08dcad1d325..f4d1b93d69d 100644
--- a/lldb/include/lldb/API/SBSymbol.h
+++ b/lldb/include/lldb/API/SBSymbol.h
@@ -11,6 +11,8 @@
#define LLDB_SBSymbol_h_
#include "lldb/API/SBDefines.h"
+#include "lldb/API/SBInstructionList.h"
+#include "lldb/API/SBTarget.h"
namespace lldb {
@@ -32,6 +34,9 @@ public:
const char *
GetMangledName () const;
+ lldb::SBInstructionList
+ GetInstructions (lldb::SBTarget target);
+
#ifndef SWIG
bool
operator == (const lldb::SBSymbol &rhs) const;
diff --git a/lldb/include/lldb/API/SBTarget.h b/lldb/include/lldb/API/SBTarget.h
index 1f9d0ce1b25..0cde443dd11 100644
--- a/lldb/include/lldb/API/SBTarget.h
+++ b/lldb/include/lldb/API/SBTarget.h
@@ -148,7 +148,9 @@ public:
protected:
friend class SBAddress;
friend class SBDebugger;
+ friend class SBFunction;
friend class SBProcess;
+ friend class SBSymbol;
//------------------------------------------------------------------
// Constructors are private, use static Target::Create function to
diff --git a/lldb/include/lldb/Core/Disassembler.h b/lldb/include/lldb/Core/Disassembler.h
index 80de7b3af8c..1fb70daf03c 100644
--- a/lldb/include/lldb/Core/Disassembler.h
+++ b/lldb/include/lldb/Core/Disassembler.h
@@ -17,79 +17,95 @@
// Other libraries and framework includes
// Project includes
#include "lldb/lldb-private.h"
+#include "lldb/Core/Address.h"
#include "lldb/Core/ArchSpec.h"
#include "lldb/Core/PluginInterface.h"
namespace lldb_private {
-class ExecutionContext;
-
-class Disassembler :
- public PluginInterface
+class Instruction
{
public:
- class Instruction
- {
- public:
- typedef lldb::SharedPtr<Instruction>::Type shared_ptr;
+ Instruction (const Address &addr);
- Instruction();
+ virtual
+ ~Instruction();
- virtual
- ~Instruction();
+ const Address &
+ GetAddress () const
+ {
+ return m_addr;
+ }
- virtual size_t
- GetByteSize() const = 0;
+ void
+ SetAddress (const Address &addr)
+ {
+ m_addr = addr;
+ }
- virtual void
- Dump (Stream *s,
- Address *address,
- const DataExtractor *bytes,
- uint32_t bytes_offset,
- const ExecutionContext &exe_ctx,
- bool raw) = 0;
-
- virtual bool
- DoesBranch () const = 0;
+ virtual size_t
+ GetByteSize() const = 0;
- virtual size_t
- Extract (const DataExtractor& data, uint32_t data_offset) = 0;
- };
+
+ virtual void
+ Dump (Stream *s,
+ bool show_address,
+ const DataExtractor *bytes,
+ uint32_t bytes_offset,
+ const ExecutionContext *exe_ctx,
+ bool raw) = 0;
+
+ virtual bool
+ DoesBranch () const = 0;
+ virtual size_t
+ Extract (const DataExtractor& data, uint32_t data_offset) = 0;
- class InstructionList
- {
- public:
- InstructionList();
- ~InstructionList();
+protected:
+ Address m_addr; // The section offset address of this instruction
+};
- size_t
- GetSize() const;
- Instruction *
- GetInstructionAtIndex (uint32_t idx);
+class InstructionList
+{
+public:
+ InstructionList();
+ ~InstructionList();
- const Instruction *
- GetInstructionAtIndex (uint32_t idx) const;
+ size_t
+ GetSize() const;
+
+ lldb::InstructionSP
+ GetInstructionAtIndex (uint32_t idx) const;
void
Clear();
void
- AppendInstruction (Instruction::shared_ptr &inst_sp);
+ Append (lldb::InstructionSP &inst_sp);
- private:
- typedef std::vector<Instruction::shared_ptr> collection;
- typedef collection::iterator iterator;
- typedef collection::const_iterator const_iterator;
+private:
+ typedef std::vector<lldb::InstructionSP> collection;
+ typedef collection::iterator iterator;
+ typedef collection::const_iterator const_iterator;
- collection m_instructions;
- };
+ collection m_instructions;
+};
+
+class Disassembler :
+ public PluginInterface
+{
+public:
static Disassembler*
FindPlugin (const ArchSpec &arch);
+ static lldb::DisassemblerSP
+ DisassembleRange (const ArchSpec &arch,
+ const ExecutionContext &exe_ctx,
+ const AddressRange &disasm_range);
+
static bool
Disassemble (Debugger &debugger,
const ArchSpec &arch,
@@ -140,7 +156,8 @@ public:
DataExtractor& data);
virtual size_t
- DecodeInstructions (const DataExtractor& data,
+ DecodeInstructions (const Address &base_addr,
+ const DataExtractor& data,
uint32_t data_offset,
uint32_t num_instructions) = 0;
diff --git a/lldb/include/lldb/lldb-forward-rtti.h b/lldb/include/lldb/lldb-forward-rtti.h
index 469c33972a3..b7e7ee3a6de 100644
--- a/lldb/include/lldb/lldb-forward-rtti.h
+++ b/lldb/include/lldb/lldb-forward-rtti.h
@@ -34,12 +34,14 @@ namespace lldb {
typedef SharedPtr<lldb_private::CompileUnit>::Type CompUnitSP;
typedef SharedPtr<lldb_private::DataBuffer>::Type DataBufferSP;
typedef SharedPtr<lldb_private::Debugger>::Type DebuggerSP;
+ typedef SharedPtr<lldb_private::Disassembler>::Type DisassemblerSP;
typedef SharedPtr<lldb_private::DynamicLoader>::Type DynamicLoaderSP;
typedef SharedPtr<lldb_private::Event>::Type EventSP;
typedef SharedPtr<lldb_private::Function>::Type FunctionSP;
typedef SharedPtr<lldb_private::InlineFunctionInfo>::Type InlineFunctionInfoSP;
typedef SharedPtr<lldb_private::InputReader>::Type InputReaderSP;
typedef SharedPtr<lldb_private::InstanceSettings>::Type InstanceSettingsSP;
+ typedef SharedPtr<lldb_private::Instruction>::Type InstructionSP;
typedef SharedPtr<lldb_private::LanguageRuntime>::Type LanguageRuntimeSP;
typedef SharedPtr<lldb_private::LineTable>::Type LineTableSP;
typedef SharedPtr<lldb_private::Listener>::Type ListenerSP;
diff --git a/lldb/include/lldb/lldb-forward.h b/lldb/include/lldb/lldb-forward.h
index 61137098ab8..fbed196c1aa 100644
--- a/lldb/include/lldb/lldb-forward.h
+++ b/lldb/include/lldb/lldb-forward.h
@@ -78,6 +78,7 @@ class FunctionInfo;
class InlineFunctionInfo;
class InputReader;
class InstanceSettings;
+class Instruction;
class LanguageRuntime;
class LineTable;
class Listener;
OpenPOWER on IntegriCloud