Adding out-of-process execution support to lli.

At this time only Unix-based systems are supported.  Windows has stubs and should re-route to the simulated mode.

Thanks to Sriram Murali for contributions to this patch.




git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@191843 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Andrew Kaylor
2013-10-02 17:12:36 +00:00
parent af7ae9d689
commit 0ab5c6c16b
22 changed files with 994 additions and 23 deletions

View File

@ -41,7 +41,9 @@ public:
///
/// @returns False on success. On failure, ErrorMsg is updated with
/// descriptive text of the encountered error.
bool allocateSpace(size_t Size, unsigned Alignment, uint64_t &Address);
virtual bool allocateSpace(size_t Size,
unsigned Alignment,
uint64_t &Address);
/// Load data into the target address space.
///
@ -51,7 +53,9 @@ public:
///
/// @returns False on success. On failure, ErrorMsg is updated with
/// descriptive text of the encountered error.
bool loadData(uint64_t Address, const void *Data, size_t Size);
virtual bool loadData(uint64_t Address,
const void *Data,
size_t Size);
/// Load code into the target address space and prepare it for execution.
///
@ -61,7 +65,9 @@ public:
///
/// @returns False on success. On failure, ErrorMsg is updated with
/// descriptive text of the encountered error.
bool loadCode(uint64_t Address, const void *Data, size_t Size);
virtual bool loadCode(uint64_t Address,
const void *Data,
size_t Size);
/// Execute code in the target process. The called function is required
/// to be of signature int "(*)(void)".
@ -72,24 +78,29 @@ public:
///
/// @returns False on success. On failure, ErrorMsg is updated with
/// descriptive text of the encountered error.
bool executeCode(uint64_t Address, int &RetVal);
virtual bool executeCode(uint64_t Address,
int &RetVal);
/// Minimum alignment for memory permissions. Used to seperate code and
/// data regions to make sure data doesn't get marked as code or vice
/// versa.
///
/// @returns Page alignment return value. Default of 4k.
unsigned getPageAlignment() { return 4096; }
virtual unsigned getPageAlignment() { return 4096; }
/// Start the remote process.
void create();
virtual void create();
/// Terminate the remote process.
void stop();
virtual void stop();
RemoteTarget() : ErrorMsg(""), IsRunning(false) {}
~RemoteTarget() { if (IsRunning) stop(); }
virtual ~RemoteTarget() { if (IsRunning) stop(); }
// Create an instance of the system-specific remote target class.
static RemoteTarget *createRemoteTarget();
static RemoteTarget *createExternalRemoteTarget(std::string &ChildName);
static bool hostSupportsExternalRemoteTarget();
private:
// Main processing function for the remote target process. Command messages
// are received on file descriptor CmdFD and responses come back on OutFD.