Package ghidra.trace.database.memory

# Class DBTraceMemoryRegion

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

All Implemented Interfaces:
  `DBTraceObjectInterface`, `TraceMemoryRegion`, `TraceObjectInterface`, `TraceUniqueObject`

public class DBTraceMemoryRegion extends Object implements TraceMemoryRegion, DBTraceObjectInterface

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Class
  Description
  `protected static final record`
  `DBTraceMemoryRegion.Keys`
  `protected class`
  `DBTraceMemoryRegion.RegionChangeTranslator`

  ## Nested classes/interfaces inherited from interface ghidra.trace.database.target.DBTraceObjectInterface

  `DBTraceObjectInterface.Translator<T>`

- ## Field Summary

  ### Fields inherited from interface ghidra.trace.model.memory.TraceMemoryRegion

  `KEY_EXECUTABLE, KEY_RANGE, KEY_READABLE, KEY_VOLATILE, KEY_WRITABLE`

  ### Fields inherited from interface ghidra.trace.model.target.iface.TraceObjectInterface

  `KEY_COMMENT, KEY_DISPLAY, KEY_KIND, KEY_MODIFIED, KEY_ORDER, KEY_SHORT_DISPLAY, KEY_TYPE, KEY_VALUE`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `DBTraceMemoryRegion(DBTraceObject object)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `addFlags(long snap, Collection<TraceMemoryFlag> flags)`
  Add the given flags, e.g., permissions, to this region
  `void`
  `addFlags(Lifespan lifespan, Collection<TraceMemoryFlag> flags)`
  Add the given flags, e.g., permissions, to this region
  `void`
  `clearFlags(long snap, Collection<TraceMemoryFlag> flags)`
  Remove the given flags, e.g., permissions, from this region
  `void`
  `clearFlags(Lifespan lifespan, Collection<TraceMemoryFlag> flags)`
  Remove the given flags, e.g., permissions, from this region
  `void`
  `delete()`
  Delete this region from the trace
  `Set<TraceMemoryFlag>`
  `getFlags(long snap)`
  Get the flags, e.g., permissions, of this region
  `long`
  `getLength(long snap)`
  Measure the length, in bytes, of this region's address range
  `Address`
  `getMaxAddress(long snap)`
  Get the maximum address of the range
  `Address`
  `getMinAddress(long snap)`
  Get the minimum address of the range
  `String`
  `getName(long snap)`
  Get the "short name" of this region
  `TraceObject`
  `getObject()`
  Get the object backing this implementation
  `String`
  `getPath()`
  Get the "full name" of this region
  `AddressRange`
  `getRange(long snap)`
  Get the virtual memory address range of this region
  `Trace`
  `getTrace()`
  Get the trace containing this region
  `boolean`
  `isValid(long snap)`
  Check if the region is valid at the given snapshot
  `protected static String`
  `keyForFlag(TraceMemoryFlag flag)`
  `void`
  `remove(long snap)`
  Remove this region from the given snap on
  `void`
  `setFlags(long snap, Collection<TraceMemoryFlag> flags)`
  Set the flags, e.g., permissions, of this region
  `void`
  `setFlags(Lifespan lifespan, Collection<TraceMemoryFlag> flags)`
  Set the flags, e.g., permissions, of this region
  `void`
  `setLength(long snap, long length)`
  Set the length, in bytes, of this region's address range
  `void`
  `setMaxAddress(long snap, Address max)`
  Set the maximum address of the range
  `void`
  `setMinAddress(long snap, Address min)`
  Set the minimum address of the range
  `void`
  `setName(long snap, String name)`
  Set the "short name" of this region
  `void`
  `setName(Lifespan lifespan, String name)`
  Set the "short name" of this region
  `void`
  `setRange(long snap, AddressRange newRange)`
  Set the virtual memory address range of this region
  `void`
  `setRange(Lifespan lifespan, AddressRange newRange)`
  Set the virtual memory address range of this region
  `TraceChangeRecord<?,?>`
  `translateEvent(TraceChangeRecord<?,?> rec)`
  Translate an object event into the interface-specific event
  `protected void`
  `updateViewsAdded()`
  `protected void`
  `updateViewsDeleted()`
  `protected void`
  `updateViewsLifespanChanged(Lifespan oldLifespan, Lifespan newLifespan)`
  `protected void`
  `updateViewsValueChanged(Lifespan lifespan, String key, Object oldValue, Object newValue)`

  ### 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.target.DBTraceObjectInterface

  `getObjectKey, isDeleted, spaceForValue`

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

  `addFlags, clearFlags, isExecute, isRead, isVolatile, isWrite, setExecute, setFlags, setRead, setVolatile, setWrite`

- ## Constructor Details

  - ### DBTraceMemoryRegion

    public DBTraceMemoryRegion(DBTraceObject object)

- ## Method Details

  - ### getTrace

    public Trace getTrace()
    Description copied from interface: `TraceMemoryRegion`
    Get the trace containing this region
    Specified by:
      `getTrace` in interface `TraceMemoryRegion`
    Returns:
      the trace

  - ### getPath

    public String getPath()
    Description copied from interface: `TraceMemoryRegion`
    Get the "full name" of this region

    This is a unique key (within any snap) for retrieving the region, and may not be suitable for display on the screen.

    Specified by:
      `getPath` in interface `TraceMemoryRegion`
    Returns:
      the path

  - ### setName

    public void setName(Lifespan lifespan, String name)
    Description copied from interface: `TraceMemoryRegion`
    Set the "short name" of this region

    The given name should be suitable for display on the screen.

    Specified by:
      `setName` in interface `TraceMemoryRegion`
    Parameters:
      `lifespan` - the span of time
      `name` - the name

  - ### setName

    public void setName(long snap, String name)
    Description copied from interface: `TraceMemoryRegion`
    Set the "short name" of this region

    The given name should be suitable for display on the screen.

    Specified by:
      `setName` in interface `TraceMemoryRegion`
    Parameters:
      `snap` - the snap
      `name` - the name

  - ### getName

    public String getName(long snap)
    Description copied from interface: `TraceMemoryRegion`
    Get the "short name" of this region

    This defaults to the "full name," but can be modified via `TraceMemoryRegion.setName(long, String)`

    Specified by:
      `getName` in interface `TraceMemoryRegion`
    Parameters:
      `snap` - the snap
    Returns:
      the name

  - ### setRange

    public void setRange(Lifespan lifespan, AddressRange newRange)
    Description copied from interface: `TraceMemoryRegion`
    Set the virtual memory address range of this region

    The addresses in the range should be those the target's CPU would use to access the region, i.e., the virtual memory address if an MMU is involved, or the physical address if no MMU is involved.

    Specified by:
      `setRange` in interface `TraceMemoryRegion`
    Parameters:
      `lifespan` - the span of time
      `newRange` - the address range

  - ### setRange

    public void setRange(long snap, AddressRange newRange)
    Description copied from interface: `TraceMemoryRegion`
    Set the virtual memory address range of this region

    The addresses in the range should be those the target's CPU would use to access the region, i.e., the virtual memory address if an MMU is involved, or the physical address if no MMU is involved.

    Specified by:
      `setRange` in interface `TraceMemoryRegion`
    Parameters:
      `snap` - the snap
      `newRange` - the address range

  - ### getRange

    public AddressRange getRange(long snap)
    Description copied from interface: `TraceMemoryRegion`
    Get the virtual memory address range of this region
    Specified by:
      `getRange` in interface `TraceMemoryRegion`
    Parameters:
      `snap` - the snap
    Returns:
      the address range

  - ### setMinAddress

    public void setMinAddress(long snap, Address min)
    Description copied from interface: `TraceMemoryRegion`
    Set the minimum address of the range

    Note that this sets the range from the given snap on to the same range, no matter what changes may have occurred since.

    Specified by:
      `setMinAddress` in interface `TraceMemoryRegion`
    Parameters:
      `snap` - the snap
      `min` - the new minimum
    See Also:
      - `TraceMemoryRegion.setRange(long, AddressRange)`

  - ### getMinAddress

    public Address getMinAddress(long snap)
    Description copied from interface: `TraceMemoryRegion`
    Get the minimum address of the range
    Specified by:
      `getMinAddress` in interface `TraceMemoryRegion`
    Parameters:
      `snap` - the snap
    Returns:
      the minimum address
    See Also:
      - `TraceMemoryRegion.getRange(long)`

  - ### setMaxAddress

    public void setMaxAddress(long snap, Address max)
    Description copied from interface: `TraceMemoryRegion`
    Set the maximum address of the range

    Note that this sets the range from the given snap on to the same range, no matter what changes may have occurred since.

    Specified by:
      `setMaxAddress` in interface `TraceMemoryRegion`
    Parameters:
      `snap` - the snap
      `max` - the new minimum
    See Also:
      - `TraceMemoryRegion.setRange(long, AddressRange)`

  - ### getMaxAddress

    public Address getMaxAddress(long snap)
    Description copied from interface: `TraceMemoryRegion`
    Get the maximum address of the range
    Specified by:
      `getMaxAddress` in interface `TraceMemoryRegion`
    Parameters:
      `snap` - the snap
    Returns:
      the maximum address
    See Also:
      - `TraceMemoryRegion.getRange(long)`

  - ### setLength

    public void setLength(long snap, long length) throws AddressOverflowException
    Description copied from interface: `TraceMemoryRegion`
    Set the length, in bytes, of this region's address range

    This adjusts the max address of the range so that its length becomes that given. Note that this sets the range from the given snap on to the same range, no matter what changes may have occurred since.

    Specified by:
      `setLength` in interface `TraceMemoryRegion`
    Parameters:
      `snap` - the snap
      `length` - the desired length of the range
    Throws:
      `AddressOverflowException` - if extending the range would cause the max address to overflow
    See Also:
      - `TraceMemoryRegion.setRange(long, AddressRange)`

  - ### getLength

    public long getLength(long snap)
    Description copied from interface: `TraceMemoryRegion`
    Measure the length, in bytes, of this region's address range
    Specified by:
      `getLength` in interface `TraceMemoryRegion`
    Parameters:
      `snap` - the snap
    Returns:
      the length

  - ### keyForFlag

    protected static String keyForFlag(TraceMemoryFlag flag)

  - ### setFlags

    public void setFlags(Lifespan lifespan, Collection<TraceMemoryFlag> flags)
    Description copied from interface: `TraceMemoryRegion`
    Set the flags, e.g., permissions, of this region
    Specified by:
      `setFlags` in interface `TraceMemoryRegion`
    Parameters:
      `lifespan` - the span of time
      `flags` - the flags

  - ### addFlags

    public void addFlags(Lifespan lifespan, Collection<TraceMemoryFlag> flags)
    Description copied from interface: `TraceMemoryRegion`
    Add the given flags, e.g., permissions, to this region
    Specified by:
      `addFlags` in interface `TraceMemoryRegion`
    Parameters:
      `lifespan` - the span of time
      `flags` - the flags

  - ### clearFlags

    public void clearFlags(Lifespan lifespan, Collection<TraceMemoryFlag> flags)
    Description copied from interface: `TraceMemoryRegion`
    Remove the given flags, e.g., permissions, from this region
    Specified by:
      `clearFlags` in interface `TraceMemoryRegion`
    Parameters:
      `lifespan` - the span of time
      `flags` - the flags

  - ### setFlags

    public void setFlags(long snap, Collection<TraceMemoryFlag> flags)
    Description copied from interface: `TraceMemoryRegion`
    Set the flags, e.g., permissions, of this region
    Specified by:
      `setFlags` in interface `TraceMemoryRegion`
    Parameters:
      `snap` - the snap
      `flags` - the flags

  - ### addFlags

    public void addFlags(long snap, Collection<TraceMemoryFlag> flags)
    Description copied from interface: `TraceMemoryRegion`
    Add the given flags, e.g., permissions, to this region
    Specified by:
      `addFlags` in interface `TraceMemoryRegion`
    Parameters:
      `snap` - the snap
      `flags` - the flags

  - ### clearFlags

    public void clearFlags(long snap, Collection<TraceMemoryFlag> flags)
    Description copied from interface: `TraceMemoryRegion`
    Remove the given flags, e.g., permissions, from this region
    Specified by:
      `clearFlags` in interface `TraceMemoryRegion`
    Parameters:
      `snap` - the snap
      `flags` - the flags

  - ### getFlags

    public Set<TraceMemoryFlag> getFlags(long snap)
    Description copied from interface: `TraceMemoryRegion`
    Get the flags, e.g., permissions, of this region
    Specified by:
      `getFlags` in interface `TraceMemoryRegion`
    Parameters:
      `snap` - the snap
    Returns:
      the flags

  - ### delete

    public void delete()
    Description copied from interface: `TraceMemoryRegion`
    Delete this region from the trace
    Specified by:
      `delete` in interface `TraceMemoryRegion`

  - ### remove

    public void remove(long snap)
    Description copied from interface: `TraceMemoryRegion`
    Remove this region from the given snap on
    Specified by:
      `remove` in interface `TraceMemoryRegion`
    Parameters:
      `snap` -

  - ### isValid

    public boolean isValid(long snap)
    Description copied from interface: `TraceMemoryRegion`
    Check if the region is valid at the given snapshot

    In object mode, a region's life may be disjoint, so checking if the snap occurs between creation and destruction is not quite sufficient. This method encapsulates validity. In object mode, it checks that the region object has a canonical parent at the given snapshot. In table mode, it checks that the lifespan contains the snap.

    Specified by:
      `isValid` in interface `TraceMemoryRegion`
    Parameters:
      `snap` - the snapshot key
    Returns:
      true if valid, false if not

  - ### getObject

    public TraceObject getObject()
    Description copied from interface: `TraceObjectInterface`
    Get the object backing this implementation
    Specified by:
      `getObject` in interface `TraceObjectInterface`
    Returns:
      the object

  - ### translateEvent

    public TraceChangeRecord<?,?> translateEvent(TraceChangeRecord<?,?> rec)
    Description copied from interface: `DBTraceObjectInterface`
    Translate an object event into the interface-specific event

    Both the object event and the interface-specific event, if applicable, will be emitted. If multiple events need to be emitted, then this method may emit them directly via its object's trace. If exactly one event needs to be emitted, then this method should return the translated record. If no translation applies, or if the translated event(s) were emitted directly, this method returns `null`.

    Specified by:
      `translateEvent` in interface `DBTraceObjectInterface`
    Parameters:
      `rec` - the object event
    Returns:
      the interface-specific event to emit, or `null`

  - ### updateViewsAdded

    protected void updateViewsAdded()

  - ### updateViewsLifespanChanged

    protected void updateViewsLifespanChanged(Lifespan oldLifespan, Lifespan newLifespan)

  - ### updateViewsValueChanged

    protected void updateViewsValueChanged(Lifespan lifespan, String key, Object oldValue, Object newValue)

  - ### updateViewsDeleted

    protected void updateViewsDeleted()