Package ghidra.pcode.exec
Class PcodeProgram
java.lang.Object
ghidra.pcode.exec.PcodeProgram
- Direct Known Subclasses:
PcodeExpression
A p-code program to be executed by a
PcodeExecutor
This is a list of p-code operations together with a map of expected userops.
-
Nested Class Summary
Modifier and TypeClassDescriptionprotected static class
protected static class
-
Field Summary
-
Constructor Summary
ModifierConstructorDescriptionprotected
PcodeProgram
(SleighLanguage language, List<PcodeOp> code, Map<Integer, ghidra.pcodeCPort.slghsymbol.UserOpSymbol> useropSymbols) Construct a p-code program with the given bindings -
Method Summary
Modifier and TypeMethodDescription<T> void
execute
(PcodeExecutor<T> executor, PcodeUseropLibrary<T> library) Execute this program using the given executor and librarystatic PcodeProgram
fromInject
(Program program, String name, int type) Generate a p-code program from a given program's inject librarystatic PcodeProgram
fromInstruction
(Instruction instruction) Generate a p-code program from the given instruction, without overridesstatic PcodeProgram
fromInstruction
(Instruction instruction, boolean includeOverrides) Generate a p-code program from the given instructiongetCode()
protected String
getHead()
For display purposes, get the header above the frame, usually the class nameGet the language generating this programtoString()
-
Field Details
-
language
-
code
-
useropNames
-
-
Constructor Details
-
PcodeProgram
protected PcodeProgram(SleighLanguage language, List<PcodeOp> code, Map<Integer, ghidra.pcodeCPort.slghsymbol.UserOpSymbol> useropSymbols) Construct a p-code program with the given bindings- Parameters:
language
- the language that generated the p-codecode
- the list of p-code opsuseropSymbols
- a map of expected userop symbols
-
-
Method Details
-
fromInstruction
Generate a p-code program from the given instruction, without overrides- Parameters:
instruction
- the instruction- Returns:
- the p-code program
-
fromInstruction
Generate a p-code program from the given instruction- Parameters:
instruction
- the instructionincludeOverrides
- as inInstruction.getPcode(boolean)
- Returns:
- the p-code program
-
fromInject
public static PcodeProgram fromInject(Program program, String name, int type) throws MemoryAccessException, UnknownInstructionException, NotFoundException, IOException Generate a p-code program from a given program's inject library- Parameters:
program
- the programname
- the name of the snippettype
- the type of the snippet- Returns:
- the p-code program
- Throws:
MemoryAccessException
- for problems establishing the injection contextIOException
- for problems while emitting the injection p-codeUnknownInstructionException
- if there is no underlying instruction being injectedNotFoundException
- if an expected aspect of the injection is not present in context
-
getLanguage
Get the language generating this program- Returns:
- the language
-
getCode
-
execute
Execute this program using the given executor and library- Type Parameters:
T
- the type of values to be operated on- Parameters:
executor
- the executorlibrary
- the library
-
getHead
For display purposes, get the header above the frame, usually the class name- Returns:
- the frame's display header
-
toString
-