Package ghidra.trace.model.time.schedule

# Class PatchStep

java.lang.Object
ghidra.trace.model.time.schedule.PatchStep

All Implemented Interfaces:
  `Step`, `Comparable<Step>`

public class PatchStep extends Object implements Step

- ## Nested Class Summary

  ## Nested classes/interfaces inherited from interface ghidra.trace.model.time.schedule.Step

  `Step.StepType`

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `protected int`
  `hashCode`
  `protected String`
  `sleigh`
  `protected final long`
  `threadKey`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `PatchStep(long threadKey, String sleigh)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `addTo(Step step)`
  `Step`
  `clone()`
  `long`
  `coalescePatches(Language language, List<Step> steps)`
  `CompareResult`
  `compareStep(Step step)`
  Richly compare this step to another
  `boolean`
  `equals(Object obj)`
  `void`
  `execute(PcodeThread<?> emuThread, Stepper stepper, TaskMonitor monitor)`
  `protected static void`
  `generateMemorySleigh(List<String> result, Language language, AddressSpace space, SemisparseByteArray array)`
  `protected static void`
  `generateRegisterSleigh(List<String> result, Language language, AddressSpace space, SemisparseByteArray array)`
  `static List<String>`
  `generateSleigh(Language language, Address address, byte[] data)`
  Generate multiple lines of Sleigh, all to set a single variable
  `protected static List<String>`
  `generateSleigh(Language language, Map<AddressSpace,SemisparseByteArray> patches)`
  `protected static void`
  `generateSleigh(List<String> result, Language language, Address address, byte[] data)`
  `protected static void`
  `generateSleigh(List<String> result, Language language, AddressSpace space, SemisparseByteArray array)`
  `static String`
  `generateSleighLine(Language language, Address address, byte[] data)`
  Generate a single line of Sleigh
  `static String`
  `generateSleighLine(Language language, Address address, byte[] data, int length)`
  Generate a single line of Sleigh
  `protected boolean`
  `getPatchBranchOp(Language language, Map<AddressSpace,SemisparseByteArray> result, PcodeOp op)`
  `protected boolean`
  `getPatchCopyOp(Language language, Map<AddressSpace,SemisparseByteArray> result, PcodeOp op)`
  `long`
  `getPatchCount()`
  `protected Map<AddressSpace,SemisparseByteArray>`
  `getPatches(Language language)`
  `protected boolean`
  `getPatchStoreOp(Language language, Map<AddressSpace,SemisparseByteArray> result, PcodeOp op)`
  `long`
  `getSkipCount()`
  `long`
  `getThreadKey()`
  `long`
  `getTickCount()`
  `Step.StepType`
  `getType()`
  `int`
  `hashCode()`
  `boolean`
  `isCompatible(Step step)`
  Check if the given step can be combined with this one
  `protected static boolean`
  `isContained(Register r, ULongSpan.ULongSpanSet remains)`
  `boolean`
  `isNop()`
  `protected void`
  `mergePatches(Map<AddressSpace,SemisparseByteArray> into, Map<AddressSpace,SemisparseByteArray> from)`
  `static PatchStep`
  `parse(long threadKey, String stepSpec)`
  `long`
  `rewind(long count)`
  Subtract from the count of this step
  `protected static ULongSpan`
  `spanOfRegister(Register r)`
  `Step`
  `subtract(Step step)`
  `String`
  `toString()`
  `String`
  `toString(TraceSchedule.TimeRadix radix)`

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

  `finalize, getClass, notify, notifyAll, wait, wait, wait`

  ### Methods inherited from interface ghidra.trace.model.time.schedule.Step

  `compareStepType, compareTo, execute, getThread, getTypeOrder, isEventThread`

- ## Field Details

  - ### threadKey

    protected final long threadKey

  - ### sleigh

    protected String sleigh

  - ### hashCode

    protected int hashCode

- ## Constructor Details

  - ### PatchStep

    public PatchStep(long threadKey, String sleigh)

- ## Method Details

  - ### generateSleighLine

    public static String generateSleighLine(Language language, Address address, byte[] data, int length)
    Generate a single line of Sleigh

    Note that when length is greater than 8, this will generate constants which are too large for the Java implementation of Sleigh. Use `generateSleigh(Language, Address, byte[])` instead to write the variable in chunks.

    Parameters:
      `language` - the target language
      `address` - the (start) address of the variable
      `data` - the bytes to write to the variable
      `length` - the length of the variable
    Returns:
      the Sleigh code

  - ### generateSleighLine

    public static String generateSleighLine(Language language, Address address, byte[] data)
    Generate a single line of Sleigh
    Parameters:
      `language` - the target language
      `address` - the (start) address of the variable
      `data` - the bytes to write to the variable
    Returns:
      the Sleigh code
    See Also:
      - `generateSleighLine(Language, Address, byte[], int)`

  - ### generateSleigh

    public static List<String> generateSleigh(Language language, Address address, byte[] data)
    Generate multiple lines of Sleigh, all to set a single variable
    Parameters:
      `language` - the target language
      `address` - the (start) address of the variable
      `data` - the bytes to write to the variable
    Returns:
      the lines of Sleigh code

  - ### generateSleigh

    protected static void generateSleigh(List<String> result, Language language, Address address, byte[] data)

  - ### generateSleigh

    protected static List<String> generateSleigh(Language language, Map<AddressSpace,SemisparseByteArray> patches)

  - ### generateSleigh

    protected static void generateSleigh(List<String> result, Language language, AddressSpace space, SemisparseByteArray array)

  - ### generateMemorySleigh

    protected static void generateMemorySleigh(List<String> result, Language language, AddressSpace space, SemisparseByteArray array)

  - ### spanOfRegister

    protected static ULongSpan spanOfRegister(Register r)

  - ### isContained

    protected static boolean isContained(Register r, ULongSpan.ULongSpanSet remains)

  - ### generateRegisterSleigh

    protected static void generateRegisterSleigh(List<String> result, Language language, AddressSpace space, SemisparseByteArray array)

  - ### parse

    public static PatchStep parse(long threadKey, String stepSpec)

  - ### hashCode

    public int hashCode()
    Overrides:
      `hashCode` in class `Object`

  - ### equals

    public boolean equals(Object obj)
    Overrides:
      `equals` in class `Object`

  - ### toString

    public String toString()
    Overrides:
      `toString` in class `Object`

  - ### toString

    public String toString(TraceSchedule.TimeRadix radix)
    Specified by:
      `toString` in interface `Step`

  - ### getType

    public Step.StepType getType()
    Specified by:
      `getType` in interface `Step`

  - ### getSkipCount

    public long getSkipCount()
    Specified by:
      `getSkipCount` in interface `Step`

  - ### isNop

    public boolean isNop()
    Specified by:
      `isNop` in interface `Step`

  - ### getThreadKey

    public long getThreadKey()
    Specified by:
      `getThreadKey` in interface `Step`

  - ### getTickCount

    public long getTickCount()
    Specified by:
      `getTickCount` in interface `Step`

  - ### getPatchCount

    public long getPatchCount()
    Specified by:
      `getPatchCount` in interface `Step`

  - ### isCompatible

    public boolean isCompatible(Step step)
    Description copied from interface: `Step`
    Check if the given step can be combined with this one

    Two steps applied to the same thread can just be summed. If the given step applies to the "last thread" or to the same thread as this step, then it can be combined.

    Specified by:
      `isCompatible` in interface `Step`
    Parameters:
      `step` - the second step
    Returns:
      true if combinable, false otherwise.

  - ### addTo

    public void addTo(Step step)
    Specified by:
      `addTo` in interface `Step`

  - ### subtract

    public Step subtract(Step step)
    Specified by:
      `subtract` in interface `Step`

  - ### clone

    public Step clone()
    Specified by:
      `clone` in interface `Step`
    Overrides:
      `clone` in class `Object`

  - ### rewind

    public long rewind(long count)
    Description copied from interface: `Step`
    Subtract from the count of this step

    If this step has a count exceeding that given, then this method simply subtracts the given number from the `tickCount` and returns the (negative) difference. If this step has exactly the count given, this method sets the count to 0 and returns 0, indicating this step should be removed from the sequence. If the given count exceeds that of this step, this method sets the count to 0 and returns the (positive) difference, indicating this step should be removed from the sequence, and the remaining steps rewound from the preceding step.

    Specified by:
      `rewind` in interface `Step`
    Parameters:
      `count` - the count to rewind
    Returns:
      the number of steps remaining

  - ### compareStep

    public CompareResult compareStep(Step step)
    Description copied from interface: `Step`
    Richly compare this step to another
    Specified by:
      `compareStep` in interface `Step`
    Parameters:
      `step` - the object of comparison (this being the subject)
    Returns:
      a result describing the relationship from subject to object

  - ### execute

    public void execute(PcodeThread<?> emuThread, Stepper stepper, TaskMonitor monitor) throws CancelledException
    Specified by:
      `execute` in interface `Step`
    Throws:
      `CancelledException`

  - ### coalescePatches

    public long coalescePatches(Language language, List<Step> steps)
    Specified by:
      `coalescePatches` in interface `Step`

  - ### mergePatches

    protected void mergePatches(Map<AddressSpace,SemisparseByteArray> into, Map<AddressSpace,SemisparseByteArray> from)

  - ### getPatches

    protected Map<AddressSpace,SemisparseByteArray> getPatches(Language language)

  - ### getPatchCopyOp

    protected boolean getPatchCopyOp(Language language, Map<AddressSpace,SemisparseByteArray> result, PcodeOp op)

  - ### getPatchStoreOp

    protected boolean getPatchStoreOp(Language language, Map<AddressSpace,SemisparseByteArray> result, PcodeOp op)

  - ### getPatchBranchOp

    protected boolean getPatchBranchOp(Language language, Map<AddressSpace,SemisparseByteArray> result, PcodeOp op)