Package ghidra.pcode.exec.trace.data

# Class DefaultPcodeTracePropertyAccess<T>

java.lang.Object
ghidra.pcode.exec.trace.data.DefaultPcodeTracePropertyAccess<T>

Type Parameters:
  `T` - the type of the property's values

All Implemented Interfaces:
  `PcodeTracePropertyAccess<T>`

public class DefaultPcodeTracePropertyAccess<T> extends Object implements PcodeTracePropertyAccess<T>
The default trace-property access shim

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `protected final InternalPcodeTraceDataAccess`
  `data`
  `protected final String`
  `name`
  `protected TracePropertyMapOperations<T>`
  `po`
  `protected final Class<T>`
  `type`

- ## Constructor Summary

  Constructors
  Modifier
  Constructor
  Description
  `protected`
  `DefaultPcodeTracePropertyAccess(InternalPcodeTraceDataAccess data, String name, Class<T> type)`
  Construct the shim

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `clear(AddressRange range)`
  Clear the property's value across a range
  `T`
  `get(Address address)`
  Get the property's value at the given address
  `Map.Entry<AddressRange,T>`
  `getEntry(Address address)`
  Get the property's entry at the given address
  `Language`
  `getLanguage()`
  Returns the language.
  `protected TracePropertyMapOperations<T>`
  `getPropertyOperations(boolean createIfAbsent)`
  Get the interface for accessing the trace property on memory or registers
  `boolean`
  `hasSpace(AddressSpace space)`
  Check if the trace has allocated property space for the given address space
  `void`
  `put(AddressRange range, T value)`
  Set the property's value at the given range
  `void`
  `put(Address address, T value)`
  Set the property's value at the given address
  `protected Address`
  `toOverlay(TracePropertyMapOperations<T> ops, Address address)`
  If this provides access to an overlay space, translate the physical address to it
  `protected AddressRange`
  `toOverlay(TracePropertyMapOperations<T> ops, AddressRange range)`
  If this provides access to an overlay space, translate the physical range to it
  `protected T`
  `whenNull(Address hostAddress)`
  Extension point: Alternative logic when the trace property is null

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

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

- ## Field Details

  - ### data

    protected final InternalPcodeTraceDataAccess data

  - ### name

    protected final String name

  - ### type

    protected final Class<T> type

  - ### po

    protected TracePropertyMapOperations<T> po

- ## Constructor Details

  - ### DefaultPcodeTracePropertyAccess

    protected DefaultPcodeTracePropertyAccess(InternalPcodeTraceDataAccess data, String name, Class<T> type)
    Construct the shim
    Parameters:
      `data` - the trace-data access shim providing this property access shim
      `name` - the name of the property
      `type` - the type of the property

- ## Method Details

  - ### getLanguage

    public Language getLanguage()
    Description copied from interface: `PcodeTracePropertyAccess`
    Returns the language.
    Specified by:
      `getLanguage` in interface `PcodeTracePropertyAccess<T>`
    Returns:
      the language

  - ### getPropertyOperations

    protected TracePropertyMapOperations<T> getPropertyOperations(boolean createIfAbsent)
    Get the interface for accessing the trace property on memory or registers
    Parameters:
      `createIfAbsent` - whether to create the missing property (and space in the case of a register property)
    Returns:
      the operations, or null

  - ### whenNull

    protected T whenNull(Address hostAddress)
    Extension point: Alternative logic when the trace property is null
    Parameters:
      `hostAddress` - the trace address (in the host platform)
    Returns:
      the alternative value, or null

  - ### get

    public T get(Address address)
    Description copied from interface: `PcodeTracePropertyAccess`
    Get the property's value at the given address

    This may search for the same property from other related data sources, e.g., from mapped static images.

    Specified by:
      `get` in interface `PcodeTracePropertyAccess<T>`
    Parameters:
      `address` - the address
    Returns:
      the value, or null if not set

  - ### getEntry

    public Map.Entry<AddressRange,T> getEntry(Address address)
    Description copied from interface: `PcodeTracePropertyAccess`
    Get the property's entry at the given address
    Specified by:
      `getEntry` in interface `PcodeTracePropertyAccess<T>`
    Parameters:
      `address` - the address
    Returns:
      the entry, or null if not set

  - ### put

    public void put(Address address, T value)
    Description copied from interface: `PcodeTracePropertyAccess`
    Set the property's value at the given address

    The value is effective for future snapshots up to but excluding the next snapshot where another value is set at the same address.

    Specified by:
      `put` in interface `PcodeTracePropertyAccess<T>`
    Parameters:
      `address` - the address
      `value` - the value to set

  - ### put

    public void put(AddressRange range, T value)
    Description copied from interface: `PcodeTracePropertyAccess`
    Set the property's value at the given range

    The value is effective for future snapshots up to but excluding the next snapshot where another value is set at the same address.

    Specified by:
      `put` in interface `PcodeTracePropertyAccess<T>`
    Parameters:
      `range` - the range
      `value` - the value to set

  - ### clear

    public void clear(AddressRange range)
    Description copied from interface: `PcodeTracePropertyAccess`
    Clear the property's value across a range
    Specified by:
      `clear` in interface `PcodeTracePropertyAccess<T>`
    Parameters:
      `range` - the range

  - ### hasSpace

    public boolean hasSpace(AddressSpace space)
    Description copied from interface: `PcodeTracePropertyAccess`
    Check if the trace has allocated property space for the given address space

    This is available for optimizations when it may take effort to compute an address. If the space is not allocated, then no matter the offset, the property will not have a value. Clients can check this method to avoid the address computation, if they already know the address space.

    Specified by:
      `hasSpace` in interface `PcodeTracePropertyAccess<T>`
    Parameters:
      `space` - the address space
    Returns:
      true if there is a property space

  - ### toOverlay

    protected Address toOverlay(TracePropertyMapOperations<T> ops, Address address)
    If this provides access to an overlay space, translate the physical address to it
    Parameters:
      `ops` - the property operations
      `address` - the physical address
    Returns:
      the overlay address, or the same address

  - ### toOverlay

    protected AddressRange toOverlay(TracePropertyMapOperations<T> ops, AddressRange range)
    If this provides access to an overlay space, translate the physical range to it
    Parameters:
      `ops` - the property operations
      `range` - the physical range
    Returns:
      the overlay range, or the same range