|
decompiler 1.0.0
|
A (partially) resolved Varnode in a SLEIGH specification. More...
#include <semantics.hh>
Public Member Functions | |
| VarnodeTpl (int4 hand, bool zerosize) | |
| Construct a handle. More... | |
| VarnodeTpl (void) | |
| Construct an uninitialized VarnodeTpl. | |
| VarnodeTpl (const ConstTpl &sp, const ConstTpl &off, const ConstTpl &sz) | |
| Construct directly from ConstTpl. More... | |
| VarnodeTpl (const VarnodeTpl &vn) | |
| Copy constructor. More... | |
| const ConstTpl & | getSpace (void) const |
| Get the address space. | |
| const ConstTpl & | getOffset (void) const |
| Get the offset. | |
| const ConstTpl & | getSize (void) const |
| Get the size. | |
| bool | isDynamic (const ParserWalker &walker) const |
| Return true if this is a dynamically computed handle. More... | |
| int4 | transfer (const vector< HandleTpl * > ¶ms) |
| Copy a computed HandleTpl into this from the given array. More... | |
| bool | isZeroSize (void) const |
| Return true if this currently has a size of zero. | |
| bool | operator== (const VarnodeTpl &op2) const |
| Test if two VarnodeTpl are equal. More... | |
| bool | operator!= (const VarnodeTpl &op2) const |
| Test if two VarnodeTpl are not equal. More... | |
| bool | operator< (const VarnodeTpl &op2) const |
| Order two VarnodeTpl. More... | |
| void | setOffset (uintb constVal) |
| Set the offset piece to a literal constant. | |
| void | setRelative (uintb constVal) |
| Set the offset piece to a relative branch offset. | |
| void | setSize (const ConstTpl &sz) |
| Set the size piece. | |
| bool | isUnnamed (void) const |
| Return true if this is an unnamed temporary register. | |
| void | setUnnamed (bool val) |
| Mark this as an unnamed temporary register. | |
| bool | isLocalTemp (void) const |
| Return true if this is a temporary register. | |
| bool | isRelative (void) const |
| Return true if this is a relative branch offset. | |
| void | changeHandleIndex (const vector< int4 > &handmap) |
| Remap any handle indices for this. More... | |
| bool | adjustTruncation (int4 sz, bool isbigendian) |
| Adjust truncation given final size of the Varnode. More... | |
| void | encode (Encoder &encoder) const |
| Encode this VarnodeTpl to an output stream. More... | |
| void | decode (Decoder &decoder) |
| Decode this VarnodeTpl from a stream. More... | |
Private Attributes | |
| ConstTpl | space |
| Address space associated with this variable. | |
| ConstTpl | offset |
| Offset into the address space. | |
| ConstTpl | size |
| Number of bytes in this variable. | |
| bool | unnamed_flag |
| Set to true if this is an unnamed temporary register. | |
Friends | |
| class | OpTpl |
| class | HandleTpl |
A (partially) resolved Varnode in a SLEIGH specification.
Variable symbols in SLEIGH are represented using this object. It encodes the address space, offset, and size associated with the variable. In the context of a specific instruction, this is translated into a Varnode object.
| ghidra::VarnodeTpl::VarnodeTpl | ( | int4 | hand, |
| bool | zerosize | ||
| ) |
Construct a handle.
| hand | is the index of the sub-constructor computing the handle value |
| zerosize | is true if the size of this should be disassociated from the computed handle and forced to zero |
References ghidra::ConstTpl::real, size, and unnamed_flag.
Construct directly from ConstTpl.
| sp | represents the address space |
| off | represents the offset into the address space |
| sz | represents the number of bytes |
References unnamed_flag.
| ghidra::VarnodeTpl::VarnodeTpl | ( | const VarnodeTpl & | vn | ) |
| bool ghidra::VarnodeTpl::adjustTruncation | ( | int4 | sz, |
| bool | isbigendian | ||
| ) |
Adjust truncation given final size of the Varnode.
The offset piece must be v_offset_plus, indicating this is truncated. Compute the final form of the truncation given the final size and endianness. Also check that the truncation is in bounds for the given final size.
| sz | is the final size of the Varnode in bytes |
| isbigendian | is true if the address space is big endian. |
References ghidra::ConstTpl::getHandleIndex(), ghidra::ConstTpl::getReal(), ghidra::ConstTpl::getType(), ghidra::ConstTpl::handle, offset, ghidra::ConstTpl::real, size, and ghidra::ConstTpl::v_offset_plus.
Referenced by ghidra::ConsistencyChecker::checkVarnodeTruncation().
| void ghidra::VarnodeTpl::changeHandleIndex | ( | const vector< int4 > & | handmap | ) |
Remap any handle indices for this.
This is used to help reorder sub-constructors. For each piece of this, if it is a handle, its index is translated by looking up a new value in the given array of indices.
| handmap | is the given array of new handle indices |
References ghidra::ConstTpl::changeHandleIndex(), offset, size, and space.
Referenced by ghidra::OpTpl::changeHandleIndex().
| void ghidra::VarnodeTpl::decode | ( | Decoder & | decoder | ) |
Decode this VarnodeTpl from a stream.
| decoder | is the input stream |
References ghidra::Decoder::closeElement(), ghidra::ConstTpl::decode(), offset, ghidra::Decoder::openElement(), size, and space.
Referenced by ghidra::OpTpl::decode().
| void ghidra::VarnodeTpl::encode | ( | Encoder & | encoder | ) | const |
Encode this VarnodeTpl to an output stream.
| encoder | is the output stream |
References ghidra::Encoder::closeElement(), ghidra::ConstTpl::encode(), offset, ghidra::Encoder::openElement(), size, and space.
Referenced by ghidra::OpTpl::encode().
| bool ghidra::VarnodeTpl::isDynamic | ( | const ParserWalker & | walker | ) | const |
Return true if this is a dynamically computed handle.
If the offset is computed by a sub-constructor using a p-code LOAD into a temporary register, then return true. If the sub-constructor does not use a LOAD, or this is not a handle, return false.
| walker | is the instruction context (used to look-up the specific sub-constructor) |
References ghidra::ParserWalker::getFixedHandle(), ghidra::ConstTpl::getHandleIndex(), ghidra::ConstTpl::getType(), ghidra::ConstTpl::handle, offset, and ghidra::FixedHandle::offset_space.
Referenced by ghidra::SleighBuilder::dump().
| bool ghidra::VarnodeTpl::operator!= | ( | const VarnodeTpl & | op2 | ) | const |
Test if two VarnodeTpl are not equal.
| op2 | is the VarnodeTpl to compare with this |
| bool ghidra::VarnodeTpl::operator< | ( | const VarnodeTpl & | op2 | ) | const |
Order two VarnodeTpl.
Order by address space, then offset, then size
| op2 | is the VarnodeTpl to order with this |
| bool ghidra::VarnodeTpl::operator== | ( | const VarnodeTpl & | op2 | ) | const |
Test if two VarnodeTpl are equal.
| op2 | is the VarnodeTpl to compare with this |
| int4 ghidra::VarnodeTpl::transfer | ( | const vector< HandleTpl * > & | params | ) |
Copy a computed HandleTpl into this from the given array.
For any piece of this (address space,offset,size) that is a handle, copy the HandleTpl with matching index. If this needs an additional constant added to its final offset piece, return that constant.
| params | is the given array of HandleTpl to match against |
References ghidra::ConstTpl::getHandleIndex(), ghidra::ConstTpl::getReal(), ghidra::ConstTpl::getSelect(), getSize(), ghidra::ConstTpl::getType(), ghidra::ConstTpl::handle, isLocalTemp(), ghidra::ConstTpl::isZero(), offset, size, space, ghidra::ConstTpl::transfer(), and ghidra::ConstTpl::v_offset_plus.
Referenced by ghidra::MacroBuilder::transferOp().