|
decompiler 1.0.0
|
A class for walking the constructor tree (ParserContext) More...
#include <context.hh>
Public Member Functions | |
| ParserWalker (const ParserContext *c) | |
| Constructor. | |
| ParserWalker (const ParserContext *c, const ParserContext *cross) | |
| Constructor for crossbuilds. | |
| const ParserContext * | getParserContext (void) const |
| Get the current context. | |
| void | baseState (void) |
| Initialize for a new walk. | |
| void | setOutOfBandState (Constructor *ct, int4 index, ConstructState *tempstate, const ParserWalker &otherwalker) |
| Initialize this from another walker assuming a given constructor and operand is the current position in the walk. More... | |
| bool | isState (void) const |
| Return true if there are more nodes to traverse. | |
| void | pushOperand (int4 i) |
| Make the indicated child (operand) the current node. More... | |
| void | popOperand (void) |
| Make the parent constructor the current node. | |
| uint4 | getOffset (int4 i) const |
| Get the byte offset of the indicated operand within the instruction stream. | |
| Constructor * | getConstructor (void) const |
| Get the current constructor. | |
| int4 | getOperand (void) const |
| Get the operand index of the next constructor in the walk. | |
| FixedHandle & | getParentHandle (void) |
| Get the resolved value associated with the current constructor. | |
| const FixedHandle & | getFixedHandle (int4 i) const |
| Get the resolved value associated with the indicated child operand. | |
| AddrSpace * | getCurSpace (void) const |
| Get the address space associated with the instruction stream. | |
| AddrSpace * | getConstSpace (void) const |
| Get the constant address space. | |
| const Address & | getAddr (void) const |
| Get the starting address of the instruction. | |
| const Address & | getNaddr (void) const |
| Get the address of the next instruction. | |
| const Address & | getN2addr (void) const |
| Get the address of the instruction after next. | |
| const Address & | getRefAddr (void) const |
| Get the reference address (inst_ref) for the p-code snippet. | |
| const Address & | getDestAddr (void) const |
| Get the destination address (inst_dest) for the overridden call. | |
| int4 | getLength (void) const |
| Get the length of the instruction in bytes. | |
| uintm | getInstructionBytes (int4 byteoff, int4 numbytes) const |
| Get packed instruction bytes associated with the current constructor. More... | |
| uintm | getContextBytes (int4 byteoff, int4 numbytes) const |
| Get packed context bytes from the local context. More... | |
| uintm | getInstructionBits (int4 startbit, int4 size) const |
| Get bits from the instruction stream associated with the current constructor. More... | |
| uintm | getContextBits (int4 startbit, int4 size) const |
| Get a range of bits from the local context. More... | |
Protected Attributes | |
| ConstructState * | point |
| The current node being visited. | |
| int4 | depth |
| Depth of the current node. | |
| int4 | breadcrumb [ParserContext::MAX_DEPTH] |
| Path of operands from root. | |
Private Attributes | |
| const ParserContext * | const_context |
| Context for the main instruction parse. | |
| const ParserContext * | cross_context |
| Context for an additional instruction parse needed to resolve a crossbuild. | |
A class for walking the constructor tree (ParserContext)
|
inline |
Get a range of bits from the local context.
| startbit | is the offset of the first bit |
| size | is the number of bits to return |
References const_context, and ghidra::ParserContext::getContextBits().
|
inline |
Get packed context bytes from the local context.
| byteoff | is the offset of the first byte to grab |
| numbytes | is the number of bytes to grab |
References const_context, and ghidra::ParserContext::getContextBytes().
|
inline |
Get bits from the instruction stream associated with the current constructor.
| startbit | is the offset of the first bit (relative to the starting point associated with the constructor) |
| size | is the number of bits to grab |
References const_context, ghidra::ParserContext::getInstructionBits(), ghidra::ConstructState::offset, and point.
|
inline |
Get packed instruction bytes associated with the current constructor.
| byteoff | is an offset from the starting point associated with the constructor |
| numbytes | is the number of bytes to pack |
References const_context, ghidra::ParserContext::getInstructionBytes(), ghidra::ConstructState::offset, and point.
|
inline |
Make the indicated child (operand) the current node.
| i | is the index of child/operand |
References breadcrumb, depth, ghidra::ParserContext::MAX_DEPTH, point, and ghidra::ConstructState::resolve.
Referenced by ghidra::SleighBuilder::appendBuild(), ghidra::SleighBuilder::buildEmpty(), and ghidra::Sleigh::resolveHandles().
| void ghidra::ParserWalker::setOutOfBandState | ( | Constructor * | ct, |
| int4 | index, | ||
| ConstructState * | tempstate, | ||
| const ParserWalker & | otherwalker | ||
| ) |
Initialize this from another walker assuming a given constructor and operand is the current position in the walk.
The constructor tree state is simulated using only a single provided node. This allows TokenField to behave as if it were just parsed so its getValue() will return the correct value.
| ct | is the given constructor |
| index | is the index of the operand |
| tempstate | is provided storage used to simulate the mid-walk tree node |
| otherwalker | is the walker with the complete parse state |
References breadcrumb, ghidra::ConstructState::ct, depth, ghidra::ConstructState::length, ghidra::ConstructState::offset, ghidra::ConstructState::parent, point, and ghidra::ConstructState::resolve.