Package ghidra.program.model.lang
Interface InstructionContext
- All Known Implementing Classes:
InstructionDB
,PseudoInstruction
public interface InstructionContext
InstructionContext
is utilized by a shared instruction prototype to
access all relevant instruction data and context-register storage needed during
instruction parse and semantic pcode generation.-
Method Summary
Modifier and TypeMethodDescriptionGet the instruction address that this context corresponds to.Get the read-only memory buffer containing the instruction bytes.Get the instruction parser context for the instruction which corresponds to this context object.getParserContext
(Address instructionAddress) Get the instruction parser context which corresponds to the specified instruction address.Get the read-only processor context containing the context-register state state at the corresponding instruction.
-
Method Details
-
getAddress
Address getAddress()Get the instruction address that this context corresponds to.- Returns:
- instruction address
-
getProcessorContext
ProcessorContextView getProcessorContext()Get the read-only processor context containing the context-register state state at the corresponding instruction. This is primarily used during the parse phase to provide the initial context-register state.- Returns:
- the read-only processor context
-
getMemBuffer
MemBuffer getMemBuffer()Get the read-only memory buffer containing the instruction bytes. Its position will correspond to the instruction address.- Returns:
- instruction memory buffer
-
getParserContext
Get the instruction parser context for the instruction which corresponds to this context object.- Returns:
- the instruction parser context for the instruction which corresponds to this context object.
- Throws:
MemoryAccessException
- if memory error occurred while resolving instruction details.
-
getParserContext
ParserContext getParserContext(Address instructionAddress) throws UnknownContextException, MemoryAccessException Get the instruction parser context which corresponds to the specified instruction address. This may be obtained via either caching or by parsing the instruction at the specified address. The returned ParserContext may be cast to the prototype's implementation without checking. This method will throw an UnknownContextException if a compatible ParserContext is not found at the specified address.- Parameters:
instructionAddress
- instruction address of requested context- Returns:
- the instruction parser context at the specified instruction address
- Throws:
UnknownContextException
- if the instruction at the specified address was not previously parsed or attempting to instantiate context resulted in an exception.MemoryAccessException
- if memory error occurred while resolving instruction details.
-