Package ghidra.app.cmd.refs

# Class AddOffsetMemRefCmd

java.lang.Object
ghidra.app.cmd.refs.AddOffsetMemRefCmd

All Implemented Interfaces:
  `Command`

public class AddOffsetMemRefCmd extends Object implements Command
Command class to add an offset memory reference to the program.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `AddOffsetMemRefCmd(Address fromAddr, Address toAddr, boolean toAddrIsBase, RefType refType, SourceType source, int opIndex, long offset)`
  Command constructor for adding an offset memory reference.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `boolean`
  `applyTo(DomainObject obj)`
  Applies the command to the given domain object.
  `String`
  `getName()`
  Returns the name of this command.
  `String`
  `getStatusMsg()`
  Returns the status message indicating the status of the command.

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

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

- ## Constructor Details

  - ### AddOffsetMemRefCmd

    public AddOffsetMemRefCmd(Address fromAddr, Address toAddr, boolean toAddrIsBase, RefType refType, SourceType source, int opIndex, long offset)
    Command constructor for adding an offset memory reference. The first memory reference placed on an operand will be made primary by default. All non-memory references will be removed from the specified operand. If toAddr corresponds to the EXTERNAL memory block (see `MemoryBlock.EXTERNAL_BLOCK_NAME`) the resulting offset reference will report to/base address as the same regardless of specified offset.
    Parameters:
      `fromAddr` - address of the codeunit where the reference occurs
      `toAddr` - address of the location being referenced.
      `toAddrIsBase` - if true toAddr is treated as base address, else treated as (base+offet). It is generally preferred to specify as a base address to ensure proper handling of EXTERNAL block case.
      `refType` - reference type - how the location is being referenced.
      `source` - the source of the reference
      `opIndex` - the operand index in the code unit where the reference occurs
      `offset` - value added to a base address to get the toAddr

- ## Method Details

  - ### applyTo

    public boolean applyTo(DomainObject obj)
    Description copied from interface: `Command`
    Applies the command to the given domain object.
    Specified by:
      `applyTo` in interface `Command`
    Parameters:
      `obj` - domain object that this command is to be applied.
    Returns:
      true if the command applied successfully
    See Also:
      - `Command.applyTo(ghidra.framework.model.DomainObject)`

  - ### getStatusMsg

    public String getStatusMsg()
    Description copied from interface: `Command`
    Returns the status message indicating the status of the command.
    Specified by:
      `getStatusMsg` in interface `Command`
    Returns:
      reason for failure, or null if the status of the command was successful
    See Also:
      - `Command.getStatusMsg()`

  - ### getName

    public String getName()
    Description copied from interface: `Command`
    Returns the name of this command.
    Specified by:
      `getName` in interface `Command`
    Returns:
      the name of this command
    See Also:
      - `Command.getName()`