Package ghidra.program.model.listing
Class CodeUnitFormat
java.lang.Object
ghidra.program.model.listing.CodeUnitFormat
- Direct Known Subclasses:
BrowserCodeUnitFormat
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic CodeUnitFormatDefault code unit formatstatic Stringstatic Stringprotected CodeUnitFormatOptionsprotected static final Stringprotected static final String -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedDefault constructor using default format optionsCodeUnitFormat(CodeUnitFormatOptions options) Format constructor with more options.CodeUnitFormat(CodeUnitFormatOptions.ShowBlockName showBlockName, CodeUnitFormatOptions.ShowNamespace showNamespace) Format constructor. -
Method Summary
Modifier and TypeMethodDescriptionprotected StringaddOffcutInformation(String prefix, String addressString, int diff, boolean decorate) Returns a formatted data value for the specified data unit.Returns a formatted data value for the specified data unit.protected StringgetDefaultOffcutString(Symbol symbol, CodeUnit cu, long diff, boolean decorate) Returns a formatted code unit mnemonicprotected StringgetOffcutDataString(Address offcutAddress, Data data) getOffcutLabelString(Address offcutAddress, CodeUnit cu, Address markupAddress) protected StringgetOffcutLabelStringForInstruction(Address offcutAddress, Instruction instruction, Address markupAddress) Generate label string.getOperandRepresentationList(CodeUnit cu, int opIndex) Returns a formatted list of operand objects for the specified code unit operand.getOperandRepresentationString(CodeUnit cu, int opIndex) Returns a formatted string representation of the specified code unit operand.protected StringgetPrefixForStringData(Data data, Address dataAddress, int diff, DataType dt) getReferenceRepresentationString(CodeUnit fromCodeUnit, Reference ref) Returns a marked-up representation of the reference destination.Returns a formatted string representation of the specified code unit, including mnemonic and operand(s) only.getRepresentationString(CodeUnit cu, boolean includeEOLcomment) Returns a formatted string representation of the specified code unit mnemonic and operand(s).Returns ShowBlockName setting
-
Field Details
-
PLUS
- See Also:
-
UNDERSCORE
- See Also:
-
EXTENDED_REFERENCE_DELIMITER
-
EXTENDED_INDIRECT_REFERENCE_DELIMITER
-
DEFAULT
Default code unit format -
options
-
-
Constructor Details
-
CodeUnitFormat
protected CodeUnitFormat()Default constructor using default format options -
CodeUnitFormat
public CodeUnitFormat(CodeUnitFormatOptions.ShowBlockName showBlockName, CodeUnitFormatOptions.ShowNamespace showNamespace) Format constructor.- Parameters:
showBlockName- whether or not to display block name; {SHOW_BLOCKNAME_ALWAYS, SHOW_BLOCKNAME_NEVER, SHOW_SEGMENT_NON_LOCAL}showNamespace- if true display labels with their name-space path.
-
CodeUnitFormat
Format constructor with more options. Extended reference mark-up is enabled.- Parameters:
options- format options
-
-
Method Details
-
getRepresentationString
Returns a formatted string representation of the specified code unit, including mnemonic and operand(s) only.- Parameters:
cu- code unit- Returns:
- formatted code unit representation
-
getRepresentationString
Returns a formatted string representation of the specified code unit mnemonic and operand(s).- Parameters:
cu- code unitincludeEOLcomment- if true EOL comment will be appended to code unit representation- Returns:
- formatted code unit representation
-
getMnemonicRepresentation
Returns a formatted code unit mnemonic- Parameters:
cu- code unit- Returns:
- mnemonic representation
-
getOperandRepresentationString
Returns a formatted string representation of the specified code unit operand.- Parameters:
cu- code unitopIndex-- Returns:
- formatted code unit representation
-
getOperandRepresentationList
Returns a formatted list of operand objects for the specified code unit operand. In the case of Data opIndex=1, this will be a list containing a single String object (see getDataValueRepresentation(Data)). In the case of an Instruction, the list will contain a list of Objects, including any combination of Character, String, VariableOffset, Register, Address, Scalar, List, LabelString etc.. All objects returned must support the toString() method.- Parameters:
cu- code unitopIndex- operand index- Returns:
- list of representation objects or null for an unsupported language.
-
getDataValueRepresentation
Returns a formatted data value for the specified data unit. The return list will contain a single object which may be an instance of String, LabelString, Address, Scalar or Equate- Parameters:
data- data unit- Returns:
- representation list containing a single object.
-
getDataValueRepresentationString
Returns a formatted data value for the specified data unit.- Parameters:
data- data unit- Returns:
- data value string
-
getReferenceRepresentationString
Returns a marked-up representation of the reference destination.- Parameters:
fromCodeUnit-ref-- Returns:
- destination as a string or null if a suitable string could not be produced.
-
getOffcutLabelString
-
getOffcutDataString
-
getOffcutLabelStringForInstruction
protected String getOffcutLabelStringForInstruction(Address offcutAddress, Instruction instruction, Address markupAddress) Generate label string. This may serve two use cases:- Generating operand label at markupAddress for referenced instruction and offcutAddress
- Generating offcut label for an offcutAddress with instruction (markupAddress=null)
- Parameters:
offcutAddress- address for which generated label representsinstruction- instruction containing offcut addressmarkupAddress- address where a label will be referenced from (may be null)- Returns:
- generated offcut label
-
addOffcutInformation
-
getPrefixForStringData
-
getDefaultOffcutString
-
getShowBlockName
Returns ShowBlockName setting
-