32 : modes(modes), astCtxt(astCtxt) {
34 if (architecture ==
nullptr)
37 if (symbolicEngine ==
nullptr)
40 if (taintEngine ==
nullptr)
43 this->architecture = architecture;
44 this->symbolicEngine = symbolicEngine;
45 this->taintEngine = taintEngine;
55 || this->riscvIsa ==
nullptr
67 delete this->riscvIsa;
80 for (
auto& operand : inst.
operands) {
82 this->symbolicEngine->
initLeaAst(operand.getMemory());
105 case triton::arch::ARCH_RV64:
106 case triton::arch::ARCH_RV32:
107 ret = this->riscvIsa->buildSemantics(inst);
133 if (inst.isControlFlow() && count) {
161 std::vector<triton::engines::symbolic::SharedSymbolicExpression> newVector;
173 this->collectUnsymbolizedNodes(inst.
operands);
192 if (se->isSymbolized() ==
false) {
196 newVector.push_back(se);
226 this->removeSymbolicExpressions(inst);
229 this->astCtxt->garbage();
234 for (
const auto& se : inst.symbolicExpressions) {
241 template <
typename T>
242 void IrBuilder::collectNodes(T& items)
const {
247 void IrBuilder::collectNodes(std::vector<triton::arch::OperandWrapper>& operands)
const {
248 for (
auto& operand : operands) {
250 operand.getMemory().setLeaAst(
nullptr);
256 template <
typename T>
257 void IrBuilder::collectUnsymbolizedNodes(T& items)
const {
260 for (
const auto& item : items) {
261 if (std::get<1>(item) && std::get<1>(item)->isSymbolized() ==
true)
262 newItems.insert(item);
270 void IrBuilder::collectUnsymbolizedNodes(std::vector<triton::arch::OperandWrapper>& operands)
const {
271 for (
auto& operand : operands) {
273 if (operand.getMemory().getLeaAst() && operand.getMemory().getLeaAst()->isSymbolized() ==
false) {
274 operand.getMemory().setLeaAst(
nullptr);
The abstract architecture class.
TRITON_EXPORT triton::uint512 getConcreteRegisterValue(const triton::arch::Register ®, bool execCallbacks=true) const
Returns the concrete value of a register.
TRITON_EXPORT triton::arch::architecture_e getArchitecture(void) const
Returns the kind of architecture as triton::arch::architecture_e.
This class is used to represent a basic block.
TRITON_EXPORT triton::usize getSize(void) const
Returns the number of instructions in the block.
TRITON_EXPORT std::vector< triton::arch::Instruction > & getInstructions(void)
Gets all instructions of the block.
This class is used to represent an instruction.
TRITON_EXPORT std::set< std::pair< triton::arch::Register, triton::ast::SharedAbstractNode > > & getReadRegisters(void)
Returns the list of all implicit and explicit register (flags includes) inputs (read)
TRITON_EXPORT std::set< std::pair< triton::arch::MemoryAccess, triton::ast::SharedAbstractNode > > & getStoreAccess(void)
Returns the list of all implicit and explicit store access.
TRITON_EXPORT void setAddress(triton::uint64 addr)
Sets the address of the instruction.
TRITON_EXPORT std::set< std::pair< triton::arch::MemoryAccess, triton::ast::SharedAbstractNode > > & getLoadAccess(void)
Returns the list of all implicit and explicit load access.
TRITON_EXPORT bool isTainted(void) const
Returns true if at least one of its expressions is tainted.
TRITON_EXPORT triton::uint64 getAddress(void) const
Returns the address of the instruction.
TRITON_EXPORT void setTaint(bool state)
Sets the taint of the instruction.
TRITON_EXPORT std::set< std::pair< triton::arch::Register, triton::ast::SharedAbstractNode > > & getWrittenRegisters(void)
Returns the list of all implicit and explicit register (flags includes) outputs (write)
std::vector< triton::arch::OperandWrapper > operands
A list of operands.
std::vector< triton::engines::symbolic::SharedSymbolicExpression > symbolicExpressions
The semantics set of the instruction.
TRITON_EXPORT std::set< std::pair< triton::arch::Immediate, triton::ast::SharedAbstractNode > > & getReadImmediates(void)
Returns the list of all implicit and explicit immediate inputs (read)
virtual TRITON_EXPORT ~IrBuilder()
Destructor.
TRITON_EXPORT IrBuilder(triton::arch::Architecture *architecture, const triton::modes::SharedModes &modes, const triton::ast::SharedAstContext &astCtxt, triton::engines::symbolic::SymbolicEngine *symbolicEngine, triton::engines::taint::TaintEngine *taintEngine)
Constructor.
triton::arch::SemanticsInterface * arm32Isa
ARM32 ISA builder.
triton::arch::SemanticsInterface * aarch64Isa
AArch64 ISA builder.
TRITON_EXPORT triton::arch::exception_e buildSemantics(triton::arch::Instruction &inst)
Builds the semantics of the instruction. Returns triton::arch::NO_FAULT if succeed.
TRITON_EXPORT void preIrInit(triton::arch::Instruction &inst)
Everything which must be done before buiding the semantics.
TRITON_EXPORT void postIrInit(triton::arch::Instruction &inst)
Everything which must be done after building the semantics.
triton::arch::SemanticsInterface * x86Isa
x86 ISA builder.
virtual TRITON_EXPORT triton::arch::exception_e buildSemantics(triton::arch::Instruction &inst)=0
Builds the semantics of the instruction. Returns triton::arch::NO_FAULT if succeed.
The AArch64 ISA semantics.
The symbolic engine class.
TRITON_EXPORT void initLeaAst(triton::arch::MemoryAccess &mem, bool force=true)
Initializes the effective address of a memory access.
TRITON_EXPORT void removeSymbolicExpression(const SharedSymbolicExpression &expr)
Removes the symbolic expression corresponding to the id.
The exception class used by the IR builder.
std::shared_ptr< triton::ast::AstContext > SharedAstContext
Shared AST context.
std::shared_ptr< triton::modes::Modes > SharedModes
Shared Modes.
@ ONLY_ON_TAINTED
[symbolic] Perform symbolic execution only on tainted instructions.
@ ONLY_ON_SYMBOLIZED
[symbolic] Perform symbolic execution only on symbolized expressions.
std::size_t usize
unsigned MAX_INT 32 or 64 bits according to the CPU.
std::uint64_t uint64
unisgned 64-bits