64 if (this->
ast ==
nullptr)
71 if (this->
ast ==
nullptr)
88 if (this->
ast ==
nullptr)
92 return "ref!" + std::to_string(this->
id);
95 return "ref_" + std::to_string(this->
id);
100 std::ostringstream ss;
101 ss <<
"@[0x" << std::hex << mem.getAddress() <<
":" << std::dec << mem.getBitSize() <<
"]";
106 return reg.getName() +
"_" + std::to_string(this->
id);
109 return "tmp_" + std::to_string(this->
id);
119 if (this->
ast ==
nullptr)
125 switch (
ast->getContext()->getRepresentationMode()) {
139 std::string SymbolicExpression::getBitvectorDefine(
void)
const {
140 std::ostringstream stream;
141 stream <<
"(define-fun " << this->
getFormattedId() <<
" () (_ BitVec " << std::dec << this->
getAst()->getBitvectorSize() <<
") " << this->
getAst() <<
")";
146 std::string SymbolicExpression::getArrayDefine(
void)
const {
147 std::ostringstream stream;
161 std::ostringstream stream;
163 if (this->
ast ==
nullptr)
166 switch (
ast->getContext()->getRepresentationMode()) {
168 stream << (this->
getAst()->isArray() ? this->getArrayDefine() : this->getBitvectorDefine());
211 for (
auto sp : old->getParents()) {
212 node->setParent(sp.get());
220 if (!old || !old->canReplaceNodeWithoutUpdate(
ast)) {
221 this->
ast->initParents();
267 if (this->
ast ==
nullptr)
269 return this->
ast->isSymbolized();
This class is used to represent a memory access.
This class is used when an instruction has a register operand.
The symbolic expression class.
TRITON_EXPORT bool isMemory(void) const
Returns true if the symbolic expression is assigned to a memory.
TRITON_EXPORT triton::usize getId(void) const
Returns the symbolic expression id.
TRITON_EXPORT triton::uint64 getAddress(void) const
Get the address of the symbolic expression, if any.
TRITON_EXPORT const std::string & getDisassembly(void)
Gets the instruction disassembly where the symbolic expression comes from.
triton::usize id
The symbolic expression id. This id is unique.
TRITON_EXPORT SymbolicExpression(const triton::ast::SharedAbstractNode &node, triton::usize id, triton::engines::symbolic::expression_e type, const std::string &comment="")
Constructor.
TRITON_EXPORT std::string getFormattedId(void) const
Returns the id as string of the symbolic expression according the mode of the AST representation.
TRITON_EXPORT std::string getFormattedComment(void) const
Returns the comment as string of the symbolic expression according the mode of the AST representation...
TRITON_EXPORT void setAddress(triton::uint64 address)
Sets the symbolic expression address.
TRITON_EXPORT void setAst(const triton::ast::SharedAbstractNode &node)
Sets a root node.
TRITON_EXPORT void setType(triton::engines::symbolic::expression_e type)
Sets the kind of the symbolic expression.
TRITON_EXPORT const triton::ast::SharedAbstractNode & getAst(void) const
Returns the SMT AST root node of the symbolic expression. This is the semantics.
TRITON_EXPORT std::string getFormattedExpression(void) const
Returns the symbolic expression representation as string according the mode of the AST representation...
TRITON_EXPORT const triton::arch::Register & getOriginRegister(void) const
Returns the origin register if kind is equal to triton::engines::symbolic::REGISTER_EXPRESSION,...
TRITON_EXPORT const std::string & getComment(void) const
Returns the comment of the symbolic expression.
bool isTainted
True if the symbolic expression is tainted.
TRITON_EXPORT const triton::arch::MemoryAccess & getOriginMemory(void) const
Returns the origin memory access if kind is equal to triton::engines::symbolic::MEMORY_EXPRESSION,...
TRITON_EXPORT void setComment(const std::string &comment)
Sets a comment to the symbolic expression.
std::string disassembly
The instruction disassembly where the symbolic expression comes from.
TRITON_EXPORT bool isSymbolized(void) const
Returns true if the expression contains a symbolic variable.
triton::arch::Register originRegister
The origin register if type is equal to triton::engines::symbolic::REG, REG_INVALID otherwise.
TRITON_EXPORT void setOriginRegister(const triton::arch::Register ®)
Sets the origin register.
triton::uint64 address
The address of the instruction behind the symbolic expression. -1 if not defined.
TRITON_EXPORT triton::engines::symbolic::expression_e getType(void) const
Returns the type of the symbolic expression assignment.
triton::ast::SharedAbstractNode ast
The root node (AST) of the symbolic expression.
triton::arch::MemoryAccess originMemory
The origin memory address if type is equal to triton::engines::symbolic::MEM, invalid memory otherwis...
TRITON_EXPORT triton::ast::SharedAbstractNode getNewAst(void) const
Returns a new SMT AST root node of the symbolic expression. This new instance is a duplicate of the o...
TRITON_EXPORT bool isRegister(void) const
Returns true if the symbolic expression is assigned to a register.
TRITON_EXPORT void setOriginMemory(const triton::arch::MemoryAccess &mem)
Sets the origin memory acccess.
triton::engines::symbolic::expression_e type
The type of the symbolic expression assignment.
TRITON_EXPORT void writeBackDisassembly(const std::string &disassembly)
Writes back the instruction disassembly where the symbolic expression comes from.
std::string comment
The comment of the symbolic expression.
TRITON_EXPORT SymbolicExpression & operator=(const SymbolicExpression &other)
Operator.
The exception class used by symbolic expressions.
triton::uint32 getIndexSize(const SharedAbstractNode &node)
Gets the index size of an array.
std::shared_ptr< triton::ast::AbstractNode > SharedAbstractNode
Shared Abstract Node.
SharedAbstractNode newInstance(AbstractNode *node, bool unroll)
AST C++ API - Duplicates the AST.
expression_e
Type of symbolic expressions.
std::ostream & operator<<(std::ostream &stream, const SymbolicExpression &symExpr)
Displays a symbolic expression.
@ REGISTER_EXPRESSION
Assigned to a register expression.
@ MEMORY_EXPRESSION
Assigned to a memory expression.
std::size_t usize
unsigned MAX_INT 32 or 64 bits according to the CPU.
std::uint64_t uint64
unisgned 64-bits