Package ghidra.program.model.lang
Class PcodeInjectLibrary
java.lang.Object
ghidra.program.model.lang.PcodeInjectLibrary
-
Field Summary
-
Constructor Summary
ConstructorDescriptionClone a library so that a Program can extend the library without modifying the base library from Language. -
Method Summary
Modifier and TypeMethodDescriptionallocateInject
(String sourceName, String name, int tp) The main InjectPayload factory interface.clone()
void
encodeCompilerSpec
(Encoder encoder) Encode the parts of the inject library that come from the compiler spec to the output streamString[]
String[]
getConstantPool
(Program program) Get the constant pool associated with the given ProgramgetPayload
(int type, String name) protected long
boolean
hasProgramPayload
(String nm, int type) Determine if the given payload name and type exists and is an extension of the program.boolean
hasUserDefinedOp
(String name) Determine if the language has a given user-defined op.boolean
Compare that this and the other library contain all equivalent payloadsboolean
isOverride
(String nm, int type) Check if a specific payload has been overridden by a user extensionvoid
parseInject
(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 void
registerInject
(InjectPayload payload) protected void
registerProgramInject
(List<InjectPayloadSleigh> userPayloads) protected boolean
Remove a specific call mechanism payload.restoreXmlInject
(String source, String name, int tp, XmlPullParser parser) protected void
-
Field Details
-
language
-
uniqueBase
protected long uniqueBase
-
-
Constructor Details
-
PcodeInjectLibrary
-
PcodeInjectLibrary
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 Details
-
clone
-
getProgramPayloads
- Returns:
- an array of all the program specific payloads (or null)
-
hasProgramPayload
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
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
-
parseInject
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
-
getCallFixupNames
- Returns:
- a list of names for all installed call-fixups
-
getCallotherFixupNames
- Returns:
- a list of names for all installed callother-fixups
-
buildInjectContext
-
hasUserDefinedOp
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
-
removeMechanismPayload
Remove a specific call mechanism payload.- Parameters:
nm
- is the name of the payload- Returns:
- true if a payload was successfully removed
-
uninstallProgramPayloads
protected void uninstallProgramPayloads() -
registerProgramInject
-
allocateInject
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
-
encodeCompilerSpec
Encode the parts of the inject library that come from the compiler spec to the output stream- Parameters:
encoder
- is the stream encoder- Throws:
IOException
- for errors writing to the underlying stream
-
restoreXmlInject
public InjectPayload restoreXmlInject(String source, String name, int tp, XmlPullParser parser) throws XmlParseException - Throws:
XmlParseException
-
getConstantPool
Get the constant pool associated with the given Program- Parameters:
program
- is the given Program- Returns:
- the ConstantPool associated with the Program
- Throws:
IOException
- for issues constructing the object
-
getUniqueBase
protected long getUniqueBase() -
isEquivalent
Compare that this and the other library contain all equivalent payloads- Parameters:
obj
- is the other library- Returns:
- true if all payloads are equivalent
-