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
  • 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:
    • 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:
    • 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:
    • 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:
    • 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:
    • 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()