Package ghidra.program.model.lang
Class PcodeInjectLibrary
- java.lang.Object
-
- ghidra.program.model.lang.PcodeInjectLibrary
-
public class PcodeInjectLibrary extends java.lang.Object
-
-
Field Summary
Fields Change Modifier and Type Field Description protected SleighLanguagelanguageprotected longuniqueBase
-
Constructor Summary
Constructors Change Constructor Description PcodeInjectLibrary(SleighLanguage l)PcodeInjectLibrary(PcodeInjectLibrary op2)Clone a library so that a Program can extend the library without modifying the base library from Language.
-
Method Summary
All Methods Instance Methods Concrete Methods Change Modifier and Type Method Description protected voidadjustUniqueBase(OpTpl[] opTemplates)MODIFIED InjectPayloadallocateInject(java.lang.String sourceName, java.lang.String name, int tp)The main InjectPayload factory interface.InjectContextbuildInjectContext()NEW PcodeInjectLibraryclone()NEW booleanequals(java.lang.Object obj)java.lang.String[]getCallFixupNames()NEW java.lang.String[]getCallotherFixupNames()ConstantPoolgetConstantPool(Program program)Get the constant pool associated with the given ProgramNEW InjectPayloadgetPayload(int type, java.lang.String name)NEW InjectPayloadSleigh[]getProgramPayloads()protected longgetUniqueBase()NEW inthashCode()NEW booleanhasProgramPayload(java.lang.String nm, int type)Determine if the given payload name and type exists and is an extension of the program.NEW booleanhasUserDefinedOp(java.lang.String name)Determine if the language has a given user-defined op.NEW booleanisOverride(java.lang.String nm, int type)Check if a specific payload has been overridden by a user extensionvoidparseInject(InjectPayload payload)Convert the XML string representation of the given payload to a ConstructTpl The payload should be unattached (not already installed in the library)protected voidregisterInject(InjectPayload payload)protected voidregisterProgramInject(java.util.List<InjectPayloadSleigh> userPayloads)NEW protected booleanremoveMechanismPayload(java.lang.String nm)Remove a specific call mechanism payload.MODIFIED InjectPayloadrestoreXmlInject(java.lang.String source, java.lang.String name, int tp, XmlPullParser parser)NEW voidsaveCompilerSpecXml(java.lang.StringBuilder buffer)Save the parts of the inject library that come from the compiler spec to the output stream as XML tagsNEW protected voiduninstallProgramPayloads()REMOVED InjectPayloadgetPayload(int type, String name, Program program, String context) (Removed)
-
-
-
Field Detail
-
language
protected SleighLanguage language
-
uniqueBase
protected long uniqueBase
-
-
Constructor Detail
-
PcodeInjectLibrary
public PcodeInjectLibrary(SleighLanguage l)
-
PcodeInjectLibrary
public PcodeInjectLibrary(PcodeInjectLibrary op2)
Clone a library so that a Program can extend the library without modifying the base library from Language. InjectPayloads can be considered immutable and don't need to be cloned.- Parameters:
op2- is the library to clone
-
-
Method Detail
-
clone NEW
public PcodeInjectLibrary clone()
- Overrides:
clonein classjava.lang.Object- Returns:
- A clone of this library
-
getProgramPayloads NEW
public InjectPayloadSleigh[] getProgramPayloads()
- Returns:
- an array of all the program specific payloads (or null)
-
hasProgramPayload NEW
public boolean hasProgramPayload(java.lang.String nm, int type)Determine if the given payload name and type exists and is an extension of the program.- Parameters:
nm- is the payload nametype- is the payload type- Returns:
- true if the program extension exists
-
isOverride NEW
public boolean isOverride(java.lang.String nm, int type)Check if a specific payload has been overridden by a user extension- Parameters:
nm- is the name of the payloadtype- is the type of payload- Returns:
- true if the payload is overridden
-
getPayload NEW
public InjectPayload getPayload(int type, java.lang.String name)
-
parseInject
public void parseInject(InjectPayload payload) throws SleighException
Convert the XML string representation of the given payload to a ConstructTpl The payload should be unattached (not already installed in the library)- Parameters:
payload- is the given payload whose XML should be converted- Throws:
SleighException- if there is any parsing issue
-
adjustUniqueBase
protected void adjustUniqueBase(OpTpl[] opTemplates)
-
getCallFixupNames
public java.lang.String[] getCallFixupNames()
- Returns:
- a list of names for all installed call-fixups
-
getCallotherFixupNames NEW
public java.lang.String[] getCallotherFixupNames()
- Returns:
- a list of names for all installed callother-fixups
-
buildInjectContext
public InjectContext buildInjectContext()
-
hasUserDefinedOp NEW
public boolean hasUserDefinedOp(java.lang.String name)
Determine if the language has a given user-defined op. In which case, a CALLOTHER_FIXUP can be installed for it.- Parameters:
name- is the putative name of the user-defined op- Returns:
- true if the user-defined op exists
-
registerInject
protected void registerInject(InjectPayload payload)
-
removeMechanismPayload NEW
protected boolean removeMechanismPayload(java.lang.String nm)
Remove a specific call mechanism payload.- Parameters:
nm- is the name of the payload- Returns:
- true if a payload was successfully removed
-
registerProgramInject
protected void registerProgramInject(java.util.List<InjectPayloadSleigh> userPayloads)
-
allocateInject MODIFIED
return type: InjectPayloadSleigh → InjectPayload-ghidra.program.model.lang.InjectPayloadSleigh allocateInject(java.lang.String sourceName, java.lang.String name, int tp)+ghidra.program.model.lang.InjectPayload allocateInject(java.lang.String sourceName, java.lang.String name, int tp)public InjectPayload allocateInject(java.lang.String sourceName, java.lang.String name, int tp)
The main InjectPayload factory interface. This can be overloaded by derived libraries to produce custom dynamic payloads.- Parameters:
sourceName- is a description of the source of the payloadname- is the formal name of the payloadtp- is the type of payload: CALLFIXUP_TYPE, CALLOTHERFIXUP_TYPE, etc.- Returns:
- the newly minted InjectPayload
-
saveCompilerSpecXml NEW
public void saveCompilerSpecXml(java.lang.StringBuilder buffer)
Save the parts of the inject library that come from the compiler spec to the output stream as XML tags- Parameters:
buffer- is the output stream
-
restoreXmlInject MODIFIED
added throws XmlParseException-ghidra.program.model.lang.InjectPayload restoreXmlInject(java.lang.String source, java.lang.String name, int tp, ghidra.xml.XmlPullParser parser)+ghidra.program.model.lang.InjectPayload restoreXmlInject(java.lang.String source, java.lang.String name, int tp, ghidra.xml.XmlPullParser parser) throws XmlParseExceptionpublic InjectPayload restoreXmlInject(java.lang.String source, java.lang.String name, int tp, XmlPullParser parser) throws XmlParseException
- Throws:
XmlParseException
-
getConstantPool
public ConstantPool getConstantPool(Program program) throws java.io.IOException
Get the constant pool associated with the given Program- Parameters:
program- is the given Program- Returns:
- the ConstantPool associated with the Program
- Throws:
java.io.IOException- for issues constructing the object
-
getUniqueBase
protected long getUniqueBase()
-
-