Package ghidra.program.model.listing
Class CodeUnitFormat
- java.lang.Object
- 
- ghidra.program.model.listing.CodeUnitFormat
 
- 
- Direct Known Subclasses:
- BrowserCodeUnitFormat
 
 public class CodeUnitFormat extends java.lang.Object
- 
- 
Field SummaryFields Modifier and Type Field Description static CodeUnitFormatDEFAULTDefault code unit formatstatic java.lang.StringEXTENDED_INDIRECT_REFERENCE_DELIMITERstatic java.lang.StringEXTENDED_REFERENCE_DELIMITERprotected CodeUnitFormatOptionsoptionsprotected static java.lang.StringPLUSprotected static java.lang.StringUNDERSCORE
 - 
Constructor SummaryConstructors Modifier Constructor Description protectedCodeUnitFormat()Default constructor using default format optionsCodeUnitFormat(CodeUnitFormatOptions options)Format constructor with more options.CodeUnitFormat(CodeUnitFormatOptions.ShowBlockName showBlockName, CodeUnitFormatOptions.ShowNamespace showNamespace)Format constructor.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.lang.StringaddOffcutInformation(java.lang.String prefix, java.lang.String addressString, int diff, boolean decorate)OperandRepresentationListgetDataValueRepresentation(Data data)Returns a formatted data value for the specified data unit.java.lang.StringgetDataValueRepresentationString(Data data)Returns a formatted data value for the specified data unit.protected java.lang.StringgetDefaultOffcutString(Symbol symbol, CodeUnit cu, long diff, boolean decorate)java.lang.StringgetMnemonicRepresentation(CodeUnit cu)Returns a formatted code unit mnemonicprotected java.lang.StringgetOffcutDataString(Address offcutAddress, Data data)java.lang.StringgetOffcutLabelString(Address offcutAddress, CodeUnit cu)protected java.lang.StringgetOffcutLabelStringForInstruction(Address offcutAddress, Instruction instruction)OperandRepresentationListgetOperandRepresentationList(CodeUnit cu, int opIndex)Returns a formatted list of operand objects for the specified code unit operand.java.lang.StringgetOperandRepresentationString(CodeUnit cu, int opIndex)Returns a formatted string representation of the specified code unit operand.protected java.lang.StringgetPrefixForStringData(Data data, Address dataAddress, int diff, DataType dt)java.lang.StringgetReferenceRepresentationString(CodeUnit fromCodeUnit, Reference ref)Returns a marked-up representation of the reference destination.java.lang.StringgetRepresentationString(CodeUnit cu)Returns a formatted string representation of the specified code unit, including mnemonic and operand(s) only.java.lang.StringgetRepresentationString(CodeUnit cu, boolean includeEOLcomment)Returns a formatted string representation of the specified code unit mnemonic and operand(s).CodeUnitFormatOptions.ShowBlockNamegetShowBlockName()Returns ShowBlockName setting
 
- 
- 
- 
Field Detail- 
PLUSprotected static final java.lang.String PLUS - See Also:
- Constant Field Values
 
 - 
UNDERSCOREprotected static final java.lang.String UNDERSCORE - See Also:
- Constant Field Values
 
 - 
EXTENDED_REFERENCE_DELIMITERpublic static java.lang.String EXTENDED_REFERENCE_DELIMITER 
 - 
EXTENDED_INDIRECT_REFERENCE_DELIMITERpublic static java.lang.String EXTENDED_INDIRECT_REFERENCE_DELIMITER 
 - 
DEFAULTpublic static CodeUnitFormat DEFAULT Default code unit format
 - 
optionsprotected CodeUnitFormatOptions options 
 
- 
 - 
Constructor Detail- 
CodeUnitFormatprotected CodeUnitFormat() Default constructor using default format options
 - 
CodeUnitFormatpublic 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.
 
 - 
CodeUnitFormatpublic CodeUnitFormat(CodeUnitFormatOptions options) Format constructor with more options. Extended reference mark-up is enabled.- Parameters:
- options- format options
 
 
- 
 - 
Method Detail- 
getRepresentationStringpublic java.lang.String getRepresentationString(CodeUnit cu) 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
 
 - 
getRepresentationStringpublic java.lang.String getRepresentationString(CodeUnit cu, boolean includeEOLcomment) Returns a formatted string representation of the specified code unit mnemonic and operand(s).- Parameters:
- cu- code unit
- includeEOLcomment- if true EOL comment will be appended to code unit representation
- Returns:
- formatted code unit representation
 
 - 
getMnemonicRepresentationpublic java.lang.String getMnemonicRepresentation(CodeUnit cu) Returns a formatted code unit mnemonic- Parameters:
- cu- code unit
- Returns:
- mnemonic representation
 
 - 
getOperandRepresentationStringpublic java.lang.String getOperandRepresentationString(CodeUnit cu, int opIndex) Returns a formatted string representation of the specified code unit operand.- Parameters:
- cu- code unit
- opIndex-
- Returns:
- formatted code unit representation
 
 - 
getOperandRepresentationListpublic OperandRepresentationList getOperandRepresentationList(CodeUnit cu, int opIndex) 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 unit
- opIndex- operand index
- Returns:
- list of representation objects or null for an unsupported language.
 
 - 
getDataValueRepresentationpublic OperandRepresentationList getDataValueRepresentation(Data data) 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.
 
 - 
getDataValueRepresentationStringpublic java.lang.String getDataValueRepresentationString(Data data) Returns a formatted data value for the specified data unit.- Parameters:
- data- data unit
- Returns:
- data value string
 
 - 
getReferenceRepresentationStringpublic java.lang.String getReferenceRepresentationString(CodeUnit fromCodeUnit, Reference ref) 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.
 
 - 
getOffcutLabelStringpublic java.lang.String getOffcutLabelString(Address offcutAddress, CodeUnit cu) 
 - 
getOffcutDataStringprotected java.lang.String getOffcutDataString(Address offcutAddress, Data data) 
 - 
getOffcutLabelStringForInstructionprotected java.lang.String getOffcutLabelStringForInstruction(Address offcutAddress, Instruction instruction) 
 - 
addOffcutInformationprotected java.lang.String addOffcutInformation(java.lang.String prefix, java.lang.String addressString, int diff, boolean decorate)
 - 
getPrefixForStringDataprotected java.lang.String getPrefixForStringData(Data data, Address dataAddress, int diff, DataType dt) 
 - 
getDefaultOffcutStringprotected java.lang.String getDefaultOffcutString(Symbol symbol, CodeUnit cu, long diff, boolean decorate) 
 - 
getShowBlockNamepublic CodeUnitFormatOptions.ShowBlockName getShowBlockName() Returns ShowBlockName setting
 
- 
 
-