Package ghidra.program.model.lang

# Class ProgramProcessorContext

java.lang.Object
ghidra.program.model.lang.ProgramProcessorContext

All Implemented Interfaces:
  `ProcessorContext`, `ProcessorContextView`

public class ProgramProcessorContext extends Object implements ProcessorContext
Implementation for the program processor context interface

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `ProgramProcessorContext(ProgramContext context, Address addr)`
  Constructs a new ProgramProcessorContext that will have the processor state be the state of the given programContext at the given address

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `clearRegister(Register register)`
  Clears the register within this context.
  `Register`
  `getBaseContextRegister()`
  `Register`
  `getRegister(String name)`
  Get a Register given the name of a register
  `List<Register>`
  `getRegisters()`
  Returns all the Registers for the processor as an unmodifiable list
  `RegisterValue`
  `getRegisterValue(Register register)`
  Get the RegisterValue for the given register.
  `BigInteger`
  `getValue(Register register, boolean signed)`
  Get the contents of a processor register as a BigInteger object
  `boolean`
  `hasValue(Register register)`
  Returns true if a value is defined for the given register.
  `void`
  `setRegisterValue(RegisterValue value)`
  Sets the specified register value within this context.
  `void`
  `setValue(Register register, BigInteger value)`
  Sets the value for a Register.

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

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

- ## Constructor Details

  - ### ProgramProcessorContext

    public ProgramProcessorContext(ProgramContext context, Address addr)
    Constructs a new ProgramProcessorContext that will have the processor state be the state of the given programContext at the given address
    Parameters:
      `context` - the programContext which contains the register state at every address
      `addr` - the address at which to get the register state

- ## Method Details

  - ### getBaseContextRegister

    public Register getBaseContextRegister()
    Specified by:
      `getBaseContextRegister` in interface `ProcessorContextView`
    Returns:
      the base processor context register or null if one has not been defined

  - ### getRegisters

    public List<Register> getRegisters()
    Description copied from interface: `ProcessorContextView`
    Returns all the Registers for the processor as an unmodifiable list
    Specified by:
      `getRegisters` in interface `ProcessorContextView`
    Returns:
      all the Registers for the processor

  - ### getRegister

    public Register getRegister(String name)
    Description copied from interface: `ProcessorContextView`
    Get a Register given the name of a register
    Specified by:
      `getRegister` in interface `ProcessorContextView`
    Parameters:
      `name` - the name of the register.
    Returns:
      The register with the given name.

  - ### getValue

    public BigInteger getValue(Register register, boolean signed)
    Description copied from interface: `ProcessorContextView`
    Get the contents of a processor register as a BigInteger object
    Specified by:
      `getValue` in interface `ProcessorContextView`
    Parameters:
      `register` - register to get the value for
    Returns:
      a BigInteger object containing the value of the register if a value exists, otherwise null.

  - ### getRegisterValue

    public RegisterValue getRegisterValue(Register register)
    Description copied from interface: `ProcessorContextView`
    Get the RegisterValue for the given register.
    Specified by:
      `getRegisterValue` in interface `ProcessorContextView`
    Parameters:
      `register` - register to get the value for
    Returns:
      RegisterValue object containing the value of the register if a value exists, otherwise null.

  - ### setValue

    public void setValue(Register register, BigInteger value) throws ContextChangeException
    Description copied from interface: `ProcessorContext`
    Sets the value for a Register.
    Specified by:
      `setValue` in interface `ProcessorContext`
    Parameters:
      `register` - the register to have its value set
      `value` - the value for the register (null is not permitted).
    Throws:
      `ContextChangeException` - an illegal attempt to change context was made

  - ### setRegisterValue

    public void setRegisterValue(RegisterValue value) throws ContextChangeException
    Description copied from interface: `ProcessorContext`
    Sets the specified register value within this context.
    Specified by:
      `setRegisterValue` in interface `ProcessorContext`
    Parameters:
      `value` - register value
    Throws:
      `ContextChangeException` - an illegal attempt to change context was made

  - ### clearRegister

    public void clearRegister(Register register) throws ContextChangeException
    Description copied from interface: `ProcessorContext`
    Clears the register within this context.
    Specified by:
      `clearRegister` in interface `ProcessorContext`
    Parameters:
      `register` - register to be cleared.
    Throws:
      `ContextChangeException` - an illegal attempt to change context was made

  - ### hasValue

    public boolean hasValue(Register register)
    Description copied from interface: `ProcessorContextView`
    Returns true if a value is defined for the given register.
    Specified by:
      `hasValue` in interface `ProcessorContextView`
    Parameters:
      `register` - the register to check for a value.
    Returns:
      true if the given register has a value.
    See Also:
      - `ProcessorContextView.hasValue(ghidra.program.model.lang.Register)`