Package ghidra.trace.database.listing

# Class DBTraceInstructionsView.InstructionBlockAdder

java.lang.Object
ghidra.trace.database.listing.DBTraceInstructionsView.InstructionBlockAdder

Enclosing class:
  `DBTraceInstructionsView`

protected class DBTraceInstructionsView.InstructionBlockAdder extends Object
A mechanism for adding a block of instructions

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `protected int`
  `count`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `protected Instruction`
  `doAddInstructions()`
  Add the instructions and return the last one added
  `protected Instruction`
  `doAddInstructions(Iterator<Instruction> it, boolean areDelaySlots)`
  Adds the instructions and returns the last instruction added
  `protected Instruction`
  `doAdjustExisting(Address address, Instruction protoInstr)`
  `protected Instruction`
  `doCreateInstruction(Address address, Instruction protoInstr)`
  Store the given instruction in the database
  `protected Instruction`
  `doExtendPreceding(Address address, Instruction protoInstr)`
  Check the preceding unit and see if it can be extended to "create" the desired one
  `protected boolean`
  `isSuitable(Instruction candidate, Instruction protoInstr)`
  `protected void`
  `truncateOrDelete(TraceInstruction exists)`

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

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

- ## Field Details

  - ### count

    protected int count

- ## Method Details

  - ### truncateOrDelete

    protected void truncateOrDelete(TraceInstruction exists)

  - ### isSuitable

    protected boolean isSuitable(Instruction candidate, Instruction protoInstr)

  - ### doAdjustExisting

    protected Instruction doAdjustExisting(Address address, Instruction protoInstr) throws AddressOverflowException, CancelledException, CodeUnitInsertionException
    Throws:
      `AddressOverflowException`
      `CancelledException`
      `CodeUnitInsertionException`

  - ### doExtendPreceding

    protected Instruction doExtendPreceding(Address address, Instruction protoInstr) throws AddressOverflowException, CodeUnitInsertionException
    Check the preceding unit and see if it can be extended to "create" the desired one

    For overwrite, the caller should first use * `doAdjustExisting(Address, Instruction)`.

    Parameters:
      `address` - the starting address of the instruction
      `protoInstr` - the prototype instruction
    Returns:
      the extended instruction, if it was a match
    Throws:
      `AddressOverflowException` - should never
      `CodeUnitInsertionException` - if there's no room to extend the preceding unit

  - ### doCreateInstruction

    protected Instruction doCreateInstruction(Address address, Instruction protoInstr)
    Store the given instruction in the database
    Parameters:
      `address` - the address of the instruction
      `protoInstr` - the parsed (usually pseudo) instruction
    Returns:
      the created instruction

  - ### doAddInstructions

    protected Instruction doAddInstructions(Iterator<Instruction> it, boolean areDelaySlots)
    Adds the instructions and returns the last instruction added

    If it encounters a delay-slotted instruction, it will recurse on the group, iterating in reverse order.

    Parameters:
      `it` - the iterator of instructions to add
      `areDelaySlots` - true if the instructions are already reversed from being delay-slotted
    Returns:
      the last instruction added

  - ### doAddInstructions

    protected Instruction doAddInstructions()
    Add the instructions and return the last one added
    Returns:
      the last instruction added