Package ghidra.app.util.pcode
Class AbstractAppender<T>
java.lang.Object
ghidra.app.util.pcode.AbstractAppender<T>
- Type Parameters:
T- the type of output of the formatter
- Direct Known Subclasses:
PcodeFrame.MyAppender,PcodeProgram.MyAppender
A base implementation of
Appender suitable for most cases.-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidappendAddressWordOffcut(long wordOffset, long offcut) voidappendCharacter(char c) voidvoidappendLabel(String label) default voidappendLineLabel(long label) Append a line label, usually meant to be on its own linevoidappendLineLabelRef(long label) voidappendMnemonic(int opcode) voidappendRawVarnode(AddressSpace space, long offset, long size) voidappendRegister(Register register) voidappendScalar(long value) voidappendSpace(AddressSpace space) protected voidappendString(String string) Append a plain string.voidappendUnique(long offset) voidappendUserop(int id) finish()Finish formatting and return the final resultprotected StringstringifyLineLabel(long label) Covert the given line label to a string as it should be conventionally displayed.protected StringstringifyOpMnemonic(int opcode) Convert the given opcode to a string as it should be conventionally displayed.protected StringstringifyRawVarnode(AddressSpace space, long offset, long size) Convert the given varnode to its raw conventional form.protected StringstringifyRegister(Register register) Convert the given register to a string as it should be conventionally displayed.protected StringstringifyScalarValue(long value) Convert the given scalar to a string as it should be conventionally displayed.protected StringstringifySpace(AddressSpace space) Convert the given address space to a string as it should be conventionally displayed.protected StringstringifyUnique(long offset) Convert a given unique variable to a string as it should be conventionally displayed.protected StringstringifyUserop(Language language, int id) Convert a given userop to a string as it should be conventionally displayed.protected StringstringifyUseropUnchecked(Language language, int id) Lookup a given userop nameprotected StringstringifyWordOffcut(long wordOffset, long offcut) Convert a given word-offcut style address to a string as it should be conventionally displayed.
-
Field Details
-
language
-
indent
protected final boolean indent
-
-
Constructor Details
-
AbstractAppender
Create a new appender.- Parameters:
language- the language of the p-code ops to formatindent- whether or not to indent
-
-
Method Details
-
getLanguage
-
appendAddressWordOffcut
public void appendAddressWordOffcut(long wordOffset, long offcut) -
appendCharacter
public void appendCharacter(char c) -
appendIndent
public void appendIndent() -
appendLabel
-
appendLineLabelRef
public void appendLineLabelRef(long label) -
appendMnemonic
public void appendMnemonic(int opcode) -
appendRawVarnode
-
appendRegister
-
appendScalar
public void appendScalar(long value) -
appendSpace
-
appendString
Append a plain string.By default, all append method delegate to this, so either it must be implemented, or every other append method must be overridden to avoid ever invoking this method. The default implementation throws an assertion error.
- Parameters:
string- the string to append
-
appendUnique
public void appendUnique(long offset) -
appendUserop
public void appendUserop(int id) -
stringifyLineLabel
Covert the given line label to a string as it should be conventionally displayed.- Parameters:
label- the label number- Returns:
- the display string, e.g.,
<L1>
-
stringifyOpMnemonic
Convert the given opcode to a string as it should be conventionally displayed.- Parameters:
opcode- the opcode- Returns:
- the display string, i.e., its mnemonic
-
stringifyRawVarnode
Convert the given varnode to its raw conventional form.- Parameters:
space- the address spaceoffset- the offset in the spacesize- the size in bytes- Returns:
- the raw display string
-
stringifyRegister
Convert the given register to a string as it should be conventionally displayed.- Parameters:
register- the register- Returns:
- the display string, i.e., its name
-
stringifyScalarValue
Convert the given scalar to a string as it should be conventionally displayed.- Parameters:
value- the value- Returns:
- the display string, i.e., its decimal value if small, or hex value is large
-
stringifySpace
Convert the given address space to a string as it should be conventionally displayed.- Parameters:
space- the address space- Returns:
- the display string, i.e., its name
-
stringifyUnique
Convert a given unique variable to a string as it should be conventionally displayed.- Parameters:
offset- the variable's offset- Returns:
- the display string, e.g.,
$U1234
-
stringifyUseropUnchecked
Lookup a given userop name- Parameters:
language- the language containing the useropid- the userop id- Returns:
- the display string, i.e., its name, or null if it doesn't exist
-
stringifyUserop
Convert a given userop to a string as it should be conventionally displayed.- Parameters:
language- the langauge containing the useropid- the userop id- Returns:
- the display string, i.e., its name or "unknown"
-
stringifyWordOffcut
Convert a given word-offcut style address to a string as it should be conventionally displayed.- Parameters:
wordOffset- the offset of the word in memoryoffcut- the byte "offcut" within the word- Returns:
- the display string, e.g.,
0x1234.1
-
appendLineLabel
default void appendLineLabel(long label) Append a line label, usually meant to be on its own line- Parameters:
label- the label number
-
finish
T finish()Finish formatting and return the final result- Returns:
- the final result
-