Package ghidra.trace.util
Interface MemoryAdapter
- All Superinterfaces:
AddressSetView,Iterable<AddressRange>,Memory
- All Known Implementing Classes:
AbstractDBTraceProgramViewMemory,DBTraceProgramViewMemory
-
Field Summary
Fields inherited from interface ghidra.program.model.mem.Memory
GBYTE, GBYTE_SHIFT_FACTOR, MAX_BINARY_SIZE, MAX_BINARY_SIZE_GB, MAX_BLOCK_SIZE, MAX_BLOCK_SIZE_GB -
Method Summary
Modifier and TypeMethodDescriptiondefault byteGet byte at addr.default intGet dest.length number of bytes starting at the given address.default intGet the int at addr.default intGet the int at addr using the specified endian order.default intGet dest.length number of ints starting at the given address.default intGet dest.length number of ints starting at the given address.default intGet dest.length number of ints starting at the given address.default longGet the long at addr.default longGet the long at addr in the specified endian order.default intGet dest.length number of longs starting at the given address.default intGet dest.length number of longs starting at the given address.default intGet dest.length number of longs starting at the given address.default shortGet the short at addr.default shortGet the short at addr using the specified endian order.default intGet dest.length number of shorts starting at the given address.default intGet dest.length number of shorts starting at the given address.default intGet dest.length number of shorts starting at the given address.default ByteBufferdefault voidWrite byte at addr.default voidWrite size bytes from values at addr.default voidWrite int at addr in the default endian order.default voidWrite int at addr in the specified endian order.default voidWrite long at addr in the default endian order.default voidWrite long at addr in the specified endian order.default voidWrite short at addr in default endian order.default voidWrite short at addr in the specified endian order.Methods inherited from interface ghidra.program.model.address.AddressSetView
contains, contains, contains, findFirstAddressInCommon, getAddressCountBefore, getAddresses, getAddresses, getAddressRanges, getAddressRanges, getAddressRanges, getFirstRange, getLastRange, getMaxAddress, getMinAddress, getNumAddresses, getNumAddressRanges, getRangeContaining, hasSameAddresses, intersect, intersectRange, intersects, intersects, isEmpty, iterator, iterator, iterator, spliterator, spliterator, spliterator, stream, stream, stream, subtract, union, xorMethods inherited from interface ghidra.program.model.mem.Memory
convertToInitialized, convertToUninitialized, createBitMappedBlock, createBlock, createByteMappedBlock, createByteMappedBlock, createFileBytes, createInitializedBlock, createInitializedBlock, createInitializedBlock, createUninitializedBlock, deleteFileBytes, findBytes, findBytes, getAddressSourceInfo, getAllFileBytes, getAllInitializedAddressSet, getBlock, getBlock, getBlocks, getBytes, getExecuteSet, getInitializedAddressSet, getLoadedAndInitializedAddressSet, getProgram, getSize, isBigEndian, isExternalBlockAddress, join, locateAddressesForFileBytesOffset, locateAddressesForFileOffset, moveBlock, removeBlock, setBytes, split
-
Method Details
-
mustRead
default ByteBuffer mustRead(Address addr, int length, boolean bigEndian) throws MemoryAccessException - Throws:
MemoryAccessException
-
getBytes
Description copied from interface:MemoryGet dest.length number of bytes starting at the given address.- Specified by:
getBytesin interfaceMemory- Parameters:
addr- the starting Address.dest- the byte array to populate.- Returns:
- the number of bytes put into dest. May be less than dest.length if the requested number extends beyond available memory.
- Throws:
MemoryAccessException- if the starting address is not contained in any memory block.
-
getByte
Description copied from interface:MemoryGet byte at addr.- Specified by:
getBytein interfaceMemory- Parameters:
addr- the Address of the byte.- Returns:
- the byte.
- Throws:
MemoryAccessException- if the address is not contained in any memory block.
-
getShort
Description copied from interface:MemoryGet the short at addr.- Specified by:
getShortin interfaceMemory- Parameters:
addr- the Address where the short starts.- Returns:
- the short.
- Throws:
MemoryAccessException- if not all needed bytes are contained in initialized memory.
-
getShort
Description copied from interface:MemoryGet the short at addr using the specified endian order.- Specified by:
getShortin interfaceMemory- Parameters:
addr- the Address where the short starts.bigEndian- true means to get the short in bigEndian order- Returns:
- the short.
- Throws:
MemoryAccessException- if not all needed bytes are contained in initialized memory.
-
getShorts
Description copied from interface:MemoryGet dest.length number of shorts starting at the given address.- Specified by:
getShortsin interfaceMemory- Parameters:
addr- the starting Address.dest- the short array to populate.- Returns:
- the number of shorts put into dest. May be less than dest.length if the requested number extends beyond available memory. If the number of retrievable bytes is odd, the final byte will be discarded.
- Throws:
MemoryAccessException- if not all needed bytes are contained in initialized memory.
-
getShorts
default int getShorts(Address addr, short[] dest, int dIndex, int nElem) throws MemoryAccessException Description copied from interface:MemoryGet dest.length number of shorts starting at the given address.- Specified by:
getShortsin interfaceMemory- Parameters:
addr- the starting Address.dest- the short array to populate.dIndex- the offset into dest to place the shorts.nElem- the number of shorts to get.- Returns:
- the number of shorts put into dest. May be less than dest.length if the requested number extends beyond available memory. If the number of retrievable bytes is odd, the final byte will be discarded.
- Throws:
MemoryAccessException- if not all needed bytes are contained in initialized memory.
-
getShorts
default int getShorts(Address addr, short[] dest, int dIndex, int nElem, boolean bigEndian) throws MemoryAccessException Description copied from interface:MemoryGet dest.length number of shorts starting at the given address.- Specified by:
getShortsin interfaceMemory- Parameters:
addr- the starting Address.dest- the short array to populate.dIndex- the offset into dest to place the shorts.nElem- the number of shorts to get.bigEndian- true means to get the shorts in bigEndian order- Returns:
- the number of shorts put into dest. May be less than dest.length if the requested number extends beyond available memory. If the number of retrievable bytes is odd, the final byte will be discarded.
- Throws:
MemoryAccessException- if not all needed bytes are contained in initialized memory.
-
getInt
Description copied from interface:MemoryGet the int at addr.- Specified by:
getIntin interfaceMemory- Parameters:
addr- the Address where the int starts.- Returns:
- the int.
- Throws:
MemoryAccessException- if not all needed bytes are contained in initialized memory.
-
getInt
Description copied from interface:MemoryGet the int at addr using the specified endian order.- Specified by:
getIntin interfaceMemory- Parameters:
addr- the Address where the int starts.bigEndian- true means to get the int in big endian order- Returns:
- the int.
- Throws:
MemoryAccessException- if not all needed bytes are contained in initialized memory.
-
getInts
Description copied from interface:MemoryGet dest.length number of ints starting at the given address.- Specified by:
getIntsin interfaceMemory- Parameters:
addr- the starting Address.dest- the int array to populate.- Returns:
- the number of ints put into dest. May be less than dest.length if the requested number extends beyond available memory. If the number of retrievable bytes is not 0 mod 4, the final byte(s) will be discarded.
- Throws:
MemoryAccessException- if the starting address is not contained in any memory block.
-
getInts
Description copied from interface:MemoryGet dest.length number of ints starting at the given address.- Specified by:
getIntsin interfaceMemory- Parameters:
addr- the starting Address.dest- the int array to populate.dIndex- the offset into dest to place the ints.nElem- the number of ints to get.- Returns:
- the number of ints put into dest. May be less than dest.length if the requested number extends beyond available memory. If the number of retrievable bytes is not 0 mod 4, the final byte(s) will be discarded.
- Throws:
MemoryAccessException- if not all needed bytes are contained in initialized memory.
-
getInts
default int getInts(Address addr, int[] dest, int dIndex, int nElem, boolean bigEndian) throws MemoryAccessException Description copied from interface:MemoryGet dest.length number of ints starting at the given address.- Specified by:
getIntsin interfaceMemory- Parameters:
addr- the starting Address.dest- the int array to populate.dIndex- the offset into dest to place the ints.nElem- the number of ints to get.bigEndian- true means to get the ints in bigEndian order- Returns:
- the number of ints put into dest. May be less than dest.length if the requested number extends beyond available memory. If the number of retrievable bytes is not 0 mod 4, the final byte(s) will be discarded.
- Throws:
MemoryAccessException- if not all needed bytes are contained in initialized memory.
-
getLong
Description copied from interface:MemoryGet the long at addr.- Specified by:
getLongin interfaceMemory- Parameters:
addr- the Address where the long starts.- Returns:
- the long.
- Throws:
MemoryAccessException- if not all needed bytes are contained in initialized memory.
-
getLong
Description copied from interface:MemoryGet the long at addr in the specified endian order.- Specified by:
getLongin interfaceMemory- Parameters:
addr- the Address where the long starts.bigEndian- true means to get the long in big endian order- Returns:
- the long.
- Throws:
MemoryAccessException- if not all needed bytes are contained in initialized memory.
-
getLongs
Description copied from interface:MemoryGet dest.length number of longs starting at the given address.- Specified by:
getLongsin interfaceMemory- Parameters:
addr- the starting Address.dest- the long array to populate.- Returns:
- the number of longs put into dest. May be less than dest.length if the requested number extends beyond available memory. If the number of retrievable bytes is not 0 mod 8, the final byte(s) will be discarded.
- Throws:
MemoryAccessException- if not all needed bytes are contained in initialized memory.
-
getLongs
Description copied from interface:MemoryGet dest.length number of longs starting at the given address.- Specified by:
getLongsin interfaceMemory- Parameters:
addr- the starting Address.dest- the long array to populate.dIndex- the offset into dest to place the longs.nElem- the number of longs to get.- Returns:
- the number of longs put into dest. May be less than dest.length if the requested number extends beyond available memory. If the number of retrievable bytes is not 0 mod 8, the final byte(s) will be discarded.
- Throws:
MemoryAccessException- if not all needed bytes are contained in initialized memory.
-
getLongs
default int getLongs(Address addr, long[] dest, int dIndex, int nElem, boolean bigEndian) throws MemoryAccessException Description copied from interface:MemoryGet dest.length number of longs starting at the given address.- Specified by:
getLongsin interfaceMemory- Parameters:
addr- the starting Address.dest- the long array to populate.dIndex- the offset into dest to place the longs.nElem- the number of longs to get.bigEndian- true means to get the longs in bigEndian order- Returns:
- the number of longs put into dest. May be less than dest.length if the requested number extends beyond available memory. If the number of retrievable bytes is not 0 mod 8, the final byte(s) will be discarded.
- Throws:
MemoryAccessException- if not all needed bytes are contained in initialized memory.
-
setBytes
Description copied from interface:MemoryWrite size bytes from values at addr.- Specified by:
setBytesin interfaceMemory- Parameters:
addr- the starting Address.source- the bytes to write.- Throws:
MemoryAccessException- if writing is not allowed.
-
setByte
Description copied from interface:MemoryWrite byte at addr.- Specified by:
setBytein interfaceMemory- Parameters:
addr- the Address of the byte.value- the data to write.- Throws:
MemoryAccessException- if writing is not allowed.
-
setShort
Description copied from interface:MemoryWrite short at addr in default endian order.- Specified by:
setShortin interfaceMemory- Parameters:
addr- the Address of the short.value- the data to write.- Throws:
MemoryAccessException- if writing is not allowed.
-
setShort
Description copied from interface:MemoryWrite short at addr in the specified endian order.- Specified by:
setShortin interfaceMemory- Parameters:
addr- the Address of the short.value- the data to write.bigEndian- true means to write short in big endian order- Throws:
MemoryAccessException- if writing is not allowed.
-
setInt
Description copied from interface:MemoryWrite int at addr in the default endian order.- Specified by:
setIntin interfaceMemory- Parameters:
addr- the Address of the int.value- the data to write.- Throws:
MemoryAccessException- if writing is not allowed.
-
setInt
Description copied from interface:MemoryWrite int at addr in the specified endian order.- Specified by:
setIntin interfaceMemory- Parameters:
addr- the Address of the int.value- the data to write.bigEndian- true means to write the short in bigEndian order- Throws:
MemoryAccessException- if writing is not allowed.
-
setLong
Description copied from interface:MemoryWrite long at addr in the default endian order.- Specified by:
setLongin interfaceMemory- Parameters:
addr- the Address of the long.value- the data to write.- Throws:
MemoryAccessException- if writing is not allowed.
-
setLong
Description copied from interface:MemoryWrite long at addr in the specified endian order.- Specified by:
setLongin interfaceMemory- Parameters:
addr- the Address of the long.value- the data to write.bigEndian- true means to write the long in bigEndian order- Throws:
MemoryAccessException- if writing is not allowed.
-