LLVM API Documentation

Public Member Functions
llvm::MemoryObject Class Reference

#include <MemoryObject.h>

Inheritance diagram for llvm::MemoryObject:
Inheritance graph
[legend]

List of all members.

Public Member Functions

virtual ~MemoryObject ()
 Destructor - Override as necessary.
virtual uint64_t getBase () const =0
virtual uint64_t getExtent () const =0
virtual int readByte (uint64_t address, uint8_t *ptr) const =0
virtual int readBytes (uint64_t address, uint64_t size, uint8_t *buf) const

Detailed Description

MemoryObject - Abstract base class for contiguous addressable memory. Necessary for cases in which the memory is in another process, in a file, or on a remote machine. All size and offset parameters are uint64_ts, to allow 32-bit processes access to 64-bit address spaces.

Definition at line 22 of file MemoryObject.h.


Constructor & Destructor Documentation

Destructor - Override as necessary.

Definition at line 13 of file MemoryObject.cpp.


Member Function Documentation

virtual uint64_t llvm::MemoryObject::getBase ( ) const [pure virtual]

getBase - Returns the lowest valid address in the region.

Returns:
- The lowest valid address.

Implemented in llvm::StreamingMemoryObject, llvm::StreamableMemoryObject, and llvm::StringRefMemoryObject.

Referenced by readBytes().

virtual uint64_t llvm::MemoryObject::getExtent ( ) const [pure virtual]

getExtent - Returns the size of the region in bytes. (The region is contiguous, so the highest valid address of the region is getBase() + getExtent() - 1).

Returns:
- The size of the region.

Implemented in llvm::StreamingMemoryObject, llvm::StreamableMemoryObject, and llvm::StringRefMemoryObject.

Referenced by readBytes().

virtual int llvm::MemoryObject::readByte ( uint64_t  address,
uint8_t *  ptr 
) const [pure virtual]

readByte - Tries to read a single byte from the region.

Parameters:
address- The address of the byte, in the same space as getBase().
ptr- A pointer to a byte to be filled in. Must be non-NULL.
Returns:
- 0 if successful; -1 if not. Failure may be due to a bounds violation or an implementation-specific error.

Implemented in llvm::StreamingMemoryObject, llvm::StreamableMemoryObject, and llvm::StringRefMemoryObject.

Referenced by readBytes(), and regionReader().

int MemoryObject::readBytes ( uint64_t  address,
uint64_t  size,
uint8_t *  buf 
) const [virtual]

readBytes - Tries to read a contiguous range of bytes from the region, up to the end of the region. You should override this function if there is a quicker way than going back and forth with individual bytes.

Parameters:
address- The address of the first byte, in the same space as getBase().
size- The number of bytes to copy.
buf- A pointer to a buffer to be filled in. Must be non-NULL and large enough to hold size bytes.
Returns:
- 0 if successful; -1 if not. Failure may be due to a bounds violation or an implementation-specific error.

Reimplemented in llvm::StreamingMemoryObject, llvm::StreamableMemoryObject, and llvm::StringRefMemoryObject.

Definition at line 16 of file MemoryObject.cpp.

References getBase(), getExtent(), and readByte().

Referenced by llvm::AArch64Disassembler::getInstruction(), readInstruction16(), and readInstruction32().


The documentation for this class was generated from the following files: