Package ghidra.app.decompiler
Class DecompileCallback
- java.lang.Object
-
- ghidra.app.decompiler.DecompileCallback
-
public class DecompileCallback extends java.lang.Object
Routines that the decompiler invokes to gather info during decompilation of a function.
-
-
Constructor Summary
Constructors Constructor Description DecompileCallback(Program prog, Language language, CompilerSpec compilerSpec, PcodeDataTypeManager dt)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static java.lang.String
buildInstruction(PcodeOp[] ops, int fallthruoffset, int paramshift, AddressFactory addrFactory)
Build an XML representation of all the pcode op's a given Instruction is defined to perform.byte[]
getBytes(java.lang.String addrxml)
java.lang.String
getComments(java.lang.String addrstring, java.lang.String types)
Collect any/all comments for the function starting at the indicated addressjava.lang.String
getCPoolRef(long[] refs)
java.lang.String
getExternalRefXML(java.lang.String addrstring)
java.lang.String
getMappedSymbolsXML(java.lang.String addrstring)
Called by the native decompiler to query the GHIDRA database about any symbols at the given address.java.lang.String
getNativeMessage()
java.lang.String
getPcodeInject(java.lang.String nm, java.lang.String context, int type)
PackedBytes
getPcodePacked(java.lang.String addrstring)
java.lang.String
getRegister(java.lang.String name)
java.lang.String
getRegisterName(java.lang.String addrstring)
java.lang.String
getSymbol(java.lang.String addrstring)
java.lang.String
getTrackedRegisters(java.lang.String addrstring)
java.lang.String
getType(java.lang.String name, java.lang.String idstr)
java.lang.String
getUserOpName(java.lang.String indexStr)
java.util.ArrayList<java.lang.String>
readXMLNameList(java.lang.String xml)
int
readXMLSize(java.lang.String addrxml)
void
setFunction(Function func, Address entry, DecompileDebug dbg)
Establish function and debug context for next decompilationvoid
setShowNamespace(boolean showNamespace)
-
-
-
Constructor Detail
-
DecompileCallback
public DecompileCallback(Program prog, Language language, CompilerSpec compilerSpec, PcodeDataTypeManager dt)
-
-
Method Detail
-
setFunction
public void setFunction(Function func, Address entry, DecompileDebug dbg)
Establish function and debug context for next decompilation- Parameters:
func
- is the function to be decompiledentry
- is the function's entry addressdbg
- is the debugging context (or null)
-
getNativeMessage
public java.lang.String getNativeMessage()
- Returns:
- the last message from the decompiler
-
setShowNamespace
public void setShowNamespace(boolean showNamespace)
-
readXMLSize
public int readXMLSize(java.lang.String addrxml)
-
readXMLNameList
public java.util.ArrayList<java.lang.String> readXMLNameList(java.lang.String xml) throws PcodeXMLException
- Throws:
PcodeXMLException
-
getBytes
public byte[] getBytes(java.lang.String addrxml)
-
getComments
public java.lang.String getComments(java.lang.String addrstring, java.lang.String types)
Collect any/all comments for the function starting at the indicated address- Parameters:
addrstring
- is the XML rep of function addresstypes
- is the string encoding of the comment type flags- Returns:
- XML document describing comments
-
getPcodePacked
public PackedBytes getPcodePacked(java.lang.String addrstring)
-
buildInstruction
public static java.lang.String buildInstruction(PcodeOp[] ops, int fallthruoffset, int paramshift, AddressFactory addrFactory)
Build an XML representation of all the pcode op's a given Instruction is defined to perform.- Parameters:
ops
- pcode opsfallthruoffset
- number of bytes after instruction start that pcode flow falls intoparamshift
- special instructions for injection useaddrFactory
- is the address factory for recovering address space names- Returns:
- XML document as string representing all the p-code
-
getPcodeInject
public java.lang.String getPcodeInject(java.lang.String nm, java.lang.String context, int type)
-
getCPoolRef
public java.lang.String getCPoolRef(long[] refs) throws java.io.IOException
- Throws:
java.io.IOException
-
getSymbol
public java.lang.String getSymbol(java.lang.String addrstring)
-
getMappedSymbolsXML
public java.lang.String getMappedSymbolsXML(java.lang.String addrstring)
Called by the native decompiler to query the GHIDRA database about any symbols at the given address.- Parameters:
addrstring
- XML encoded address to query- Returns:
- XML encoded result. Either function, reference, datatype, or hole
-
getExternalRefXML
public java.lang.String getExternalRefXML(java.lang.String addrstring)
-
getType
public java.lang.String getType(java.lang.String name, java.lang.String idstr)
-
getRegister
public java.lang.String getRegister(java.lang.String name)
-
getRegisterName
public java.lang.String getRegisterName(java.lang.String addrstring)
-
getTrackedRegisters
public java.lang.String getTrackedRegisters(java.lang.String addrstring)
-
getUserOpName
public java.lang.String getUserOpName(java.lang.String indexStr)
-
-