Class CreateDataCmd

java.lang.Object
ghidra.app.cmd.data.CreateDataCmd
All Implemented Interfaces:
Command<Program>

public class CreateDataCmd extends Object implements Command<Program>
This command will create a data of type dataType at the given address. This command will only work for fixed length dataTypes. If there are any existing instructions in the area to be made into data, the command will fail. Existing data in the area may be replaced with the new dataType (with optional pointer conversion). If the existing dataType is a pointer, then the existing data will be changed into a pointer to the given dataType. If the given dataType is a default-pointer, it will become a pointer to the existing type.
See Also:
  • Constructor Details

    • CreateDataCmd

      public CreateDataCmd(Address addr, boolean force, DataType dataType)
      Constructs a command for creating data at an address. Simple pointer conversion will NOT be performed. Existing Undefined data will always be cleared even when force is false.
      Parameters:
      addr - the address at which to apply the datatype. Offcut data address allowed, provided force==true.
      force - if true any existing conflicting data will be cleared
      dataType - the datatype to be applied at the given address.
    • CreateDataCmd

      public CreateDataCmd(Address addr, boolean force, boolean stackPointers, DataType dataType)
      This is the same as CreateDataCmd(Address, boolean, DataType) except that it allows the caller to control whether or not pointer conversion should be handled.
      Parameters:
      addr - the address at which to apply the datatype. Offcut data address allowed, provided force==true.
      force - if true any existing conflicting data will be cleared
      stackPointers - if true simple pointer conversion is enabled (see DataUtilities.reconcileAppliedDataType(DataType, DataType, boolean)).
      dataType - the datatype to be applied at the given address.
    • CreateDataCmd

      public CreateDataCmd(Address addr, DataType dataType)
      Constructs a command for creating data at an address. Simple pointer conversion will NOT be performed and existing defined data will not be cleared, however existing Undefined data will be cleared.
      Parameters:
      addr - the address at which to apply the datatype.
      dataType - the datatype to be applied at the given address.
    • CreateDataCmd

      public CreateDataCmd(Address addr, DataType dataType, boolean isCycle, boolean stackPointers)
      This is the same as CreateDataCmd(Address, DataType) except that it allows the caller to control whether or not pointer conversion should be handled. Existing Undefined data will always be cleared.
      Parameters:
      addr - the address at which to apply the datatype.
      dataType - the datatype to be applied at the given address.
      isCycle - true indicates this is from a cycle group action.
      stackPointers - if true simple pointer conversion is enabled (see DataUtilities.reconcileAppliedDataType(DataType, DataType, boolean)).
    • CreateDataCmd

      public CreateDataCmd(Address addr, DataType dataType, boolean stackPointers, DataUtilities.ClearDataMode clearMode)
      This constructor provides the most flexibility when creating data, allowing optional pointer conversion and various clearing options for conflicting data.
      Parameters:
      addr - the address at which to apply the datatype.
      dataType - the datatype to be applied at the given address.
      stackPointers - if true simple pointer conversion is enabled (see DataUtilities.reconcileAppliedDataType(DataType, DataType, boolean)).
      clearMode - indicates how conflicting data should be cleared
  • Method Details

    • applyTo

      public boolean applyTo(Program program)
      Description copied from interface: Command
      Applies the command to the given domain object.
      Specified by:
      applyTo in interface Command<Program>
      Parameters:
      program - domain object that this command is to be applied.
      Returns:
      true if the command applied successfully
    • 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<Program>
      Returns:
      reason for failure, or null if the status of the command was successful
    • getName

      public String getName()
      Description copied from interface: Command
      Returns the name of this command.
      Specified by:
      getName in interface Command<Program>
      Returns:
      the name of this command