Class PcodeOpCounter

java.lang.Object
ghidra.pcode.emu.util.PcodeOpCounter
All Implemented Interfaces:
CountsPcodeOps

public class PcodeOpCounter extends Object implements CountsPcodeOps
The most basic implementation of CountsPcodeOps
  • Constructor Details

    • PcodeOpCounter

      public PcodeOpCounter()
  • Method Details

    • countOp

      public void countOp(boolean startsInstruction)
      Count one additional op
      Parameters:
      startsInstruction - true if this op is the beginning of a new instruction
    • count

      public void count(int instructions, int trailingOps)
      Count some number of additional instructions and ops

      If there are no new instructions, then the trailing ops are added to those already counted. If there is 1 or more new instructions, those are added to those already counted, but trailing ops is reset to only count those given.

      Parameters:
      instructions - the number of instructions
      trailingOps - the number of trailing ops
    • count

      public void count(CountsPcodeOps counter)
      Count some number of additional instructions and ops

      This works as in count(int, int) but the counts are taken from another counter

      Parameters:
      counter - the other counter
    • instructionCount

      public int instructionCount()
      Description copied from interface: CountsPcodeOps
      Returns the number of instructions counted.
      Specified by:
      instructionCount in interface CountsPcodeOps
      Returns:
      the number of instructions counted
    • trailingOpCount

      public int trailingOpCount()
      Description copied from interface: CountsPcodeOps
      Returns the number of trailing p-code ops counted.

      This represents partial execution of an instruction. Though CountsPcodeOps.instructionCount() does count the partial instruction, this indicates how much of that instruction was counted. This should provide enough information to replay an execution to exactly the same p-code op step.

      Specified by:
      trailingOpCount in interface CountsPcodeOps
      Returns:
      the number of trailing p-code ops counted