Package ghidra.app.cmd.data
Class CreateDataCmd
- java.lang.Object
-
- ghidra.app.cmd.data.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.
-
-
Constructor Summary
Constructors Constructor Description CreateDataCmd(Address addr, boolean force, boolean stackPointers, DataType dataType)
This is the same asCreateDataCmd(Address, boolean, DataType)
except that it allows the caller to control whether or not pointer conversion should be handled.CreateDataCmd(Address addr, boolean force, DataType dataType)
Constructs a command for creating data at an address.CreateDataCmd(Address addr, DataType dataType)
Constructs a command for creating data at an address.CreateDataCmd(Address addr, DataType dataType, boolean isCycle, boolean stackPointers)
This is the same asCreateDataCmd(Address, DataType)
except that it allows the caller to control whether or not pointer conversion should be handled.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.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
applyTo(DomainObject obj)
Applies the command to the given domain object.java.lang.String
getName()
Returns the name of this command.java.lang.String
getStatusMsg()
Returns the status message indicating the status of the command.
-
-
-
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. 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 cleareddataType
- the datatype to be applied at the given address.
-
CreateDataCmd
public CreateDataCmd(Address addr, boolean force, boolean stackPointers, DataType dataType)
This is the same asCreateDataCmd(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 clearedstackPointers
- if true simple pointer conversion is enabled (seeDataUtilities.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 asCreateDataCmd(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 (seeDataUtilities.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 (seeDataUtilities.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.
-
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 interfaceCommand
- Returns:
- reason for failure, or null if the status of the command was successful
-
-