Class PCodeTestAbstractControlBlock

java.lang.Object
ghidra.test.processors.support.PCodeTestAbstractControlBlock
Direct Known Subclasses:
PCodeTestControlBlock, PCodeTestGroupControlBlock

public abstract class PCodeTestAbstractControlBlock extends Object
PCodeTestAbstractControlBlock data is models the general capabilities of the TestInfo data structure which is used for different puposes as handled by extensions of this class.
  • Field Details

    • program

      protected final Program program
    • codeSpace

      protected final AddressSpace codeSpace
    • dataSpace

      protected final AddressSpace dataSpace
    • pointerSize

      protected final int pointerSize
    • infoStructAddr

      protected final Address infoStructAddr
    • infoProgramStruct

      protected final Structure infoProgramStruct
  • Method Details

    • getInfoStructureAddress

      public Address getInfoStructureAddress()
    • getFunctionInfo

      public PCodeTestAbstractControlBlock.FunctionInfo getFunctionInfo(String functionName)
    • getFunctionInfo

      public PCodeTestAbstractControlBlock.FunctionInfo getFunctionInfo(int functionIndex)
    • getNumberFunctions

      public int getNumberFunctions()
    • readDefinedDataPointer

      protected Address readDefinedDataPointer(Address addr)
      Check for a Data pointer at the specified address and return the referenced address.
      Parameters:
      addr - address of stored pointer
      Returns:
      pointer referenced address or null if no pointer found
    • readCodePointer

      protected Address readCodePointer(MemBuffer buffer, int bufferOffset, boolean updateReference) throws MemoryAccessException
      Throws:
      MemoryAccessException
    • readDataPointer

      protected Address readDataPointer(MemBuffer buffer, int bufferOffset, boolean updateReference)
    • readPointer

      protected Address readPointer(int controlBlockOffset) throws MemoryAccessException
      Throws:
      MemoryAccessException
    • applyU4Data

      protected void applyU4Data(Address addr)
    • getStructureComponent

      protected int getStructureComponent(Structure testInfoStruct, String fieldName)
    • readControlBlock

      protected void readControlBlock(boolean applyStruct) throws ghidra.test.processors.support.PCodeTestAbstractControlBlock.InvalidControlBlockException, CodeUnitInsertionException
      Throws:
      ghidra.test.processors.support.PCodeTestAbstractControlBlock.InvalidControlBlockException
      CodeUnitInsertionException
    • emuReadString

      protected String emuReadString(PcodeThread<byte[]> emu, Address strPtrAddr)
      Read an ASCII-encoded string, perhaps with wide characters, from the emulator.

      This is really a hack, but suffices for these tests. The character size is taken from the program's data organization. However, even if wide characters are used, this only reads the least-significant byte, effectively truncating each to the ASCII-2 range [0-255].

      Parameters:
      emu - the emulator
      strPtrAddr - the pointer to the string
      Returns:
      the string
    • emuRead

      protected long emuRead(PcodeThread<byte[]> emu, Address addr, int size)
    • emuWrite

      protected void emuWrite(PcodeThread<byte[]> emu, Address addr, int size, long value)
    • getMirroredDataAddress

      protected Address getMirroredDataAddress(EmulatorTestRunner emuTestRunner, Address addr)