Package ghidra.program.model.mem
Interface LiveMemoryHandler
public interface LiveMemoryHandler
Live memory handler interface.
-
Method Summary
Modifier and TypeMethodDescriptionvoidaddLiveMemoryListener(LiveMemoryListener listener) Adds a LiveMemoryListener to this handler.voidCalled when the memory map is re-initializing.byteGets the byte at the given address.intGet the bytes at the given address and size and put them into the destination buffer.voidWrites the given byte value to the address in memory.intWrites the given bytes to memory starting at the given address.voidremoveLiveMemoryListener(LiveMemoryListener listener) Removes the LiveMemoryListener from this handler.
-
Method Details
-
clearCache
void clearCache()Called when the memory map is re-initializing. Usually after an undo or redo. -
getByte
Gets the byte at the given address.- Parameters:
addr- the address of the byte to be retrieved- Returns:
- the byte at the given address.
- Throws:
MemoryAccessException- if the byte can't be read.
-
getBytes
Get the bytes at the given address and size and put them into the destination buffer.- Parameters:
address- the address of the first byte to be retrieved.buffer- the byte buffer in which to place the bytes.startIndex- the starting index in the buffer to put the first byte.size- the number of bytes to retrieve and put in the buffer.- Returns:
- the number of bytes placed into the given buffer.
- Throws:
MemoryAccessException- if the bytes can't be read.
-
putByte
Writes the given byte value to the address in memory.- Parameters:
address- the address whose byte is to be updated to the new value.value- the value to set at the given address.- Throws:
MemoryAccessException- if the value can not be written to the memory.
-
putBytes
Writes the given bytes to memory starting at the given address.- Parameters:
address- the address in memory to write the bytes.source- the buffer containing the byte values to be written to memory.startIndex- the starting index in the buffer to get byte values.size- the number of bytes to write to memory.- Returns:
- the number of bytes written to memory.
- Throws:
MemoryAccessException- if the bytes can't be written to memory.
-
addLiveMemoryListener
Adds a LiveMemoryListener to this handler. The listener will be notified when memory bytes change.- Parameters:
listener- the listener to be notified of memory byte value changes.
-
removeLiveMemoryListener
Removes the LiveMemoryListener from this handler.- Parameters:
listener- the listener to be removed.
-