20 : modes(modes), astCtxt(astCtxt) {
25 : modes(other.modes), astCtxt(other.astCtxt) {
31 this->astCtxt = other.astCtxt;
32 this->modes = other.modes;
51 std::vector<triton::engines::symbolic::PathConstraint> ret;
54 if (pc.getThreadId() == threadId) {
71 if (start < pcsize && end > pcsize) {
72 std::vector<triton::engines::symbolic::PathConstraint>::const_iterator first = this->
pathConstraints.begin() + start;
73 std::vector<triton::engines::symbolic::PathConstraint>::const_iterator last = this->
pathConstraints.end();
77 if (start < pcsize && end < pcsize && end > start) {
78 std::vector<triton::engines::symbolic::PathConstraint>::const_iterator first = this->
pathConstraints.begin() + start;
79 std::vector<triton::engines::symbolic::PathConstraint>::const_iterator last = this->
pathConstraints.begin() + end;
89 std::vector<triton::engines::symbolic::PathConstraint>::const_iterator it;
92 auto node = this->astCtxt->equal(
93 this->astCtxt->bvtrue(),
94 this->astCtxt->bvtrue()
99 node = this->astCtxt->land(node, it->getTakenPredicate());
108 std::vector<triton::ast::SharedAbstractNode> predicates;
111 auto node = this->astCtxt->equal(
112 this->astCtxt->bvtrue(),
113 this->astCtxt->bvtrue()
118 auto branches = pc->getBranchConstraints();
119 bool isMultib = (branches.size() >= 2);
122 for (
auto branch = branches.begin(); branch != branches.end(); branch++) {
124 if (std::get<1>(*branch) == addr) {
125 predicates.push_back(node);
131 if (std::get<2>(*branch) == addr) {
132 predicates.push_back(this->astCtxt->land(node, std::get<3>(*branch)));
138 if (isMultib ==
false && std::get<1>(*branch) != 0 && std::get<2>(*branch) != 0) {
140 auto ip = std::get<3>(*branch)->getChildren()[0];
141 predicates.push_back(this->astCtxt->land(node, this->astCtxt->equal(ip, this->astCtxt->bv(addr, ip->getBitvectorSize()))));
147 node = this->astCtxt->land(node, pc->getTakenPredicate());
176 size = pc->getBitvectorSize();
182 pc = pc->getChildren()[1];
226 this->astCtxt->equal(pc, this->astCtxt->bv(dstAddr, size))
237 if (node->isLogical() ==
false)
This class is used to represent an instruction.
TRITON_EXPORT triton::uint64 getAddress(void) const
Returns the address of the instruction.
TRITON_EXPORT triton::uint32 getThreadId(void) const
Returns the thread id of the instruction.
The path constraint class.
TRITON_EXPORT void setComment(const std::string &comment)
Sets a comment to the path constraint.
TRITON_EXPORT void setThreadId(triton::uint32 tid)
Sets the thread id of the constraint.
TRITON_EXPORT void addBranchConstraint(bool taken, triton::uint64 srdAddr, triton::uint64 dstAddr, const triton::ast::SharedAbstractNode &pc)
Adds a branch to the path constraint.
TRITON_EXPORT triton::ast::SharedAbstractNode getPathPredicate(void) const
Returns the current path predicate as an AST of logical conjunction of each taken branch.
TRITON_EXPORT PathManager(const triton::modes::SharedModes &modes, const triton::ast::SharedAstContext &astCtxt)
Constructor.
TRITON_EXPORT std::vector< triton::ast::SharedAbstractNode > getPredicatesToReachAddress(triton::uint64 addr) const
Returns path predicates which may reach the targeted address.
TRITON_EXPORT const std::vector< triton::engines::symbolic::PathConstraint > & getPathConstraints(void) const
Returns the logical conjunction vector of path constraints.
TRITON_EXPORT triton::usize getSizeOfPathConstraints(void) const
Returns the size of the path constraints.
TRITON_EXPORT PathManager & operator=(const PathManager &other)
Copies a PathManager.
TRITON_EXPORT std::vector< triton::engines::symbolic::PathConstraint > getPathConstraintsOfThread(triton::uint32 threadId) const
Returns the logical conjunction vector of path constraint of a given thread.
TRITON_EXPORT void pushPathConstraint(const triton::arch::Instruction &inst, const triton::engines::symbolic::SharedSymbolicExpression &expr)
Pushs constraints of a branch instruction to the path predicate.
TRITON_EXPORT void clearPathConstraints(void)
Clears the current path predicate.
std::vector< triton::engines::symbolic::PathConstraint > pathConstraints
The logical conjunction vector of path constraints.
TRITON_EXPORT void popPathConstraint(void)
Pops the last constraints added to the path predicate.
The exception class used by the path manager.
std::shared_ptr< triton::ast::AbstractNode > SharedAbstractNode
Shared Abstract Node.
std::shared_ptr< triton::ast::AstContext > SharedAstContext
Shared AST context.
std::shared_ptr< triton::modes::Modes > SharedModes
Shared Modes.
@ PC_TRACKING_SYMBOLIC
[symbolic] Track path constraints only if they are symbolized.
@ ONLY_ON_TAINTED
[symbolic] Perform symbolic execution only on tainted instructions.
std::shared_ptr< triton::engines::symbolic::SymbolicExpression > SharedSymbolicExpression
Shared Symbolic Expression.
std::size_t usize
unsigned MAX_INT 32 or 64 bits according to the CPU.
std::uint64_t uint64
unisgned 64-bits
std::uint32_t uint32
unisgned 32-bits