aboutsummaryrefslogtreecommitdiff
path: root/include/lldb/Expression/IRExecutionUnit.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/lldb/Expression/IRExecutionUnit.h')
-rw-r--r--include/lldb/Expression/IRExecutionUnit.h87
1 files changed, 68 insertions, 19 deletions
diff --git a/include/lldb/Expression/IRExecutionUnit.h b/include/lldb/Expression/IRExecutionUnit.h
index 2820317e108e..3f28351a6928 100644
--- a/include/lldb/Expression/IRExecutionUnit.h
+++ b/include/lldb/Expression/IRExecutionUnit.h
@@ -30,6 +30,7 @@
#include "lldb/Expression/ClangExpressionParser.h"
#include "lldb/Expression/IRMemoryMap.h"
#include "lldb/Host/Mutex.h"
+#include "lldb/Symbol/ObjectFile.h"
namespace llvm {
@@ -60,7 +61,10 @@ class Error;
/// into the target process, the IRExecutionUnit knows how to copy the
/// emitted code into the target process.
//----------------------------------------------------------------------
-class IRExecutionUnit : public IRMemoryMap
+class IRExecutionUnit :
+ public std::enable_shared_from_this<IRExecutionUnit>,
+ public IRMemoryMap,
+ public ObjectFileJITDelegate
{
public:
//------------------------------------------------------------------
@@ -77,12 +81,14 @@ public:
//------------------------------------------------------------------
~IRExecutionUnit();
- llvm::Module *GetModule()
+ llvm::Module *
+ GetModule()
{
return m_module;
}
- llvm::Function *GetFunction()
+ llvm::Function *
+ GetFunction()
{
if (m_module)
return m_module->getFunction (m_name.AsCString());
@@ -90,9 +96,10 @@ public:
return NULL;
}
- void GetRunnableInfo(Error &error,
- lldb::addr_t &func_addr,
- lldb::addr_t &func_end);
+ void
+ GetRunnableInfo (Error &error,
+ lldb::addr_t &func_addr,
+ lldb::addr_t &func_end);
//------------------------------------------------------------------
/// Accessors for IRForTarget and other clients that may want binary
@@ -100,11 +107,36 @@ public:
/// IRExecutionUnit unless the client explicitly chooses to free it.
//------------------------------------------------------------------
- lldb::addr_t WriteNow(const uint8_t *bytes,
- size_t size,
- Error &error);
+ lldb::addr_t
+ WriteNow (const uint8_t *bytes,
+ size_t size,
+ Error &error);
+
+ void
+ FreeNow (lldb::addr_t allocation);
+
+ //------------------------------------------------------------------
+ /// ObjectFileJITDelegate overrides
+ //------------------------------------------------------------------
+ virtual lldb::ByteOrder
+ GetByteOrder () const;
- void FreeNow(lldb::addr_t allocation);
+ virtual uint32_t
+ GetAddressByteSize () const;
+
+ virtual void
+ PopulateSymtab (lldb_private::ObjectFile *obj_file,
+ lldb_private::Symtab &symtab);
+
+ virtual void
+ PopulateSectionList (lldb_private::ObjectFile *obj_file,
+ lldb_private::SectionList &section_list);
+
+ virtual bool
+ GetArchitecture (lldb_private::ArchSpec &arch);
+
+ lldb::ModuleSP
+ GetJITModule ();
private:
//------------------------------------------------------------------
@@ -180,6 +212,7 @@ private:
public:
MemoryManager (IRExecutionUnit &parent);
+ virtual ~MemoryManager();
//------------------------------------------------------------------
/// Passthrough interface stub
//------------------------------------------------------------------
@@ -423,7 +456,7 @@ private:
//------------------------------------------------------------------
/// Constructor
///
- /// Initializes class variabes.
+ /// Initializes class variables.
///
/// @param[in] name
/// The name of the function.
@@ -450,31 +483,47 @@ private:
//----------------------------------------------------------------------
/// @class AllocationRecord IRExecutionUnit.h "lldb/Expression/IRExecutionUnit.h"
- /// @brief Enacpsulates a single allocation request made by the JIT.
+ /// @brief Encapsulates a single allocation request made by the JIT.
///
/// Allocations made by the JIT are first queued up and then applied in
/// bulk to the underlying process.
//----------------------------------------------------------------------
+ enum class AllocationKind {
+ Stub, Code, Data, Global, Bytes
+ };
+
+ static lldb::SectionType
+ GetSectionTypeFromSectionName (const llvm::StringRef &name,
+ AllocationKind alloc_kind);
+
struct AllocationRecord {
- lldb::addr_t m_process_address;
- uintptr_t m_host_address;
- uint32_t m_permissions;
- size_t m_size;
- unsigned m_alignment;
- unsigned m_section_id;
+ std::string m_name;
+ lldb::addr_t m_process_address;
+ uintptr_t m_host_address;
+ uint32_t m_permissions;
+ lldb::SectionType m_sect_type;
+ size_t m_size;
+ unsigned m_alignment;
+ unsigned m_section_id;
AllocationRecord (uintptr_t host_address,
uint32_t permissions,
+ lldb::SectionType sect_type,
size_t size,
unsigned alignment,
- unsigned section_id = eSectionIDInvalid) :
+ unsigned section_id,
+ const char *name) :
+ m_name (),
m_process_address(LLDB_INVALID_ADDRESS),
m_host_address(host_address),
m_permissions(permissions),
+ m_sect_type (sect_type),
m_size(size),
m_alignment(alignment),
m_section_id(section_id)
{
+ if (name && name[0])
+ m_name = name;
}
void dump (Log *log);