Package ghidra.trace.database.memory

# Class DBTraceMemorySpace

java.lang.Object
ghidra.trace.database.memory.DBTraceMemorySpace

All Implemented Interfaces:
  `InternalTraceMemoryOperations`, `DBTraceSpaceBased`, `TraceMemoryOperations`, `TraceMemorySpace`, `TraceSpaceMixin`

public class DBTraceMemorySpace extends Object implements TraceMemorySpace, InternalTraceMemoryOperations, DBTraceSpaceBased
Implements `TraceMemorySpace` using a database-backed copy-on-write store.

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Class
  Description
  `protected static class`
  `DBTraceMemorySpace.OutSnap`

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final int`
  `BLOCK_MASK`
  `static final int`
  `BLOCK_SHIFT`
  `static final int`
  `BLOCK_SIZE`
  `protected final Map<DBTraceUtils.OffsetSnap,ghidra.trace.database.memory.DBTraceMemoryBlockEntry>`
  `blockCacheMostRecent`
  `static final int`
  `BLOCKS_PER_BUFFER`
  `protected final DBCachedObjectIndex<DBTraceUtils.OffsetSnap,ghidra.trace.database.memory.DBTraceMemoryBlockEntry>`
  `blocksByOffset`
  `protected final DBCachedObjectStore<ghidra.trace.database.memory.DBTraceMemoryBlockEntry>`
  `blockStore`
  `protected final DBCachedObjectStore<DBTraceMemoryBufferEntry>`
  `bufferStore`
  `protected final DBHandle`
  `dbh`
  `static final int`
  `DEPENDENT_COMPRESSED_SIZE_TOLERANCE`
  `protected final ReadWriteLock`
  `lock`
  `protected final DBTraceMemoryManager`
  `manager`
  `protected final AddressSpace`
  `space`
  `protected final DBTraceAddressSnapRangePropertyMapSpace<TraceMemoryState,ghidra.trace.database.memory.DBTraceMemoryStateEntry>`
  `stateMapSpace`
  `protected final DBTrace`
  `trace`
  `protected final DBTraceTimeViewport`
  `viewport`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `DBTraceMemorySpace(DBTraceMemoryManager manager, DBHandle dbh, AddressSpace space, AbstractDBTraceSpaceBasedManager.DBTraceSpaceEntry ent)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `protected void`
  `checkState(TraceMemoryState state)`
  `void`
  `checkStateMapIntegrity()`
  `protected boolean`
  `doCheckBytesChanged(long snap, AddressRange range, ByteBuffer buf1, ByteBuffer buf2)`
  `protected boolean`
  `doCheckBytesChanged(DBTraceUtils.OffsetSnap loc, int srcOffset, int maxLen, ByteBuffer eBuf, ByteBuffer pBuf)`
  `protected Address`
  `doFindBytesInRange(long snap, AddressRange range, ByteBuffer data, ByteBuffer mask, boolean forward, TaskMonitor monitor)`
  `protected void`
  `doGetBytes(DBTraceUtils.OffsetSnap loc, ByteBuffer buf, int srcOffset, int maxLen)`
  `protected Collection<Map.Entry<TraceAddressSnapRange,TraceMemoryState>>`
  `doGetStates(Lifespan span, AddressRange range)`
  `protected int`
  `doPutBytes(long snap, Address start, ByteBuffer buf, DBTraceMemorySpace.OutSnap lastSnap, Set<TraceAddressSnapRange> changed)`
  `protected void`
  `doPutBytes(DBTraceUtils.OffsetSnap loc, ByteBuffer buf, int dstOffset, int maxLen)`
  `protected void`
  `doPutFutureBytes(DBTraceUtils.OffsetSnap loc, ByteBuffer buf, int dstOffset, int maxLen, DBTraceMemorySpace.OutSnap lastSnap, Set<TraceAddressSnapRange> changed)`
  `protected void`
  `doSetState(long snap, Address start, Address end, TraceMemoryState state)`
  `Address`
  `findBytes(long snap, AddressRange range, ByteBuffer data, ByteBuffer mask, boolean forward, TaskMonitor monitor)`
  Search the given address range at the given snap for a given byte pattern
  `protected ghidra.trace.database.memory.DBTraceMemoryBlockEntry`
  `findMostRecentBlockEntry(DBTraceUtils.OffsetSnap loc, boolean inclusive)`
  `protected ghidra.trace.database.memory.DBTraceMemoryBlockEntry`
  `findSoonestBlockEntry(DBTraceUtils.OffsetSnap loc, boolean inclusive)`
  Locate the soonest block entry for the given offset-snap pair
  `AddressSetView`
  `getAddressesWithState(long snap, Predicate<TraceMemoryState> predicate)`
  Get the addresses having state satisfying the given predicate
  `AddressSetView`
  `getAddressesWithState(Lifespan span, AddressSetView set, Predicate<TraceMemoryState> predicate)`
  Get at least the subset of addresses having state satisfying the given predicate
  `AddressSetView`
  `getAddressesWithState(Lifespan lifespan, Predicate<TraceMemoryState> predicate)`
  Get the addresses having state satisfying the given predicate at any time in the specified lifespan
  `AddressSpace`
  `getAddressSpace()`
  Get the address space
  `int`
  `getBlockSize()`
  Get the block size used by internal storage.
  `MemBuffer`
  `getBufferAt(long snap, Address start, ByteOrder byteOrder)`
  Get a view of a particular snap as a memory buffer
  `int`
  `getBytes(long snap, Address start, ByteBuffer buf)`
  Read the most recent bytes from the given snap and address
  `DBTraceCodeSpace`
  `getCodeSpace(boolean createIfAbsent)`
  Get the code space for this memory space
  `long`
  `getFirstChange(Lifespan span, AddressRange range)`
  Determine the truncation snap if the given span and range include byte changes
  `ReadWriteLock`
  `getLock()`
  `Map.Entry<TraceAddressSnapRange,TraceMemoryState>`
  `getMostRecentStateEntry(long snap, Address address)`
  Get the entry recording the most recent state at the given snap and address
  `Iterable<Map.Entry<TraceAddressSnapRange,TraceMemoryState>>`
  `getMostRecentStates(TraceAddressSnapRange within)`
  Break a range of addresses into smaller ranges each mapped to its most recent state at the given time
  `Long`
  `getSnapOfMostRecentChangeToBlock(long snap, Address address)`
  Find the internal storage block that most-recently defines the value at the given snap and address, and return the block's snap.
  `AddressSpace`
  `getSpace()`
  For register mapping conventions
  `TraceMemoryState`
  `getState(long snap, Address address)`
  Get the state of memory at a given snap and address
  `Collection<Map.Entry<TraceAddressSnapRange,TraceMemoryState>>`
  `getStates(long snap, AddressRange range)`
  Break a range of addresses into smaller ranges each mapped to its state at the given snap
  `Trace`
  `getTrace()`
  Get the trace to which the memory manager belongs
  `int`
  `getViewBytes(long snap, Address start, ByteBuffer buf)`
  Read the most recent bytes from the given snap and address, following schedule forks
  `Map.Entry<TraceAddressSnapRange,TraceMemoryState>`
  `getViewMostRecentStateEntry(long snap, Address address)`
  Get the entry recording the most recent state at the given snap and address, following schedule forks
  `Map.Entry<TraceAddressSnapRange,TraceMemoryState>`
  `getViewMostRecentStateEntry(long snap, AddressRange range, Predicate<TraceMemoryState> predicate)`
  Get the entry recording the most recent state since the given snap within the given range that satisfies a given predicate, following schedule forks
  `Map.Entry<Long,TraceMemoryState>`
  `getViewState(long snap, Address address)`
  Get the state of memory at a given snap and address, following schedule forks
  `void`
  `invalidateCache()`
  `protected boolean`
  `isCross(long lower, long upper)`
  `void`
  `pack()`
  Optimize storage space
  `int`
  `putBytes(long snap, Address start, ByteBuffer buf)`
  Write bytes at the given snap and address
  `void`
  `removeBytes(long snap, Address start, int len)`
  Remove bytes from the given time and location
  `void`
  `setState(long snap, AddressRange range, TraceMemoryState state)`
  Set the state of memory over a given time and address range
  `void`
  `setState(long snap, Address start, Address end, TraceMemoryState state)`
  `void`
  `setState(long snap, Address address, TraceMemoryState state)`
  `void`
  `setState(long snap, AddressSetView set, TraceMemoryState state)`
  Set the state of memory over a given time and address set
  `protected int`
  `truncateLen(int len, Address start)`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

  ### Methods inherited from interface ghidra.trace.database.space.DBTraceSpaceBased

  `assertInSpace, assertInSpace, explainLanguages, isMySpace, toAddress, toOverlay`

  ### Methods inherited from interface ghidra.trace.database.memory.InternalTraceMemoryOperations

  `getBytes, getState, getStates, getValue, getViewValue, putBytes, removeValue, setState, setValue`

  ### Methods inherited from interface ghidra.trace.model.memory.TraceMemoryOperations

  `getAddressesWithState, getBufferAt, getBytes, getMostRecentStates, getState, getStates, getValue, getViewValue, isKnown, putBytes, removeValue, setState, setValue`

  ### Methods inherited from interface ghidra.trace.util.TraceSpaceMixin

  `getFrameLevel, getThread`

- ## Field Details

  - ### BLOCK_SHIFT

    public static final int BLOCK_SHIFT
    See Also:
      - Constant Field Values

  - ### BLOCK_SIZE

    public static final int BLOCK_SIZE
    See Also:
      - Constant Field Values

  - ### BLOCK_MASK

    public static final int BLOCK_MASK
    See Also:
      - Constant Field Values

  - ### DEPENDENT_COMPRESSED_SIZE_TOLERANCE

    public static final int DEPENDENT_COMPRESSED_SIZE_TOLERANCE
    See Also:
      - Constant Field Values

  - ### BLOCKS_PER_BUFFER

    public static final int BLOCKS_PER_BUFFER
    See Also:
      - Constant Field Values

  - ### manager

    protected final DBTraceMemoryManager manager

  - ### dbh

    protected final DBHandle dbh

  - ### space

    protected final AddressSpace space

  - ### lock

    protected final ReadWriteLock lock

  - ### trace

    protected final DBTrace trace

  - ### stateMapSpace

    protected final DBTraceAddressSnapRangePropertyMapSpace<TraceMemoryState,ghidra.trace.database.memory.DBTraceMemoryStateEntry> stateMapSpace

  - ### bufferStore

    protected final DBCachedObjectStore<DBTraceMemoryBufferEntry> bufferStore

  - ### blockStore

    protected final DBCachedObjectStore<ghidra.trace.database.memory.DBTraceMemoryBlockEntry> blockStore

  - ### blocksByOffset

    protected final DBCachedObjectIndex<DBTraceUtils.OffsetSnap,ghidra.trace.database.memory.DBTraceMemoryBlockEntry> blocksByOffset

  - ### blockCacheMostRecent

    protected final Map<DBTraceUtils.OffsetSnap,ghidra.trace.database.memory.DBTraceMemoryBlockEntry> blockCacheMostRecent

  - ### viewport

    protected final DBTraceTimeViewport viewport

- ## Constructor Details

  - ### DBTraceMemorySpace

    public DBTraceMemorySpace(DBTraceMemoryManager manager, DBHandle dbh, AddressSpace space, AbstractDBTraceSpaceBasedManager.DBTraceSpaceEntry ent) throws IOException, VersionException
    Throws:
      `IOException`
      `VersionException`

- ## Method Details

  - ### getSpace

    public AddressSpace getSpace()
    Description copied from interface: `InternalTraceMemoryOperations`
    For register mapping conventions
    Specified by:
      `getSpace` in interface `InternalTraceMemoryOperations`
    Returns:
      the address space

  - ### getLock

    public ReadWriteLock getLock()
    Specified by:
      `getLock` in interface `InternalTraceMemoryOperations`

  - ### getTrace

    public Trace getTrace()
    Description copied from interface: `TraceMemoryOperations`
    Get the trace to which the memory manager belongs
    Specified by:
      `getTrace` in interface `TraceMemoryOperations`
    Specified by:
      `getTrace` in interface `TraceSpaceMixin`
    Returns:
      the trace

  - ### getCodeSpace

    public DBTraceCodeSpace getCodeSpace(boolean createIfAbsent)
    Description copied from interface: `TraceMemorySpace`
    Get the code space for this memory space

    This is a convenience for `TraceCodeManager.getCodeSpace(AddressSpace, boolean)` on this same address space.

    Specified by:
      `getCodeSpace` in interface `TraceMemorySpace`
    Parameters:
      `createIfAbsent` - true to create the space if it's not already present
    Returns:
      the code space

  - ### getAddressSpace

    public AddressSpace getAddressSpace()
    Description copied from interface: `TraceMemorySpace`
    Get the address space
    Specified by:
      `getAddressSpace` in interface `TraceMemorySpace`
    Specified by:
      `getAddressSpace` in interface `TraceSpaceMixin`
    Returns:
      the address space

  - ### doSetState

    protected void doSetState(long snap, Address start, Address end, TraceMemoryState state)

  - ### checkState

    protected void checkState(TraceMemoryState state)

  - ### checkStateMapIntegrity

    public void checkStateMapIntegrity()

  - ### setState

    public void setState(long snap, Address start, Address end, TraceMemoryState state)
    Specified by:
      `setState` in interface `TraceMemoryOperations`
    See Also:
      - `TraceMemoryOperations.setState(long, AddressRange, TraceMemoryState)`

  - ### setState

    public void setState(long snap, AddressRange range, TraceMemoryState state)
    Description copied from interface: `TraceMemoryOperations`
    Set the state of memory over a given time and address range

    Setting state to `TraceMemoryState.KNOWN` via this method is not recommended. Setting bytes will automatically update the state accordingly.

    Specified by:
      `setState` in interface `TraceMemoryOperations`
    Parameters:
      `snap` - the time
      `range` - the range
      `state` - the state

  - ### setState

    public void setState(long snap, Address address, TraceMemoryState state)
    Specified by:
      `setState` in interface `TraceMemoryOperations`
    See Also:
      - `TraceMemoryOperations.setState(long, AddressRange, TraceMemoryState)`

  - ### setState

    public void setState(long snap, AddressSetView set, TraceMemoryState state)
    Description copied from interface: `TraceMemoryOperations`
    Set the state of memory over a given time and address set
    Specified by:
      `setState` in interface `TraceMemoryOperations`
    See Also:
      - `TraceMemoryOperations.setState(long, AddressRange, TraceMemoryState)`

  - ### getState

    public TraceMemoryState getState(long snap, Address address)
    Description copied from interface: `TraceMemoryOperations`
    Get the state of memory at a given snap and address

    If the location's state has not been set, the result is `null`, which implies `TraceMemoryState.UNKNOWN`.

    Specified by:
      `getState` in interface `TraceMemoryOperations`
    Parameters:
      `snap` - the time
      `address` - the location
    Returns:
      the state

  - ### getViewState

    public Map.Entry<Long,TraceMemoryState> getViewState(long snap, Address address)
    Description copied from interface: `TraceMemoryOperations`
    Get the state of memory at a given snap and address, following schedule forks
    Specified by:
      `getViewState` in interface `TraceMemoryOperations`
    Parameters:
      `snap` - the time
      `address` - the location
    Returns:
      the state, and the snap where it was found

  - ### getMostRecentStateEntry

    public Map.Entry<TraceAddressSnapRange,TraceMemoryState> getMostRecentStateEntry(long snap, Address address)
    Description copied from interface: `TraceMemoryOperations`
    Get the entry recording the most recent state at the given snap and address

    The entry includes the entire entry at that snap. Parts occluded by more recent snaps are not subtracted from the entry's address range.

    Specified by:
      `getMostRecentStateEntry` in interface `TraceMemoryOperations`
    Parameters:
      `snap` - the time
      `address` - the location
    Returns:
      the entry including the entire recorded range

  - ### getViewMostRecentStateEntry

    public Map.Entry<TraceAddressSnapRange,TraceMemoryState> getViewMostRecentStateEntry(long snap, Address address)
    Description copied from interface: `TraceMemoryOperations`
    Get the entry recording the most recent state at the given snap and address, following schedule forks
    Specified by:
      `getViewMostRecentStateEntry` in interface `TraceMemoryOperations`
    Parameters:
      `snap` - the latest time to consider
      `address` - the address
    Returns:
      the most-recent entry

  - ### getViewMostRecentStateEntry

    public Map.Entry<TraceAddressSnapRange,TraceMemoryState> getViewMostRecentStateEntry(long snap, AddressRange range, Predicate<TraceMemoryState> predicate)
    Description copied from interface: `TraceMemoryOperations`
    Get the entry recording the most recent state since the given snap within the given range that satisfies a given predicate, following schedule forks
    Specified by:
      `getViewMostRecentStateEntry` in interface `TraceMemoryOperations`
    Parameters:
      `snap` - the latest time to consider
      `range` - the range of addresses
      `predicate` - a predicate on the state
    Returns:
      the most-recent entry

  - ### getAddressesWithState

    public AddressSetView getAddressesWithState(long snap, Predicate<TraceMemoryState> predicate)
    Description copied from interface: `TraceMemoryOperations`
    Get the addresses having state satisfying the given predicate

    The implementation may provide a view that updates with changes. Behavior is not well defined for predicates testing for `TraceMemoryState.UNKNOWN`.

    Specified by:
      `getAddressesWithState` in interface `TraceMemoryOperations`
    Parameters:
      `snap` - the time
      `predicate` - a predicate on state to search for
    Returns:
      the address set

  - ### getAddressesWithState

    public AddressSetView getAddressesWithState(Lifespan lifespan, Predicate<TraceMemoryState> predicate)
    Description copied from interface: `TraceMemoryOperations`
    Get the addresses having state satisfying the given predicate at any time in the specified lifespan

    The implementation may provide a view that updates with changes. Behavior is not well defined for predicates testing for `TraceMemoryState.UNKNOWN` .

    Specified by:
      `getAddressesWithState` in interface `TraceMemoryOperations`
    Parameters:
      `lifespan` - the span of time
      `predicate` - a predicate on state to search for
    Returns:
      the address set

  - ### getAddressesWithState

    public AddressSetView getAddressesWithState(Lifespan span, AddressSetView set, Predicate<TraceMemoryState> predicate)
    Description copied from interface: `TraceMemoryOperations`
    Get at least the subset of addresses having state satisfying the given predicate

    The implementation may provide a larger view than requested, but within the requested set, only ranges satisfying the predicate may be present. Use `AddressSetView.intersect(AddressSetView)` with `set` if a strict subset is required.

    Because `TraceMemoryState.UNKNOWN` is not explicitly stored in the map, to compute the set of `TraceMemoryState.UNKNOWN` addresses, use the predicate `state -> state != null && state != TraceMemoryState.UNKNOWN` and subtract the result from `set`.

    Specified by:
      `getAddressesWithState` in interface `TraceMemoryOperations`
    Parameters:
      `span` - the range of time
      `set` - the set to examine
      `predicate` - a predicate on state to search for
    Returns:
      the address set

  - ### doGetStates

    protected Collection<Map.Entry<TraceAddressSnapRange,TraceMemoryState>> doGetStates(Lifespan span, AddressRange range)

  - ### getStates

    public Collection<Map.Entry<TraceAddressSnapRange,TraceMemoryState>> getStates(long snap, AddressRange range)
    Description copied from interface: `TraceMemoryOperations`
    Break a range of addresses into smaller ranges each mapped to its state at the given snap

    Note that `TraceMemoryState.UNKNOWN` entries will not appear in the result. Gaps in the returned entries are implied to be `TraceMemoryState.UNKNOWN`.

    Specified by:
      `getStates` in interface `TraceMemoryOperations`
    Parameters:
      `snap` - the time
      `range` - the range to examine
    Returns:
      the map of ranges to states

  - ### getMostRecentStates

    public Iterable<Map.Entry<TraceAddressSnapRange,TraceMemoryState>> getMostRecentStates(TraceAddressSnapRange within)
    Description copied from interface: `TraceMemoryOperations`
    Break a range of addresses into smaller ranges each mapped to its most recent state at the given time

    Typically `within` is the box whose width is the address range to break down and whose height is from "negative infinity" to the "current" snap.

    In this context, "most recent" means the latest state other than `TraceMemoryState.UNKNOWN`.

    Specified by:
      `getMostRecentStates` in interface `TraceMemoryOperations`
    Parameters:
      `within` - a box intersecting entries to consider
    Returns:
      an iterable over the snap ranges and states

  - ### findMostRecentBlockEntry

    protected ghidra.trace.database.memory.DBTraceMemoryBlockEntry findMostRecentBlockEntry(DBTraceUtils.OffsetSnap loc, boolean inclusive)

  - ### findSoonestBlockEntry

    protected ghidra.trace.database.memory.DBTraceMemoryBlockEntry findSoonestBlockEntry(DBTraceUtils.OffsetSnap loc, boolean inclusive)
    Locate the soonest block entry for the given offset-snap pair

    To qualify, the entry must have a snap greater than (or optionally equal to) that given and an offset exactly equal to that given. That is, it is the earliest in time, but most follow the given snap. Additionally, if the given snap is in scratch space, the found entry must also be in scratch space.

    Parameters:
      `loc` - the offset-snap pair
      `inclusive` - true to allow equal snap
    Returns:
      the found entry, or null

  - ### doPutBytes

    protected void doPutBytes(DBTraceUtils.OffsetSnap loc, ByteBuffer buf, int dstOffset, int maxLen) throws IOException
    Throws:
      `IOException`

  - ### doPutFutureBytes

    protected void doPutFutureBytes(DBTraceUtils.OffsetSnap loc, ByteBuffer buf, int dstOffset, int maxLen, DBTraceMemorySpace.OutSnap lastSnap, Set<TraceAddressSnapRange> changed) throws IOException
    Throws:
      `IOException`

  - ### doPutBytes

    protected int doPutBytes(long snap, Address start, ByteBuffer buf, DBTraceMemorySpace.OutSnap lastSnap, Set<TraceAddressSnapRange> changed) throws IOException
    Throws:
      `IOException`

  - ### putBytes

    public int putBytes(long snap, Address start, ByteBuffer buf)
    Description copied from interface: `TraceMemoryOperations`
    Write bytes at the given snap and address

    This will attempt to read `Buffer.remaining()` bytes starting at `Buffer.position()` from the source buffer `buf` and write them into memory at the specified time and location. The affected region is also updated to `TraceMemoryState.KNOWN`. The written bytes are assumed effective for all future snaps up to the next write.

    Specified by:
      `putBytes` in interface `TraceMemoryOperations`
    Parameters:
      `snap` - the time
      `start` - the location
      `buf` - the source buffer of bytes
    Returns:
      the number of bytes written

  - ### doGetBytes

    protected void doGetBytes(DBTraceUtils.OffsetSnap loc, ByteBuffer buf, int srcOffset, int maxLen) throws IOException
    Throws:
      `IOException`

  - ### getBytes

    public int getBytes(long snap, Address start, ByteBuffer buf)
    Description copied from interface: `TraceMemoryOperations`
    Read the most recent bytes from the given snap and address

    This will attempt to read `Buffer.remaining()` of the most recent bytes from memory at the specified time and location and write them into the destination buffer `buf` starting at `Buffer.position()`. Where bytes in memory have no defined value, values in the destination buffer are unspecified. The implementation may leave those bytes in the destination buffer unmodified, or it may write zeroes.

    Specified by:
      `getBytes` in interface `TraceMemoryOperations`
    Parameters:
      `snap` - the time
      `start` - the location
      `buf` - the destination buffer of bytes
    Returns:
      the number of bytes read

  - ### truncateLen

    protected int truncateLen(int len, Address start)

  - ### getViewBytes

    public int getViewBytes(long snap, Address start, ByteBuffer buf)
    Description copied from interface: `TraceMemoryOperations`
    Read the most recent bytes from the given snap and address, following schedule forks

    This behaves similarly to `TraceMemoryOperations.getBytes(long, Address, ByteBuffer)`, except it checks for the `TraceMemoryState.KNOWN` state among each involved snap range and reads the applicable address ranges, preferring the most recent. Where memory is never known the buffer is left unmodified.

    Specified by:
      `getViewBytes` in interface `TraceMemoryOperations`
    Parameters:
      `snap` - the time
      `start` - the location
      `buf` - the destination buffer of bytes
    Returns:
      the number of bytes read

  - ### doFindBytesInRange

    protected Address doFindBytesInRange(long snap, AddressRange range, ByteBuffer data, ByteBuffer mask, boolean forward, TaskMonitor monitor)

  - ### findBytes

    public Address findBytes(long snap, AddressRange range, ByteBuffer data, ByteBuffer mask, boolean forward, TaskMonitor monitor)
    Description copied from interface: `TraceMemoryOperations`
    Search the given address range at the given snap for a given byte pattern
    Specified by:
      `findBytes` in interface `TraceMemoryOperations`
    Parameters:
      `snap` - the time to search
      `range` - the address range to search
      `data` - the values to search for
      `mask` - a mask on the bits of `data`; or null to match all bytes exactly
      `forward` - true to return the match with the lowest address in `range`, false for the highest address.
      `monitor` - a monitor for progress reporting and canceling
    Returns:
      the minimum address of the matched bytes, or `null` if not found

  - ### doCheckBytesChanged

    protected boolean doCheckBytesChanged(DBTraceUtils.OffsetSnap loc, int srcOffset, int maxLen, ByteBuffer eBuf, ByteBuffer pBuf) throws IOException
    Throws:
      `IOException`

  - ### doCheckBytesChanged

    protected boolean doCheckBytesChanged(long snap, AddressRange range, ByteBuffer buf1, ByteBuffer buf2) throws IOException
    Throws:
      `IOException`

  - ### getSnapOfMostRecentChangeToBlock

    public Long getSnapOfMostRecentChangeToBlock(long snap, Address address)
    Description copied from interface: `TraceMemoryOperations`
    Find the internal storage block that most-recently defines the value at the given snap and address, and return the block's snap.

    This method reveals portions of the internal storage so that clients can optimize difference computations by eliminating corresponding ranges defined by the same block. If the underlying implementation cannot answer this question, this returns the given snap.

    Specified by:
      `getSnapOfMostRecentChangeToBlock` in interface `TraceMemoryOperations`
    Parameters:
      `snap` - the time
      `address` - the location
    Returns:
      the most snap for the most recent containing block

  - ### getBlockSize

    public int getBlockSize()
    Description copied from interface: `TraceMemoryOperations`
    Get the block size used by internal storage.

    This method reveals portions of the internal storage so that clients can optimize searches. If the underlying implementation cannot answer this question, this returns 0.

    Specified by:
      `getBlockSize` in interface `TraceMemoryOperations`
    Returns:
      the block size

  - ### isCross

    protected boolean isCross(long lower, long upper)

  - ### getFirstChange

    public long getFirstChange(Lifespan span, AddressRange range)
    Determine the truncation snap if the given span and range include byte changes

    Code units do not understand or accommodate changes in time, so the underlying bytes of the unit must be the same throughout its lifespan. Typically, units are placed with a desired creation snap, and then its life is extended into the future opportunistically. Thus, when truncating, we desire to keep the start snap, then search for the soonest byte change within the desired lifespan. Furthermore, we generally don't permit a unit to exist in both record and scratch spaces, i.e., it cannot span both the -1 and 0 snaps.

    Parameters:
      `span` - the desired lifespan
      `range` - the address range covered
    Returns:
      the first snap that should be excluded, or `Long.MIN_VALUE` to indicate no change.

  - ### removeBytes

    public void removeBytes(long snap, Address start, int len)
    Description copied from interface: `TraceMemoryOperations`
    Remove bytes from the given time and location

    This deletes all observed bytes from the given address through length at the given snap. If there were no observations in the range at exactly the given snap, this has no effect. If there were, then those observations are removed. The next time those bytes are read, they will have a value from a previous snap, or no value at all. The affected region's state is also deleted, i.e., set to `null`, implying `TraceMemoryState.UNKNOWN`.

    Note, use of this method is discouraged. The more observations within the same range that follow the deleted observation, the more expensive this operation typically is, since all of those observations may need to be updated.

    Specified by:
      `removeBytes` in interface `TraceMemoryOperations`
    Parameters:
      `snap` - the time
      `start` - the location
      `len` - the number of bytes to remove

  - ### getBufferAt

    public MemBuffer getBufferAt(long snap, Address start, ByteOrder byteOrder)
    Description copied from interface: `TraceMemoryOperations`
    Get a view of a particular snap as a memory buffer

    The bytes read by this buffer are the most recent bytes written before the given snap

    Specified by:
      `getBufferAt` in interface `TraceMemoryOperations`
    Parameters:
      `snap` - the snap
      `start` - the starting address
      `byteOrder` - the byte ordering for this buffer
    Returns:
      the memory buffer

  - ### pack

    public void pack()
    Description copied from interface: `TraceMemoryOperations`
    Optimize storage space

    This gives the implementation an opportunity to clean up garbage, apply compression, etc., in order to best use the storage space. Because memory observations can be sparse, a trace's memory is often compressible, and observations are not often modified or deleted, packing is recommended whenever the trace is saved to disk.

    Specified by:
      `pack` in interface `TraceMemoryOperations`

  - ### invalidateCache

    public void invalidateCache()
    Specified by:
      `invalidateCache` in interface `DBTraceSpaceBased`