//
//===----------------------------------------------------------------------===//
-#ifndef REMOTEPROCESS_H
-#define REMOTEPROCESS_H
+#ifndef LLVM_TOOLS_LLI_REMOTETARGET_H
+#define LLVM_TOOLS_LLI_REMOTETARGET_H
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringRef.h"
class RemoteTarget {
bool IsRunning;
- SmallVector<sys::MemoryBlock, 16> Allocations;
+ typedef SmallVector<sys::MemoryBlock, 16> AllocMapType;
+ AllocMapType Allocations;
protected:
std::string ErrorMsg;
unsigned Alignment,
uint64_t &Address);
+ bool isAllocatedMemory(uint64_t Address, uint32_t Size) {
+ uint64_t AddressEnd = Address + Size;
+ for (AllocMapType::const_iterator I = Allocations.begin(),
+ E = Allocations.end();
+ I != E; ++I) {
+ if (Address >= (uint64_t)I->base() &&
+ AddressEnd <= (uint64_t)I->base() + I->size())
+ return true;
+ }
+ return false;
+ }
+
/// Load data into the target address space.
///
/// @param Address Destination address in the target process.
virtual bool executeCode(uint64_t Address,
int &RetVal);
- /// Minimum alignment for memory permissions. Used to seperate code and
+ /// Minimum alignment for memory permissions. Used to separate code and
/// data regions to make sure data doesn't get marked as code or vice
/// versa.
///
RemoteTarget() : IsRunning(false), ErrorMsg("") {}
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.