Package ghidra.program.database.mem
Class MemoryMapDB
- java.lang.Object
-
- ghidra.program.database.mem.MemoryMapDB
-
- All Implemented Interfaces:
ManagerDB,AddressSetView,LiveMemoryListener,Memory,java.lang.Iterable<AddressRange>
public class MemoryMapDB extends java.lang.Object implements Memory, ManagerDB, LiveMemoryListener
The database memory map manager.
-
-
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
-
-
Constructor Summary
Constructors Constructor Description MemoryMapDB(DBHandle handle, AddressMapDB addrMap, int openMode, boolean isBigEndian, Lock lock, TaskMonitor monitor)Constructs a new MemoryMapDB
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancontains(Address addr)Test if the address is contained within this set.booleancontains(Address start, Address end)Test if the given address range is contained in this set.booleancontains(AddressSetView set)Test if the given address set is a subset of this set.MemoryBlockconvertToInitialized(MemoryBlock unitializedBlock, byte initialValue)Convert an existing uninitialized block with an initialized block.MemoryBlockconvertToUninitialized(MemoryBlock initializedBlock)MemoryBlockcreateBitMappedBlock(java.lang.String name, Address start, Address overlayAddress, long length)Create a bit overlay memory block and add it to this Memory.MemoryBlockcreateBlock(MemoryBlock block, java.lang.String name, Address start, long length)Creates a MemoryBlock at the given address with the same properties as block, and adds it to this Memory.MemoryBlockcreateByteMappedBlock(java.lang.String name, Address start, Address overlayAddress, long length)Create a memory block that uses the bytes located at a different location.FileBytescreateFileBytes(java.lang.String filename, long offset, long size, java.io.InputStream is, TaskMonitor monitor)Stores a sequence of bytes into the program.MemoryBlockcreateInitializedBlock(java.lang.String name, Address start, long size, byte initialValue, TaskMonitor monitor, boolean overlay)Create an initialized memory block and add it to this Memory.MemoryBlockcreateInitializedBlock(java.lang.String name, Address start, FileBytes fileBytes, long offset, long length, boolean overlay)Create an initialized memory block using bytes from aFileBytesobject.MemoryBlockcreateInitializedBlock(java.lang.String name, Address start, java.io.InputStream is, long length, TaskMonitor monitor, boolean overlay)Create an initialized memory block and add it to this Memory.MemoryBlockcreateUninitializedBlock(java.lang.String name, Address start, long size, boolean overlay)Create an uninitialized memory block and add it to this Memory.voiddeleteAddressRange(Address startAddr, Address endAddr, TaskMonitor monitor)Delete all objects which have been applied to the address range startAddr to endAddr and update the database accordingly.booleandeleteFileBytes(FileBytes fileBytes)Deletes a stored sequence of file bytes.booleanequals(java.lang.Object obj)AddressfindBytes(Address addr, byte[] bytes, byte[] masks, boolean forward, TaskMonitor monitor)Finds a sequence of contiguous bytes that match the given byte array at all bit positions where the mask contains an "on" bit.AddressfindBytes(Address startAddr, Address endAddr, byte[] bytes, byte[] masks, boolean forward, TaskMonitor monitor)Finds a sequence of contiguous bytes that match the given byte array at all bit positions where the mask contains an "on" bit.AddressfindFirstAddressInCommon(AddressSetView set)Finds the first address in this collection that is also in the given addressSet.AddressIteratorgetAddresses(boolean forward)Returns an iterator over all addresses in this set.AddressIteratorgetAddresses(Address start, boolean forward)Returns an iterator over the addresses in this address set starting at the start addressAddressRangeIteratorgetAddressRanges()Returns an iterator over the address ranges in this address set.AddressRangeIteratorgetAddressRanges(boolean startAtFront)Returns an iterator over the ranges in the specified orderAddressRangeIteratorgetAddressRanges(Address start, boolean forward)Returns an iterator of address ranges starting with the range that contains the given address.AddressSourceInfogetAddressSourceInfo(Address address)Returns information (AddressSourceInfo) about the byte source at the given address.java.util.List<FileBytes>getAllFileBytes()Returns a list of all the stored original file bytes objectsAddressSetViewgetAllInitializedAddressSet()Returns the set of addresses which correspond to all memory blocks that have initialized data.MemoryBlockgetBlock(Address addr)Returns the Block which contains addr.MemoryBlockgetBlock(java.lang.String blockName)Returns the Block with the specified blockNameMemoryBlock[]getBlocks()Returns an array containing all the memory blocks.bytegetByte(Address addr)Get byte at addr.intgetBytes(Address addr, byte[] dest)Get dest.length number of bytes starting at the given address.intgetBytes(Address addr, byte[] dest, int dIndex, int size)Get size number of bytes starting at the given address and populates dest starting at dIndex.AddressSetViewgetExecuteSet()Returns the set of addresses which correspond to the executable memory.AddressRangegetFirstRange()Returns the first range in this set or null if the set is empty;AddressSetViewgetInitializedAddressSet()UseMemory.getLoadedAndInitializedAddressSet()instead.intgetInt(Address addr)Get the int at addr.intgetInt(Address addr, boolean isBigEndian)Get the int at addr using the specified endian order.intgetInts(Address addr, int[] dest)Get dest.length number of ints starting at the given address.intgetInts(Address addr, int[] dest, int dIndex, int nElem)Get dest.length number of ints starting at the given address.intgetInts(Address addr, int[] dest, int dIndex, int nElem, boolean isBigEndian)Get dest.length number of ints starting at the given address.AddressRangegetLastRange()Returns the last range in this set or null if the set is empty;LiveMemoryHandlergetLiveMemoryHandler()Returns the live memory handler instance used by this memory.AddressSetViewgetLoadedAndInitializedAddressSet()Returns the set of addresses which correspond to all the "loaded" memory blocks that have initialized data.longgetLong(Address addr)Get the long at addr.longgetLong(Address addr, boolean isBigEndian)Get the long at addr in the specified endian order.intgetLongs(Address addr, long[] dest)Get dest.length number of longs starting at the given address.intgetLongs(Address addr, long[] dest, int dIndex, int nElem)Get dest.length number of longs starting at the given address.intgetLongs(Address addr, long[] dest, int dIndex, int nElem, boolean isBigEndian)Get dest.length number of longs starting at the given address.AddressgetMaxAddress()Return the maximum address for this set.AddressgetMinAddress()Return the minimum address for this set.longgetNumAddresses()Returns the number of addresses in this set.intgetNumAddressRanges()Return the number of address ranges in this set.ProgramgetProgram()Returns the program that this memory belongs to.AddressRangegetRangeContaining(Address address)Returns the range that contains the given addressshortgetShort(Address addr)Get the short at addr.shortgetShort(Address addr, boolean isBigEndian)Get the short at addr using the specified endian order.intgetShorts(Address addr, short[] dest)Get dest.length number of shorts starting at the given address.intgetShorts(Address addr, short[] dest, int dIndex, int nElem)Get dest.length number of shorts starting at the given address.intgetShorts(Address addr, short[] dest, int dIndex, int nElem, boolean isBigEndian)Get dest.length number of shorts starting at the given address.longgetSize()Get the memory size in bytes.inthashCode()booleanhasSameAddresses(AddressSetView set)Returns true if the given address set contains the same set of addresses as this set.AddressSetintersect(AddressSetView set)Computes the intersection of this address set with the given address set.AddressSetintersectRange(Address start, Address end)Computes the intersection of this address set with the given address range.booleanintersects(Address start, Address end)Determine if the start and end range intersects with the specified address set.booleanintersects(AddressSetView set)Determine if this address set intersects with the specified address set.voidinvalidateCache(boolean all)Clears all data caches.booleanisBigEndian()Returns true if the memory is bigEndian, false otherwise.booleanisEmpty()Returns true if this set is empty.java.util.Iterator<AddressRange>iterator()Returns an iterator over the address ranges in this address set.java.util.Iterator<AddressRange>iterator(boolean forward)Returns an iterator over the ranges in the specified orderjava.util.Iterator<AddressRange>iterator(Address start, boolean forward)Returns an iterator of address ranges starting with the range that contains the given address.MemoryBlockjoin(MemoryBlock blockOne, MemoryBlock blockTwo)Join the two blocks to create a single memory block.voidmemoryChanged(Address addr, int size)voidmoveAddressRange(Address fromAddr, Address toAddr, long length, TaskMonitor monitor)Move all objects within an address range to a new location.voidmoveBlock(MemoryBlock block, Address newStartAddr, TaskMonitor monitor)Move the memory block containing source address to the destination address.voidoverlayBlockRenamed(java.lang.String oldName, java.lang.String name)voidprogramReady(int openMode, int currentRevision, TaskMonitor monitor)Callback from program made to each manager after the program has completed initialization.voidremoveBlock(MemoryBlock block, TaskMonitor monitor)Remove the memory block.voidsetByte(Address addr, byte value)Write byte at addr.voidsetBytes(Address addr, byte[] source)Write size bytes from values at addr.voidsetBytes(Address address, byte[] source, int sIndex, int size)Write an array of bytes.voidsetInt(Address addr, int value)Write int at addr.voidsetInt(Address addr, int value, boolean isBigEndian)Write int at addr in the specified endian order.voidsetLanguage(Language newLanguage)voidsetLiveMemoryHandler(LiveMemoryHandler handler)Sets the live memory handlervoidsetLong(Address addr, long value)Write long at addr.voidsetLong(Address addr, long value, boolean isBigEndian)Write long at addr in the specified endian order.voidsetProgram(ProgramDB program)Set the program.voidsetShort(Address addr, short value)Write short at addr in big endian order.voidsetShort(Address addr, short value, boolean isBigEndian)Write short at addr in the specified endian order.voidsplit(MemoryBlock block, Address addr)Split a block at the given addr and create a new block starting at addr.AddressSetsubtract(AddressSetView set)Computes the difference of this address set with the given address set (this - set).java.lang.StringtoString()AddressSetunion(AddressSetView set)Computes the union of this address set with the given address set.AddressSetxor(AddressSetView set)Computes the exclusive-or of this address set with the given set.
-
-
-
Constructor Detail
-
MemoryMapDB
public MemoryMapDB(DBHandle handle, AddressMapDB addrMap, int openMode, boolean isBigEndian, Lock lock, TaskMonitor monitor) throws java.io.IOException, VersionException
Constructs a new MemoryMapDB- Parameters:
handle- the open database handle.addrMap- the address map.openMode- the open mode for the program.isBigEndian- endianess flaglock- the program synchronization lockmonitor- Task monitor for upgrading- Throws:
java.io.IOException- if a database io error occurs.VersionException- if the database version is different from the expected version
-
-
Method Detail
-
getProgram
public Program getProgram()
Description copied from interface:MemoryReturns the program that this memory belongs to.- Specified by:
getProgramin interfaceMemory- See Also:
Memory.getProgram()
-
invalidateCache
public void invalidateCache(boolean all) throws java.io.IOExceptionDescription copied from interface:ManagerDBClears all data caches.- Specified by:
invalidateCachein interfaceManagerDB- Parameters:
all- if false, some managers may not need to update their cache if they can tell that its not necessary. If this flag is true, then all managers should clear their cache no matter what.- Throws:
java.io.IOException- if a database io error occurs.- See Also:
ManagerDB.invalidateCache(boolean)
-
setLanguage
public void setLanguage(Language newLanguage)
-
setProgram
public void setProgram(ProgramDB program)
Set the program.- Specified by:
setProgramin interfaceManagerDB- Parameters:
program- the program is set when all the initializations have been completed.
-
programReady
public void programReady(int openMode, int currentRevision, TaskMonitor monitor) throws java.io.IOException, CancelledExceptionDescription copied from interface:ManagerDBCallback from program made to each manager after the program has completed initialization. This method may be used by managers to perform additional upgrading which may have been deferred.- Specified by:
programReadyin interfaceManagerDB- Parameters:
openMode- the mode that the program is being opened.currentRevision- current program revision. If openMode is UPGRADE, this value reflects the pre-upgrade value.monitor- the task monitor to use in any upgrade operations.- Throws:
java.io.IOException- if a database io error occurs.CancelledException- if the user cancelled the operation via the task monitor.- See Also:
ManagerDB.programReady(int, int, ghidra.util.task.TaskMonitor)
-
getInitializedAddressSet
public AddressSetView getInitializedAddressSet()
Description copied from interface:MemoryUseMemory.getLoadedAndInitializedAddressSet()instead.- Specified by:
getInitializedAddressSetin interfaceMemory
-
getAllInitializedAddressSet
public AddressSetView getAllInitializedAddressSet()
Description copied from interface:MemoryReturns the set of addresses which correspond to all memory blocks that have initialized data. This includes initialized memory blocks that contain data from the program's file header that are not actually in the running in memory image, such as debug sections. UseMemory.getLoadedAndInitializedAddressSet()if you only want the addressed of the loaded in memory blocks.- Specified by:
getAllInitializedAddressSetin interfaceMemory
-
getLoadedAndInitializedAddressSet
public AddressSetView getLoadedAndInitializedAddressSet()
Description copied from interface:MemoryReturns the set of addresses which correspond to all the "loaded" memory blocks that have initialized data. This does not include initialized memory blocks that contain data from the program's file header such as debug sections.- Specified by:
getLoadedAndInitializedAddressSetin interfaceMemory- See Also:
Memory.getLoadedAndInitializedAddressSet()
-
getBlock
public MemoryBlock getBlock(Address addr)
Description copied from interface:MemoryReturns the Block which contains addr.- Specified by:
getBlockin interfaceMemory- Parameters:
addr- a valid data Address.- Returns:
- the block containing addr; null if addr is not a valid location.
- See Also:
Memory.getBlock(ghidra.program.model.address.Address)
-
getBlock
public MemoryBlock getBlock(java.lang.String blockName)
Description copied from interface:MemoryReturns the Block with the specified blockName- Specified by:
getBlockin interfaceMemory- Parameters:
blockName- the name of the requested block- Returns:
- the Block with the specified blockName
- See Also:
Memory.getBlock(java.lang.String)
-
isBigEndian
public boolean isBigEndian()
Description copied from interface:MemoryReturns true if the memory is bigEndian, false otherwise.- Specified by:
isBigEndianin interfaceMemory
-
setLiveMemoryHandler
public void setLiveMemoryHandler(LiveMemoryHandler handler)
Description copied from interface:MemorySets the live memory handler- Specified by:
setLiveMemoryHandlerin interfaceMemory- Parameters:
handler- the live memory handler
-
getLiveMemoryHandler
public LiveMemoryHandler getLiveMemoryHandler()
Description copied from interface:MemoryReturns the live memory handler instance used by this memory.- Specified by:
getLiveMemoryHandlerin interfaceMemory- Returns:
- the live memory handler
- See Also:
Memory.getLiveMemoryHandler()
-
createInitializedBlock
public MemoryBlock createInitializedBlock(java.lang.String name, Address start, long size, byte initialValue, TaskMonitor monitor, boolean overlay) throws LockException, MemoryConflictException, AddressOverflowException, CancelledException, DuplicateNameException
Description copied from interface:MemoryCreate an initialized memory block and add it to this Memory.- Specified by:
createInitializedBlockin interfaceMemory- Parameters:
name- block namestart- start of the blocksize- block length (positive non-zero value required)initialValue- initialization value for every byte in the block.monitor- progress monitor, may be null.overlay- if true, the block will be created as an OVERLAY which means that a new overlay address space will be created and the block will have a starting address at the same offset as the given start address paramaeter, but in the new address space.- Returns:
- new Initialized Memory Block
- Throws:
LockException- if exclusive lock not in place (see haveLock())MemoryConflictException- if the new block overlaps with a previous blockAddressOverflowException- if the start is beyond the address spaceCancelledException- user cancelled operationDuplicateNameException- if overlay is true and there is already an overlay address space with the same name as this memory block
-
createInitializedBlock
public MemoryBlock createInitializedBlock(java.lang.String name, Address start, java.io.InputStream is, long length, TaskMonitor monitor, boolean overlay) throws MemoryConflictException, AddressOverflowException, CancelledException, LockException, DuplicateNameException
Description copied from interface:MemoryCreate an initialized memory block and add it to this Memory.- Specified by:
createInitializedBlockin interfaceMemory- Parameters:
name- block namestart- start address of the blockis- source of the data used to fill the block or null for zero initialization.length- the size of the blockmonitor- task monitoroverlay- if true, the block will be created as an OVERLAY which means that a new overlay address space will be created and the block will have a starting address at the same offset as the given start address parameter, but in the new address space.- Returns:
- new Initialized Memory Block
- Throws:
MemoryConflictException- if the new block overlaps with a previous blockAddressOverflowException- if the start is beyond the address spaceCancelledException- user cancelled operationLockException- if exclusive lock not in place (see haveLock())DuplicateNameException- if overlay is true and there is already an overlay address space with the same name as this memory block
-
createInitializedBlock
public MemoryBlock createInitializedBlock(java.lang.String name, Address start, FileBytes fileBytes, long offset, long length, boolean overlay) throws LockException, DuplicateNameException, MemoryConflictException, AddressOverflowException, java.lang.IndexOutOfBoundsException
Description copied from interface:MemoryCreate an initialized memory block using bytes from aFileBytesobject.- Specified by:
createInitializedBlockin interfaceMemory- Parameters:
name- block namestart- starting address of the blockfileBytes- theFileBytesobject to use as the underlying source of bytes.offset- the offset into the FileBytes for the first byte of this memory block.length- block length (positive non-zero value required)overlay- if true, the block will be created as an OVERLAY which means that a new overlay address space will be created and the block will have a starting address at the same offset as the given start address parameter, but in the new address space.- Returns:
- new Initialized Memory Block
- Throws:
LockException- if exclusive lock not in place (see haveLock())DuplicateNameException- if overlay is true and there is already an overlay address space with the same name as this memory blockMemoryConflictException- if the new block overlaps with a previous blockAddressOverflowException- if the start is beyond the address spacejava.lang.IndexOutOfBoundsException- if file bytes range specified by offset and size is out of bounds for the specified fileBytes.
-
createUninitializedBlock
public MemoryBlock createUninitializedBlock(java.lang.String name, Address start, long size, boolean overlay) throws MemoryConflictException, AddressOverflowException, LockException, DuplicateNameException
Description copied from interface:MemoryCreate an uninitialized memory block and add it to this Memory.- Specified by:
createUninitializedBlockin interfaceMemory- Parameters:
name- block namestart- start of the blocksize- block lengthoverlay- if true, the block will be created as an OVERLAY which means that a new overlay address space will be created and the block will have a starting address at the same offset as the given start address paramaeter, but in the new address space.- Returns:
- new Uninitialized Memory Block
- Throws:
MemoryConflictException- if the new block overlaps with a previous blockAddressOverflowException- if the start is beyond the address spaceLockException- if exclusive lock not in place (see haveLock())DuplicateNameException- if overlay is true and there is already an overlay address space with the same name as this memory block
-
createBitMappedBlock
public MemoryBlock createBitMappedBlock(java.lang.String name, Address start, Address overlayAddress, long length) throws MemoryConflictException, AddressOverflowException, LockException
Description copied from interface:MemoryCreate a bit overlay memory block and add it to this Memory.- Specified by:
createBitMappedBlockin interfaceMemory- Parameters:
name- block namestart- start of the blockoverlayAddress- start address in the source block for the beginning of this blocklength- block length- Returns:
- new Bit Memory Block
- Throws:
MemoryConflictException- if the new block overlaps with a previous blockAddressOverflowException- if the start is beyond the address spaceLockException- if exclusive lock not in place (see haveLock())
-
createByteMappedBlock
public MemoryBlock createByteMappedBlock(java.lang.String name, Address start, Address overlayAddress, long length) throws MemoryConflictException, AddressOverflowException, LockException
Description copied from interface:MemoryCreate a memory block that uses the bytes located at a different location.- Specified by:
createByteMappedBlockin interfaceMemory- Parameters:
name- block namestart- start of the blockoverlayAddress- start address in the source block for the beginning of this blocklength- block length- Returns:
- new Bit Memory Block
- Throws:
MemoryConflictException- if the new block overlaps with a previous blockLockException- if exclusive lock not in place (see haveLock())AddressOverflowException
-
createBlock
public MemoryBlock createBlock(MemoryBlock block, java.lang.String name, Address start, long length) throws MemoryConflictException, AddressOverflowException, LockException
Description copied from interface:MemoryCreates a MemoryBlock at the given address with the same properties as block, and adds it to this Memory.- Specified by:
createBlockin interfaceMemory- Parameters:
block- source blockname- block namestart- start of the blocklength- the size of the new block.- Throws:
AddressOverflowException- if the new memory block would extend beyond the end of the address space.LockException- if exclusive lock not in place (see haveLock())MemoryConflictException
-
getSize
public long getSize()
Description copied from interface:MemoryGet the memory size in bytes.- Specified by:
getSizein interfaceMemory- See Also:
Memory.getSize()
-
getBlocks
public MemoryBlock[] getBlocks()
Description copied from interface:MemoryReturns an array containing all the memory blocks.- Specified by:
getBlocksin interfaceMemory- See Also:
Memory.getBlocks()
-
moveBlock
public void moveBlock(MemoryBlock block, Address newStartAddr, TaskMonitor monitor) throws MemoryBlockException, MemoryConflictException, AddressOverflowException, NotFoundException, LockException
Description copied from interface:MemoryMove the memory block containing source address to the destination address.- Specified by:
moveBlockin interfaceMemory- Parameters:
block- block to be movednewStartAddr- new start address for blockmonitor- task monitor so the move block can be canceled- Throws:
MemoryBlockException- if block movement is not permittedMemoryConflictException- if move would cause blocks to overlap.AddressOverflowException- if new start address + block.getSize() would cause the Address to wrap around.NotFoundException- if memoryBlock does not exist in this memory.LockException- if exclusive lock not in place (see haveLock())
-
split
public void split(MemoryBlock block, Address addr) throws MemoryBlockException, NotFoundException, LockException
Description copied from interface:MemorySplit a block at the given addr and create a new block starting at addr.- Specified by:
splitin interfaceMemory- Parameters:
block- block to be split into twoaddr- address (within block) that will be the start of new block- Throws:
MemoryBlockException- memory split not permittedNotFoundException- thrown if block does not exist in memoryLockException- if exclusive lock not in place (see haveLock())
-
join
public MemoryBlock join(MemoryBlock blockOne, MemoryBlock blockTwo) throws MemoryBlockException, NotFoundException, LockException
Description copied from interface:MemoryJoin the two blocks to create a single memory block. IMPORTANT! When done, both blockOne and blockTwo should no longer be used.- Specified by:
joinin interfaceMemory- Parameters:
blockOne- block to be combined with blockTwoblockTwo- block to be combined with blockOne- Returns:
- new block
- Throws:
MemoryBlockException- thrown if the blocks are not contiguous in the address space,LockException- if exclusive lock not in place (see haveLock())NotFoundException
-
convertToInitialized
public MemoryBlock convertToInitialized(MemoryBlock unitializedBlock, byte initialValue) throws MemoryBlockException, NotFoundException, LockException
Description copied from interface:MemoryConvert an existing uninitialized block with an initialized block.- Specified by:
convertToInitializedin interfaceMemory- Parameters:
unitializedBlock- unitialized block to convertinitialValue- initial value for the bytes- Throws:
MemoryBlockException- if there is no block in memory at the same address as block or if the block lengths are not the same.LockException- if exclusive lock not in place (see haveLock())NotFoundException
-
convertToUninitialized
public MemoryBlock convertToUninitialized(MemoryBlock initializedBlock) throws MemoryBlockException, NotFoundException, LockException
- Specified by:
convertToUninitializedin interfaceMemory- Throws:
MemoryBlockExceptionNotFoundExceptionLockException
-
findBytes
public Address findBytes(Address addr, byte[] bytes, byte[] masks, boolean forward, TaskMonitor monitor)
Description copied from interface:MemoryFinds a sequence of contiguous bytes that match the given byte array at all bit positions where the mask contains an "on" bit.- Specified by:
findBytesin interfaceMemory- Parameters:
addr- The beginning address in memory to search.bytes- the array of bytes to search for.masks- the array of masks. (One for each byte in the byte array) if all bits of each byte is to be checked (ie: all mask bytes are 0xff), then pass a null for masks.forward- if true, search in the forward direction.- Returns:
- The address of where the first match is found. Null is returned if there is no match.
-
findBytes
public Address findBytes(Address startAddr, Address endAddr, byte[] bytes, byte[] masks, boolean forward, TaskMonitor monitor)
Description copied from interface:MemoryFinds a sequence of contiguous bytes that match the given byte array at all bit positions where the mask contains an "on" bit. Starts at startAddr and ends at endAddr. If forward is true, search starts at startAddr and will end if startAddr ">" endAddr. If forward is false, search starts at start addr and will end if startAddr "<" endAddr.- Specified by:
findBytesin interfaceMemory- Parameters:
startAddr- The beginning address in memory to search.endAddr- The ending address in memory to search (inclusive).bytes- the array of bytes to search for.masks- the array of masks. (One for each byte in the byte array) if all bits of each byte is to be checked (ie: all mask bytes are 0xff), then pass a null for masks.forward- if true, search in the forward direction.- Returns:
- The address of where the first match is found. Null is returned if there is no match.
-
getByte
public byte getByte(Address addr) throws MemoryAccessException
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.- See Also:
Memory.getByte(ghidra.program.model.address.Address)
-
getBytes
public int getBytes(Address addr, byte[] dest) throws MemoryAccessException
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.
-
getBytes
public int getBytes(Address addr, byte[] dest, int dIndex, int size) throws MemoryAccessException
Description copied from interface:MemoryGet size number of bytes starting at the given address and populates dest starting at dIndex.- Specified by:
getBytesin interfaceMemory- Parameters:
addr- the starting Address.dest- the byte array to populate.dIndex- the offset into dest to place the bytes.size- the number of bytes to get.- Returns:
- the number of bytes put into dest. May be less than size if the requested number extends beyond available memory.
- Throws:
MemoryAccessException- if the starting address is not contained in any memory block.
-
getShort
public short getShort(Address addr) throws MemoryAccessException
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.- See Also:
Memory.getShort(ghidra.program.model.address.Address)
-
getShort
public short getShort(Address addr, boolean isBigEndian) throws MemoryAccessException
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.isBigEndian- 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
public int getShorts(Address addr, short[] dest) 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.- 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
public 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.- 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
public int getShorts(Address addr, short[] dest, int dIndex, int nElem, boolean isBigEndian) 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.isBigEndian- 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
public int getInt(Address addr) throws MemoryAccessException
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.- See Also:
Memory.getInt(ghidra.program.model.address.Address)
-
getInt
public int getInt(Address addr, boolean isBigEndian) throws MemoryAccessException
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.isBigEndian- 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.- See Also:
Memory.getInt(ghidra.program.model.address.Address, boolean)
-
getInts
public int getInts(Address addr, int[] dest) 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.- 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.- See Also:
Memory.getInts(ghidra.program.model.address.Address, int[])
-
getInts
public int getInts(Address addr, int[] dest, int dIndex, int nElem) 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.- 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
public int getInts(Address addr, int[] dest, int dIndex, int nElem, boolean isBigEndian) 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.isBigEndian- 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
public long getLong(Address addr) throws MemoryAccessException
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.- See Also:
Memory.getLong(ghidra.program.model.address.Address)
-
getLong
public long getLong(Address addr, boolean isBigEndian) throws MemoryAccessException
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.isBigEndian- 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.- See Also:
Memory.getLong(ghidra.program.model.address.Address, boolean)
-
getLongs
public int getLongs(Address addr, long[] dest) 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.- 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.- See Also:
Memory.getLongs(ghidra.program.model.address.Address, long[])
-
getLongs
public int getLongs(Address addr, long[] dest, int dIndex, int nElem) 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.- 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
public int getLongs(Address addr, long[] dest, int dIndex, int nElem, boolean isBigEndian) 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.isBigEndian- 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.
-
setByte
public void setByte(Address addr, byte value) throws MemoryAccessException
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.- See Also:
Memory.setByte(ghidra.program.model.address.Address, byte)
-
setBytes
public void setBytes(Address addr, byte[] source) throws MemoryAccessException
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.- See Also:
Memory.setBytes(ghidra.program.model.address.Address, byte[])
-
setBytes
public void setBytes(Address address, byte[] source, int sIndex, int size) throws MemoryAccessException
Description copied from interface:MemoryWrite an array of bytes. This should copy size bytes or fail!- Specified by:
setBytesin interfaceMemory- Parameters:
address- the starting Address of the bytes.source- an array to get bytes from.sIndex- the starting source index.size- the number of bytes to fill.- Throws:
MemoryAccessException- if writing is not allowed.
-
setShort
public void setShort(Address addr, short value) throws MemoryAccessException
Description copied from interface:MemoryWrite short at addr in big 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.- See Also:
Memory.setShort(ghidra.program.model.address.Address, short)
-
setShort
public void setShort(Address addr, short value, boolean isBigEndian) throws MemoryAccessException
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.isBigEndian- true means to write short in big endian order- Throws:
MemoryAccessException- if writing is not allowed.
-
setInt
public void setInt(Address addr, int value) throws MemoryAccessException
Description copied from interface:MemoryWrite int at addr.- Specified by:
setIntin interfaceMemory- Parameters:
addr- the Address of the int.value- the data to write.- Throws:
MemoryAccessException- if writing is not allowed.- See Also:
Memory.setInt(ghidra.program.model.address.Address, int)
-
setInt
public void setInt(Address addr, int value, boolean isBigEndian) throws MemoryAccessException
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.isBigEndian- true means to write the short in bigEndian order- Throws:
MemoryAccessException- if writing is not allowed.
-
setLong
public void setLong(Address addr, long value) throws MemoryAccessException
Description copied from interface:MemoryWrite long at addr.- Specified by:
setLongin interfaceMemory- Parameters:
addr- the Address of the long.value- the data to write.- Throws:
MemoryAccessException- if writing is not allowed.- See Also:
Memory.setLong(ghidra.program.model.address.Address, long)
-
setLong
public void setLong(Address addr, long value, boolean isBigEndian) throws MemoryAccessException
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.isBigEndian- true means to write the long in bigEndian order- Throws:
MemoryAccessException- if writing is not allowed.- See Also:
Memory.setLong(ghidra.program.model.address.Address, long, boolean)
-
contains
public boolean contains(Address addr)
Description copied from interface:AddressSetViewTest if the address is contained within this set.- Specified by:
containsin interfaceAddressSetView- Parameters:
addr- address to test.- Returns:
- true if addr exists in the set, false otherwise.
- See Also:
AddressSetView.contains(ghidra.program.model.address.Address)
-
contains
public boolean contains(Address start, Address end)
Description copied from interface:AddressSetViewTest if the given address range is contained in this set.- Specified by:
containsin interfaceAddressSetView- Parameters:
start- the first address in the range.end- the last address in the range.- Returns:
- true if entire range is contained within the set, false otherwise.
-
contains
public boolean contains(AddressSetView set)
Description copied from interface:AddressSetViewTest if the given address set is a subset of this set.- Specified by:
containsin interfaceAddressSetView- Parameters:
set- the set to test.- Returns:
- true if the entire set is contained within this set, false otherwise.
-
isEmpty
public boolean isEmpty()
Description copied from interface:AddressSetViewReturns true if this set is empty.- Specified by:
isEmptyin interfaceAddressSetView- See Also:
AddressSetView.isEmpty()
-
getMinAddress
public Address getMinAddress()
Description copied from interface:AddressSetViewReturn the minimum address for this set. Returns null if the set is empty.- Specified by:
getMinAddressin interfaceAddressSetView- See Also:
AddressSetView.getMinAddress()
-
getMaxAddress
public Address getMaxAddress()
Description copied from interface:AddressSetViewReturn the maximum address for this set. Returns null if the set is empty.- Specified by:
getMaxAddressin interfaceAddressSetView- See Also:
AddressSetView.getMaxAddress()
-
getNumAddressRanges
public int getNumAddressRanges()
Description copied from interface:AddressSetViewReturn the number of address ranges in this set.- Specified by:
getNumAddressRangesin interfaceAddressSetView- See Also:
AddressSetView.getNumAddressRanges()
-
getAddressRanges
public AddressRangeIterator getAddressRanges()
Description copied from interface:AddressSetViewReturns an iterator over the address ranges in this address set.- Specified by:
getAddressRangesin interfaceAddressSetView- See Also:
AddressSetView.getAddressRanges()
-
iterator
public java.util.Iterator<AddressRange> iterator()
Description copied from interface:AddressSetViewReturns an iterator over the address ranges in this address set.- Specified by:
iteratorin interfaceAddressSetView- Specified by:
iteratorin interfacejava.lang.Iterable<AddressRange>
-
getAddressRanges
public AddressRangeIterator getAddressRanges(boolean startAtFront)
Description copied from interface:AddressSetViewReturns an iterator over the ranges in the specified order- Specified by:
getAddressRangesin interfaceAddressSetView- Parameters:
startAtFront- the ranges are returned from lowest to highest, otherwise from highest to lowest- Returns:
- an iterator over all the addresse ranges in the set.
- See Also:
AddressSetView.getAddressRanges(boolean)
-
getNumAddresses
public long getNumAddresses()
Description copied from interface:AddressSetViewReturns the number of addresses in this set.- Specified by:
getNumAddressesin interfaceAddressSetView- See Also:
AddressSetView.getNumAddresses()
-
getAddresses
public AddressIterator getAddresses(boolean forward)
Description copied from interface:AddressSetViewReturns an iterator over all addresses in this set.- Specified by:
getAddressesin interfaceAddressSetView- Parameters:
forward- if true the address are return in increasing order, otherwise in decreasing order.- See Also:
AddressSetView.getAddresses(boolean)
-
getAddresses
public AddressIterator getAddresses(Address start, boolean forward)
Description copied from interface:AddressSetViewReturns an iterator over the addresses in this address set starting at the start address- Specified by:
getAddressesin interfaceAddressSetView- Parameters:
start- address to start iterating at in the address setforward- if true address are return from lowest to highest, else from highest to lowest
-
intersects
public boolean intersects(AddressSetView set)
Description copied from interface:AddressSetViewDetermine if this address set intersects with the specified address set.- Specified by:
intersectsin interfaceAddressSetView- Parameters:
set- address set to check intersection with.
-
intersects
public boolean intersects(Address start, Address end)
Description copied from interface:AddressSetViewDetermine if the start and end range intersects with the specified address set.- Specified by:
intersectsin interfaceAddressSetView- Parameters:
start- start of rangeend- end of range- Returns:
- true if the given range intersects this address set.
-
intersect
public AddressSet intersect(AddressSetView set)
Description copied from interface:AddressSetViewComputes the intersection of this address set with the given address set. This method does not modify this address set.- Specified by:
intersectin interfaceAddressSetView- Parameters:
set- the address set to intersect with.- Returns:
- AddressSet a new address set that contains all addresses that are contained in both this set and the given set.
-
intersectRange
public AddressSet intersectRange(Address start, Address end)
Description copied from interface:AddressSetViewComputes the intersection of this address set with the given address range. This method does not modify this address set.- Specified by:
intersectRangein interfaceAddressSetView- Parameters:
start- start of rangeend- end of range- Returns:
- AddressSet a new address set that contains all addresses that are contained in both this set and the given range.
-
union
public AddressSet union(AddressSetView set)
Description copied from interface:AddressSetViewComputes the union of this address set with the given address set. This method does not change this address set.- Specified by:
unionin interfaceAddressSetView- Parameters:
set- The address set to be unioned with this address set.- Returns:
- AddressSet A new address set which contains all the addresses from both this set and the given set.
-
subtract
public AddressSet subtract(AddressSetView set)
Description copied from interface:AddressSetViewComputes the difference of this address set with the given address set (this - set). Note that this is not the same as (set - this). This method does not change this address set.- Specified by:
subtractin interfaceAddressSetView- Parameters:
set- the set to subtract from this set.- Returns:
- AddressSet a new address set which contains all the addresses that are in this set, but not in the given set.
-
xor
public AddressSet xor(AddressSetView set)
Description copied from interface:AddressSetViewComputes the exclusive-or of this address set with the given set. This method does not modify this address set.- Specified by:
xorin interfaceAddressSetView- Returns:
- AddressSet a new address set containing all addresses that are in either this set or the given set, but not in both sets
-
hasSameAddresses
public boolean hasSameAddresses(AddressSetView set)
Description copied from interface:AddressSetViewReturns true if the given address set contains the same set of addresses as this set.- Specified by:
hasSameAddressesin interfaceAddressSetView- Parameters:
set- the address set to compare.- Returns:
- true if the given set contains the same addresses as this set.
-
removeBlock
public void removeBlock(MemoryBlock block, TaskMonitor monitor) throws LockException
Description copied from interface:MemoryRemove the memory block.- Specified by:
removeBlockin interfaceMemory- Parameters:
block- the block to be removed.monitor- monitor that is used to cancel the remove operation- Throws:
LockException- if exclusive lock not in place (see haveLock())
-
deleteAddressRange
public void deleteAddressRange(Address startAddr, Address endAddr, TaskMonitor monitor) throws CancelledException
Description copied from interface:ManagerDBDelete all objects which have been applied to the address range startAddr to endAddr and update the database accordingly.- Specified by:
deleteAddressRangein interfaceManagerDB- Parameters:
startAddr- the first address in the range.endAddr- the last address in the range.monitor- the task monitor to use in any upgrade operations.- Throws:
CancelledException- if the user cancelled the operation via the task monitor.
-
moveAddressRange
public void moveAddressRange(Address fromAddr, Address toAddr, long length, TaskMonitor monitor) throws CancelledException
Description copied from interface:ManagerDBMove all objects within an address range to a new location.- Specified by:
moveAddressRangein interfaceManagerDB- Parameters:
fromAddr- the first address of the range to be moved.toAddr- the address where to the range is to be moved.length- the number of addresses to move.monitor- the task monitor to use in any upgrade operations.- Throws:
CancelledException- if the user cancelled the operation via the task monitor.
-
toString
public final java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object- See Also:
Object.toString()
-
overlayBlockRenamed
public void overlayBlockRenamed(java.lang.String oldName, java.lang.String name) throws DuplicateNameException, LockException- Throws:
DuplicateNameExceptionLockException
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
getExecuteSet
public AddressSetView getExecuteSet()
Description copied from interface:MemoryReturns the set of addresses which correspond to the executable memory.- Specified by:
getExecuteSetin interfaceMemory
-
memoryChanged
public void memoryChanged(Address addr, int size)
- Specified by:
memoryChangedin interfaceLiveMemoryListener
-
getAddressRanges
public AddressRangeIterator getAddressRanges(Address start, boolean forward)
Description copied from interface:AddressSetViewReturns an iterator of address ranges starting with the range that contains the given address. If there is no range containing the start address, then the the first range will be the next range greater than the start address if going forward, otherwise the range less than the start address- Specified by:
getAddressRangesin interfaceAddressSetView- Parameters:
start- the address the the first range should contain.forward- true iterators forward, false backwards- Returns:
- the AddressRange iterator
-
getFirstRange
public AddressRange getFirstRange()
Description copied from interface:AddressSetViewReturns the first range in this set or null if the set is empty;- Specified by:
getFirstRangein interfaceAddressSetView- Returns:
- the first range in this set or null if the set is empty;
-
getLastRange
public AddressRange getLastRange()
Description copied from interface:AddressSetViewReturns the last range in this set or null if the set is empty;- Specified by:
getLastRangein interfaceAddressSetView- Returns:
- the last range in this set or null if the set is empty;
-
getRangeContaining
public AddressRange getRangeContaining(Address address)
Description copied from interface:AddressSetViewReturns the range that contains the given address- Specified by:
getRangeContainingin interfaceAddressSetView- Parameters:
address- the address for which to find a range.- Returns:
- the range that contains the given address.
-
iterator
public java.util.Iterator<AddressRange> iterator(boolean forward)
Description copied from interface:AddressSetViewReturns an iterator over the ranges in the specified order- Specified by:
iteratorin interfaceAddressSetView- Parameters:
forward- the ranges are returned from lowest to highest, otherwise from highest to lowest- Returns:
- an iterator over all the addresse ranges in the set.
-
iterator
public java.util.Iterator<AddressRange> iterator(Address start, boolean forward)
Description copied from interface:AddressSetViewReturns an iterator of address ranges starting with the range that contains the given address. If there is no range containing the start address, then the the first range will be the next range greater than the start address if going forward, otherwise the range less than the start address- Specified by:
iteratorin interfaceAddressSetView- Parameters:
start- the address the the first range should contain.forward- true iterators forward, false backwards- Returns:
- the AddressRange iterator
-
findFirstAddressInCommon
public Address findFirstAddressInCommon(AddressSetView set)
Description copied from interface:AddressSetViewFinds the first address in this collection that is also in the given addressSet.- Specified by:
findFirstAddressInCommonin interfaceAddressSetView- Parameters:
set- the addressSet to search for the first (lowest) common address.- Returns:
- the first address that is contained in this set and the given set.
-
getAddressSourceInfo
public AddressSourceInfo getAddressSourceInfo(Address address)
Description copied from interface:MemoryReturns information (AddressSourceInfo) about the byte source at the given address.- Specified by:
getAddressSourceInfoin interfaceMemory- Parameters:
address- the address to query. Returns null if the address is not in memory.- Returns:
- information (
AddressSourceInfo) about the byte source at the given address or null if the address is not in memory.
-
createFileBytes
public FileBytes createFileBytes(java.lang.String filename, long offset, long size, java.io.InputStream is, TaskMonitor monitor) throws java.io.IOException, CancelledException
Description copied from interface:MemoryStores a sequence of bytes into the program. Typically, this method is used by importers to store the original raw program bytes.- Specified by:
createFileBytesin interfaceMemory- Parameters:
filename- the name of the file from where the bytes originatedoffset- the offset into the file for the first byte in the input stream.size- the number of bytes to store from the input stream.is- the input stream that will supply the bytes to store in the program.- Returns:
- a FileBytes that was created to access the bytes.
- Throws:
java.io.IOException- if there was an IOException saving the bytes to the program database.CancelledException- if the user cancelled this operation. Note: the database will be stable, but the buffers may contain 0s instead of the actual bytes.
-
getAllFileBytes
public java.util.List<FileBytes> getAllFileBytes()
Description copied from interface:MemoryReturns a list of all the stored original file bytes objects- Specified by:
getAllFileBytesin interfaceMemory- Returns:
- a list of all the stored original file bytes objects
-
deleteFileBytes
public boolean deleteFileBytes(FileBytes fileBytes) throws java.io.IOException
Description copied from interface:MemoryDeletes a stored sequence of file bytes. The file bytes can only be deleted if there are no memory block references to the file bytes.- Specified by:
deleteFileBytesin interfaceMemory- Parameters:
fileBytes- the FileBytes for the file bytes to be deleted.- Returns:
- true if the FileBytes was deleted. If any memory blocks are referenced by this FileBytes or it is invalid then it will not be deleted and false will be returned.
- Throws:
java.io.IOException- if there was an error updating the database.
-
-