Class CreateDataCmd

  • All Implemented Interfaces:
    Command

    public class CreateDataCmd
    extends java.lang.Object
    implements Command
    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:
    DataUtilities#createData(Program, Address, DataType, boolean, ghidra.program.model.data.DataUtilities.ClearDataMode)
    • Constructor Detail

      • 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.
        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 data will not 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.
        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 Detail

      • 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
      • getStatusMsg

        public java.lang.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
      • getName

        public java.lang.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