Package ghidra.trace.database.breakpoint

# Class DBTraceBreakpointLocation

java.lang.Object
ghidra.trace.database.breakpoint.DBTraceBreakpointLocation

All Implemented Interfaces:
  `DBTraceObjectInterface`, `TraceBreakpointCommon`, `TraceBreakpointLocation`, `TraceObjectInterface`, `TraceUniqueObject`

public class DBTraceBreakpointLocation extends Object implements TraceBreakpointLocation, DBTraceObjectInterface

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Class
  Description
  `protected static class`
  `DBTraceBreakpointLocation.BreakpointChangeTranslator`

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

  `DBTraceObjectInterface.Translator<T>`

- ## Field Summary

  ### Fields inherited from interface ghidra.trace.model.breakpoint.TraceBreakpointLocation

  `KEY_EMU_ENABLED, KEY_EMU_SLEIGH, KEY_RANGE`

  ### 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
  `DBTraceBreakpointLocation(DBTraceObject object)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `delete()`
  Delete this breakpoint from the trace
  `AddressSpace`
  `getAddressSpace(long snap)`
  `String`
  `getComment(long snap)`
  Get the comment on this breakpoint
  `String`
  `getEmuSleigh(long snap)`
  Get the Sleigh source that replaces the breakpointed instruction in emulation
  `long`
  `getLength(long snap)`
  Get the length of this breakpoint, usually 1
  `Address`
  `getMaxAddress(long snap)`
  Get the maximum address in this breakpoint's range
  `Address`
  `getMinAddress(long snap)`
  Get the minimum address in this breakpoint's range
  `String`
  `getName(long snap)`
  Get the "short name" of this breakpoint
  `TraceObject`
  `getObject()`
  Get the object backing this implementation
  `TraceBreakpointSpec`
  `getOrCreateSpecification()`
  `String`
  `getPath()`
  Get the "full name" of this breakpoint
  `AddressRange`
  `getRange(long snap)`
  Get the range covered by this breakpoint location
  `TraceBreakpointSpec`
  `getSpecification()`
  Get the specification that caused this location to exist
  `Set<TraceThread>`
  `getThreads(long snap)`
  Get the set of threads to which this breakpoint's application is limited
  `Trace`
  `getTrace()`
  Get the trace containing this breakpoint
  `boolean`
  `isAlive(Lifespan span)`
  Check if the breakpoint is present for any of the given span
  `boolean`
  `isEmuEnabled(long snap)`
  Check whether this breakpoint is enabled or disabled for emulation at the given snap
  `boolean`
  `isEnabled(long snap)`
  Check whether this breakpoint is enabled or disabled at the given snap
  `boolean`
  `isValid(long snap)`
  Check if the breakpoint is present at the given snapshot
  `void`
  `remove(long snap)`
  Remove this breakpoint from the given snap on
  `void`
  `setComment(long snap, String comment)`
  Set a comment on this breakpoint
  `void`
  `setComment(Lifespan lifespan, String comment)`
  Set a comment on this breakpoint
  `void`
  `setEmuEnabled(long snap, boolean emuEnabled)`
  Set whether this breakpoint is enabled or disabled for emulation
  `void`
  `setEmuEnabled(Lifespan lifespan, boolean emuEnabled)`
  Set whether this breakpoint is enabled or disabled for emulation
  `void`
  `setEmuSleigh(long snap, String sleigh)`
  Set Sleigh source to replace the breakpointed instruction in emulation
  `void`
  `setEmuSleigh(Lifespan lifespan, String sleigh)`
  As in `TraceBreakpointLocation.setEmuSleigh(long, String)`, but for a specific lifespan
  `void`
  `setEnabled(long snap, boolean enabled)`
  Set whether this breakpoint was enabled or disabled
  `void`
  `setEnabled(Lifespan lifespan, boolean enabled)`
  Set whether this breakpoint was enabled or disabled
  `void`
  `setName(long snap, String name)`
  Set the "short name" of this breakpoint
  `void`
  `setName(Lifespan lifespan, String name)`
  Set the "short name" of this breakpoint
  `void`
  `setRange(Lifespan lifespan, AddressRange range)`
  Set the range covered by this breakpoint location
  `TraceChangeRecord<?,?>`
  `translateEvent(TraceChangeRecord<?,?> rec)`
  Translate an object event into the interface-specific event

  ### 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.breakpoint.TraceBreakpointLocation

  `getKinds`

- ## Constructor Details

  - ### DBTraceBreakpointLocation

    public DBTraceBreakpointLocation(DBTraceObject object)

- ## Method Details

  - ### getTrace

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

  - ### getPath

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

    This is a name unique to this breakpoint, which may not be suitable for display on the screen.

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

  - ### setName

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

    This should be a name suitable for display on the screen

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

  - ### setName

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

    This should be a name suitable for display on the screen

    Specified by:
      `setName` in interface `TraceBreakpointCommon`
    Parameters:
      `snap` - the first effective snap
      `name` - the new name

  - ### getName

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

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

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

  - ### setRange

    public void setRange(Lifespan lifespan, AddressRange range)
    Description copied from interface: `TraceBreakpointLocation`
    Set the range covered by this breakpoint location
    Specified by:
      `setRange` in interface `TraceBreakpointLocation`
    Parameters:
      `lifespan` - the span of time
      `range` - the span of addresses

  - ### getRange

    public AddressRange getRange(long snap)
    Description copied from interface: `TraceBreakpointLocation`
    Get the range covered by this breakpoint location

    Most often, esp. for execution breakpoints, this is a single address.

    Specified by:
      `getRange` in interface `TraceBreakpointLocation`
    Parameters:
      `snap` - the snap
    Returns:
      the range

  - ### getMinAddress

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

  - ### getMaxAddress

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

  - ### getLength

    public long getLength(long snap)
    Description copied from interface: `TraceBreakpointLocation`
    Get the length of this breakpoint, usually 1
    Specified by:
      `getLength` in interface `TraceBreakpointLocation`
    Parameters:
      `snap` - the snap
    Returns:
      the length

  - ### setEnabled

    public void setEnabled(Lifespan lifespan, boolean enabled)
    Description copied from interface: `TraceBreakpointCommon`
    Set whether this breakpoint was enabled or disabled
    Specified by:
      `setEnabled` in interface `TraceBreakpointCommon`
    Parameters:
      `lifespan` - the span of time
      `enabled` - true if enabled, false if disabled

  - ### setEnabled

    public void setEnabled(long snap, boolean enabled)
    Description copied from interface: `TraceBreakpointCommon`
    Set whether this breakpoint was enabled or disabled
    Specified by:
      `setEnabled` in interface `TraceBreakpointCommon`
    Parameters:
      `snap` - the first effective snap
      `enabled` - true if enabled, false if disabled

  - ### isEnabled

    public boolean isEnabled(long snap)
    Description copied from interface: `TraceBreakpointCommon`
    Check whether this breakpoint is enabled or disabled at the given snap
    Specified by:
      `isEnabled` in interface `TraceBreakpointCommon`
    Parameters:
      `snap` - the snap
    Returns:
      true if enabled, false if disabled

  - ### getThreads

    public Set<TraceThread> getThreads(long snap)
    Description copied from interface: `TraceBreakpointLocation`
    Get the set of threads to which this breakpoint's application is limited

    Note, an empty set here implies all contemporary live threads, i.e., the process.

    Specified by:
      `getThreads` in interface `TraceBreakpointLocation`
    Parameters:
      `snap` - the snap
    Returns:
      the (possibly empty) set of affected threads

  - ### setComment

    public void setComment(Lifespan lifespan, String comment)
    Description copied from interface: `TraceBreakpointCommon`
    Set a comment on this breakpoint
    Specified by:
      `setComment` in interface `TraceBreakpointCommon`
    Parameters:
      `lifespan` - the span of time
      `comment` - the comment, possibly `null`

  - ### setComment

    public void setComment(long snap, String comment)
    Description copied from interface: `TraceBreakpointCommon`
    Set a comment on this breakpoint
    Specified by:
      `setComment` in interface `TraceBreakpointCommon`
    Parameters:
      `snap` - the snap
      `comment` - the comment, possibly `null`

  - ### getComment

    public String getComment(long snap)
    Description copied from interface: `TraceBreakpointCommon`
    Get the comment on this breakpoint
    Specified by:
      `getComment` in interface `TraceBreakpointCommon`
    Parameters:
      `snap` - the snap
    Returns:
      the comment, possibly `null`

  - ### setEmuEnabled

    public void setEmuEnabled(Lifespan lifespan, boolean emuEnabled)
    Description copied from interface: `TraceBreakpointLocation`
    Set whether this breakpoint is enabled or disabled for emulation
    Specified by:
      `setEmuEnabled` in interface `TraceBreakpointLocation`
    Parameters:
      `lifespan` - the span of time
      `emuEnabled` - true if enabled, false if disabled

  - ### setEmuEnabled

    public void setEmuEnabled(long snap, boolean emuEnabled)
    Description copied from interface: `TraceBreakpointLocation`
    Set whether this breakpoint is enabled or disabled for emulation
    Specified by:
      `setEmuEnabled` in interface `TraceBreakpointLocation`
    Parameters:
      `snap` - the snap
      `emuEnabled` - true if enabled, false if disabled

  - ### isEmuEnabled

    public boolean isEmuEnabled(long snap)
    Description copied from interface: `TraceBreakpointLocation`
    Check whether this breakpoint is enabled or disabled for emulation at the given snap
    Specified by:
      `isEmuEnabled` in interface `TraceBreakpointLocation`
    Parameters:
      `snap` - the snap
    Returns:
      true if enabled, false if disabled

  - ### setEmuSleigh

    public void setEmuSleigh(Lifespan lifespan, String sleigh)
    Description copied from interface: `TraceBreakpointLocation`
    As in `TraceBreakpointLocation.setEmuSleigh(long, String)`, but for a specific lifespan
    Specified by:
      `setEmuSleigh` in interface `TraceBreakpointLocation`
    Parameters:
      `lifespan` - the span of time
      `sleigh` - the Sleigh source

  - ### setEmuSleigh

    public void setEmuSleigh(long snap, String sleigh)
    Description copied from interface: `TraceBreakpointLocation`
    Set Sleigh source to replace the breakpointed instruction in emulation

    The default is simply:

         emu_swi();
         emu_exec_decoded();

    That is effectively a non-conditional breakpoint followed by execution of the actual instruction. Modifying this allows clients to create conditional breakpoints or simply override or inject additional logic into an emulated target.

    NOTE: This currently has no effect on access breakpoints, but only execution breakpoints.

    If the specified source fails to compile during emulator set-up, this will fall back to `DefaultPcodeThread.PcodeEmulationLibrary.emu_swi()`

    Specified by:
      `setEmuSleigh` in interface `TraceBreakpointLocation`
    Parameters:
      `snap` - the snap
      `sleigh` - the Sleigh source
    See Also:
      - `SleighUtils.UNCONDITIONAL_BREAK`

  - ### getEmuSleigh

    public String getEmuSleigh(long snap)
    Description copied from interface: `TraceBreakpointLocation`
    Get the Sleigh source that replaces the breakpointed instruction in emulation
    Specified by:
      `getEmuSleigh` in interface `TraceBreakpointLocation`
    Parameters:
      `snap` - the snap
    Returns:
      the Sleigh source

  - ### delete

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

  - ### remove

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

  - ### isValid

    public boolean isValid(long snap)
    Description copied from interface: `TraceBreakpointCommon`
    Check if the breakpoint is present at the given snapshot

    In object mode, a breakpoint'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 breakpoint 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 `TraceBreakpointCommon`
    Parameters:
      `snap` - the snapshot key
    Returns:
      true if valid, false if not

  - ### isAlive

    public boolean isAlive(Lifespan span)
    Description copied from interface: `TraceBreakpointCommon`
    Check if the breakpoint is present for any of the given span
    Specified by:
      `isAlive` in interface `TraceBreakpointCommon`
    Parameters:
      `span` - the span
    Returns:
      true if its life intersects the span

  - ### getObject

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

  - ### getOrCreateSpecification

    public TraceBreakpointSpec getOrCreateSpecification()

  - ### getSpecification

    public TraceBreakpointSpec getSpecification()
    Description copied from interface: `TraceBreakpointLocation`
    Get the specification that caused this location to exist
    Specified by:
      `getSpecification` in interface `TraceBreakpointLocation`
    Returns:
      the specification

  - ### getAddressSpace

    public AddressSpace getAddressSpace(long snap)

  - ### 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`