Class PcodeProgram
java.lang.Object
ghidra.pcode.exec.PcodeProgram
- Direct Known Subclasses:
JitControlFlowModel.JitBlock, JitPassage, 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
Nested ClassesChangeModifier and TypeClassDescriptionprotected static classprotected static class -
Field Summary
FieldsChangeModifier and TypeFieldDescriptionprotected final SleighLanguageprotected final PcodeUseropLibrary.PcodeUseropSymbolMapREMOVEDRemoved -
Constructor Summary
ConstructorsChangeModifierConstructorDescriptionprotectedPcodeProgram(SleighLanguage language, List<PcodeOp> code, PcodeUseropLibrary.PcodeUseropSymbolMap userops) Construct a p-code program with the given bindingsPcodeProgram(PcodeProgram program, List<PcodeOp> code) Construct a p-code program from a derivative of the given one -
Method Summary
ChangeModifier and TypeMethodDescription<T> voidexecute(PcodeExecutor<T> executor, PcodeUseropLibrary<T> library) Execute this program using the given executor and libraryformat()For display purposes, list the code without op numbersformat(boolean numberOps) For display purposes, list the codestatic PcodeProgramfromInject(Program program, String name, int type) Generate a p-code program from a given program's inject librarystatic PcodeProgramfromInstruction(Instruction instruction) Generate a p-code program from the given instruction, without overridesstatic PcodeProgramfromInstruction(Instruction instruction, boolean includeOverrides) Generate a p-code program from the given instructiongetCode()Returns the p-code ops of this program.protected StringgetHead()For display purposes, get the header above the frame, usually the class nameGet the language generating this programgetUseropName(int opNo) Get the name of a userop by numberintgetUseropNumber(String name) Get the userop index for a given nametoString()
-
Field Details
-
language
-
code
-
userops NEW
-
-
Constructor Details
-
PcodeProgram
protected PcodeProgram(SleighLanguage language, List<PcodeOp> code, PcodeUseropLibrary.PcodeUseropSymbolMap userops) Construct a p-code program with the given bindings- Parameters:
language- the language that generated the p-codecode- the list of p-code opsuserops- a map of expected userop symbols
-
PcodeProgram
Construct a p-code program from a derivative of the given one- Parameters:
program- the original programcode- the code portion for this program
-
-
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
-
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
-
format
For display purposes, list the code- Parameters:
numberOps- true to include op numbers- Returns:
- the formatted listing
-
format
For display purposes, list the code without op numbers- Returns:
- the formatted listing
-
getUseropName
Get the name of a userop by number- Parameters:
opNo- the userop number- Returns:
- the name
-
getUseropNumber
Get the userop index for a given name- Parameters:
name- the name- Returns:
- the index, or -1 if not found
-