decompiler 1.0.0
Public Member Functions | Private Attributes | List of all members
ghidra::HandleTpl Class Reference

An exported value of a sub-constructor in a SLEIGH specification. More...

#include <semantics.hh>

Public Member Functions

 HandleTpl (void)
 Construct an uninitialized HandleTpl.
 
 HandleTpl (const VarnodeTpl *vn)
 Construct HandleTpl representing the given VarnodeTpl. More...
 
 HandleTpl (const ConstTpl &spc, const ConstTpl &sz, const VarnodeTpl *vn, AddrSpace *t_space, uintb t_offset)
 Construct a dynamic HandleTpl. More...
 
const ConstTpl & getSpace (void) const
 Get the address space.
 
const ConstTpl & getPtrSpace (void) const
 Get the pointer address space.
 
const ConstTpl & getPtrOffset (void) const
 Get the offset (or the pointer offset)
 
const ConstTpl & getPtrSize (void) const
 Get the pointer size.
 
const ConstTpl & getSize (void) const
 Get the size.
 
const ConstTpl & getTempSpace (void) const
 Get the temporary register address space.
 
const ConstTpl & getTempOffset (void) const
 Get the temporary register offset.
 
void setSize (const ConstTpl &sz)
 Set the size.
 
void setPtrSize (const ConstTpl &sz)
 Set the pointer size.
 
void setPtrOffset (uintb val)
 Set the pointer offset.
 
void setTempOffset (uintb val)
 Set the temporary register offset.
 
void fix (FixedHandle &hand, const ParserWalker &walker) const
 Calculate final fixed values for this. More...
 
void changeHandleIndex (const vector< int4 > &handmap)
 Remap any handle indices for this. More...
 
void encode (Encoder &encoder) const
 Encode this HandleTpl to an output stream. More...
 
void decode (Decoder &decoder)
 Decode this HandleTpl from a stream. More...
 

Private Attributes

ConstTpl space
 The address space of the value.
 
ConstTpl size
 The size of the value.
 
ConstTpl ptrspace
 (If dynamic) the address space of the pointer
 
ConstTpl ptroffset
 If dynamic, the offset of the pointer, or the offset of the value otherwise.
 
ConstTpl ptrsize
 (If dynamic) the size of the pointer
 
ConstTpl temp_space
 (If dynamic) the address space of the temporary register holding the final value
 
ConstTpl temp_offset
 (If dynamic) the offset of the temporary register
 

Detailed Description

An exported value of a sub-constructor in a SLEIGH specification.

For an output value that is equivalent to a VarnodeTpl, space, ptroffset, and size correspond to Varnode::space, Varnode::offset, and Varnode::size. But a HandleTpl can also represent a dynamic value loaded at run-time. In this case, the final value is stored in a temporary register specified by temp_space, temp_offset (and size), and the pointer used to load the final value is specified by ptrspace, ptroffset, and ptrsize.

Constructor & Destructor Documentation

◆ HandleTpl() [1/2]

ghidra::HandleTpl::HandleTpl ( const VarnodeTpl *  vn)

Construct HandleTpl representing the given VarnodeTpl.

The constructed HandleTpl is not dynamic and matches the given VarnodeTpl

Parameters
vnis the given VarnodeTpl

References ghidra::VarnodeTpl::getOffset(), ghidra::VarnodeTpl::getSize(), ghidra::VarnodeTpl::getSpace(), ptroffset, ptrspace, ghidra::ConstTpl::real, size, and space.

◆ HandleTpl() [2/2]

ghidra::HandleTpl::HandleTpl ( const ConstTpl &  spc,
const ConstTpl &  sz,
const VarnodeTpl *  vn,
AddrSpace *  t_space,
uintb  t_offset 
)

Construct a dynamic HandleTpl.

Parameters
spcis the address space
szis the size
vnis the varnode representing the dynamic pointer
t_spaceis the address space of the temporary register
t_offsetis the offset of the temporary register

Member Function Documentation

◆ changeHandleIndex()

void ghidra::HandleTpl::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.

Parameters
handmapis the given array of new handle indices

References ghidra::ConstTpl::changeHandleIndex(), ptroffset, ptrsize, ptrspace, size, space, temp_offset, and temp_space.

Referenced by ghidra::ConstructTpl::changeHandleIndex().

◆ decode()

void ghidra::HandleTpl::decode ( Decoder &  decoder)

◆ encode()

void ghidra::HandleTpl::encode ( Encoder &  encoder) const

Encode this HandleTpl to an output stream.

Parameters
encoderis the output stream

References ghidra::Encoder::closeElement(), ghidra::ConstTpl::encode(), ghidra::Encoder::openElement(), ptroffset, ptrsize, ptrspace, size, space, temp_offset, and temp_space.

Referenced by ghidra::ConstructTpl::encode().

◆ fix()

void ghidra::HandleTpl::fix ( FixedHandle &  hand,
const ParserWalker &  walker 
) const

The documentation for this class was generated from the following files: