97 std::memcpy(this->
opcode, other.
opcode,
sizeof(this->opcode));
140 if (
size >
sizeof(this->opcode))
203 this->
loadAccess.insert(std::make_pair(mem, node));
211 if (it->first.getAddress() == mem.
getAddress())
220 this->
storeAccess.insert(std::make_pair(mem, node));
228 if (it->first.getAddress() == mem.
getAddress())
245 if (it->first.getId() == reg.
getId())
262 if (it->first.getId() == reg.
getId())
279 if (it->first.getValue() == imm.
getValue())
350 if ((*it)->isTainted ==
true) {
389 if ((*it)->isSymbolized() ==
true)
550 stream <<
"0x" << std::hex << inst.
getAddress() <<
": " << (!dis.empty() ? dis :
"<not disassembled>") << std::dec;
This class is used to represent an instruction.
TRITON_EXPORT void setOpcode(const void *opcode, triton::uint32 size)
Sets the opcode of the instruction.
TRITON_EXPORT void setLoadAccess(const triton::arch::MemoryAccess &mem, const triton::ast::SharedAbstractNode &node)
Sets a load access.
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 Instruction & operator=(const Instruction &other)
Copies an Instruction.
TRITON_EXPORT void setUpdateFlag(bool state)
Sets the updateFlag of the instruction.
TRITON_EXPORT triton::arch::architecture_e getArchitecture(void) const
Returns the instruction's architecture.
TRITON_EXPORT triton::uint32 getSize(void) const
Returns the size of the instruction.
TRITON_EXPORT void setDisassembly(const std::string &str)
Sets the disassembly of the instruction.
std::set< std::pair< triton::arch::Immediate, triton::ast::SharedAbstractNode > > readImmediates
Implicit and explicit immediate inputs (read). This field is set at the semantics level.
TRITON_EXPORT bool isWriteBack(void) const
Returns true if the instruction performs a write back. Mainly used for AArch64 instructions like LDR.
TRITON_EXPORT void removeLoadAccess(const triton::arch::MemoryAccess &mem)
Removes a load access.
TRITON_EXPORT void setThumb(bool state)
Sets the Thumb mode of the instruction.
TRITON_EXPORT void setConditionTaken(bool flag)
Sets flag to define if the condition is taken or not.
std::stringstream disassembly
The disassembly of the instruction. This field is set at the disassembly level.
TRITON_EXPORT bool isWriteTo(const triton::arch::OperandWrapper &target) const
Returns whether the instruction writes the specified operand.
TRITON_EXPORT void setWrittenRegister(const triton::arch::Register ®, const triton::ast::SharedAbstractNode &node)
Sets a written register.
TRITON_EXPORT const triton::uint8 * getOpcode(void) const
Returns the opcode of the instruction.
triton::uint32 size
The size of the instruction.
triton::arch::x86::prefix_e prefix
The prefix of the instruction. This field is set at the disassembly level. Mainly used for X86.
bool thumb
True if this is a Thumb instruction. (Note that isThumb() in Arm32Cpu is used to determine the curren...
triton::uint8 opcode[16]
The opcode of the instruction.
std::set< std::pair< triton::arch::MemoryAccess, triton::ast::SharedAbstractNode > > storeAccess
Implicit and explicit store access (write). This field is set at the semantics level.
triton::arch::arm::condition_e codeCondition
The code condition of the instruction. This field is set at the disassembly level....
TRITON_EXPORT bool isThumb(void) const
Returns true if it is a Thumb instruction.
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 setType(triton::uint32 type)
Sets the type of the instruction.
TRITON_EXPORT void setPrefix(triton::arch::x86::prefix_e prefix)
Sets the prefix of the instruction (mainly for X86).
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 void clear(void)
Clears all instruction information.
TRITON_EXPORT void setTaint(void)
Sets the taint of the instruction based on its expressions.
bool writeBack
True if this instruction performs a write back. Mainly used for AArch64 instruction like LDR.
TRITON_EXPORT void setStoreAccess(const triton::arch::MemoryAccess &mem, const triton::ast::SharedAbstractNode &node)
Sets a store access.
TRITON_EXPORT triton::uint32 getType(void) const
Returns the type of the instruction.
TRITON_EXPORT void removeReadRegister(const triton::arch::Register ®)
Removes a read register.
TRITON_EXPORT bool isConditionTaken(void) const
Returns true if the condition is taken (e.g x86: jcc, cmovcc, setcc, ...).
TRITON_EXPORT void setArchitecture(triton::arch::architecture_e arch)
Sets the instruction's architecture.
TRITON_EXPORT bool isReadFrom(const triton::arch::OperandWrapper &target) const
Returns whether the instruction reads the specified operand.
TRITON_EXPORT bool isTainted(void) const
Returns true if at least one of its expressions is tainted.
std::set< std::pair< triton::arch::MemoryAccess, triton::ast::SharedAbstractNode > > loadAccess
Implicit and explicit load access (read). This field is set at the semantics level.
triton::uint32 type
The type of the instruction. This field is set at the disassembly level.
TRITON_EXPORT std::set< triton::arch::Register > & getUndefinedRegisters(void)
Returns the list of all implicit and explicit undefined registers.
TRITON_EXPORT void setWriteBack(bool state)
Sets the writeBack flag of the instruction.
TRITON_EXPORT triton::uint64 getAddress(void) const
Returns the address of the instruction.
TRITON_EXPORT bool isSymbolized(void) const
Returns true if at least one of its expressions contains a symbolic variable.
TRITON_EXPORT bool isMemoryRead(void) const
Returns true if the instruction contains an expression which reads the memory.
TRITON_EXPORT void removeUndefinedRegister(const triton::arch::Register ®)
Removes an undefined register.
bool controlFlow
True if this instruction changes the control flow. This field is set at the disassembly level.
TRITON_EXPORT bool isMemoryWrite(void) const
Returns true if the instruction contains an expression which writes into the memory.
TRITON_EXPORT void setUndefinedRegister(const triton::arch::Register ®)
Sets an undefined register.
TRITON_EXPORT triton::uint32 getThreadId(void) const
Returns the thread id of the instruction.
TRITON_EXPORT void removeReadImmediate(const triton::arch::Immediate &imm)
Removes a read immediate.
TRITON_EXPORT bool isBranch(void) const
Returns true if this instruction is a branch.
TRITON_EXPORT bool isPrefixed(void) const
Returns true if the instruction has a prefix (mainly for X86).
TRITON_EXPORT void setBranch(bool flag)
Sets flag to define this instruction as branch or not.
TRITON_EXPORT void setSize(triton::uint32 size)
Sets the size of the instruction.
TRITON_EXPORT Instruction()
Constructor.
TRITON_EXPORT void setCodeCondition(triton::arch::arm::condition_e codeCondition)
Sets the code condition of the instruction (mainly for AArch64).
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.
bool tainted
True if this instruction is tainted. This field is set at the semantics level.
TRITON_EXPORT void removeWrittenRegister(const triton::arch::Register ®)
Removes a written register.
TRITON_EXPORT void addSymbolicExpression(const triton::engines::symbolic::SharedSymbolicExpression &expr)
Adds a symbolic expression.
std::set< triton::arch::Register > undefinedRegisters
Implicit and explicit undefined registers. This field is set at the semantics level.
TRITON_EXPORT void setReadImmediate(const triton::arch::Immediate &imm, const triton::ast::SharedAbstractNode &node)
Sets a read immediate.
std::set< std::pair< triton::arch::Register, triton::ast::SharedAbstractNode > > readRegisters
Implicit and explicit register inputs (read). This field is set at the semantics level.
TRITON_EXPORT void setControlFlow(bool flag)
Sets flag to define this instruction changes the control flow or not.
TRITON_EXPORT bool isUpdateFlag(void) const
Returns true if the instruction updates flags. Mainly used for AArch64 instructions like ADDS.
bool updateFlag
True if this instruction updartes flags. Mainly used for AArch64 instruction like ADDS.
TRITON_EXPORT triton::arch::x86::prefix_e getPrefix(void) const
Returns the prefix of the instruction (mainly for X86).
triton::arch::architecture_e arch
The instruction's architecture.
TRITON_EXPORT ~Instruction()
Destructor.
std::set< std::pair< triton::arch::Register, triton::ast::SharedAbstractNode > > writtenRegisters
Implicit and explicit register outputs (write). This field is set at the semantics level.
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)
TRITON_EXPORT void setReadRegister(const triton::arch::Register ®, const triton::ast::SharedAbstractNode &node)
Sets a read register.
triton::uint64 address
The address of the instruction.
TRITON_EXPORT void removeStoreAccess(const triton::arch::MemoryAccess &mem)
Removes a store access.
TRITON_EXPORT void setThreadId(triton::uint32 tid)
Sets the thread id of the instruction.
bool conditionTaken
True if the condition is taken (i.g x86: jcc, cmocc, setcc, ...). This field is set at the semantics ...
triton::uint32 tid
The thread id of the instruction.
TRITON_EXPORT triton::arch::arm::condition_e getCodeCondition(void) const
Returns the code codition of the instruction (mainly for AArch64).
TRITON_EXPORT std::string getDisassembly(void) const
Returns the disassembly of the instruction.
bool branch
True if this instruction is a branch. This field is set at the disassembly level.
TRITON_EXPORT triton::uint64 getNextAddress(void) const
Returns the next address of the instruction.
TRITON_EXPORT bool isControlFlow(void) const
Returns true if this instruction changes the control flow (e.g x86: JMP, JCC, CALL,...
This class is used to represent a memory access.
TRITON_EXPORT bool isOverlapWith(const MemoryAccess &other) const
Returns true if other and self overlap.
TRITON_EXPORT triton::uint64 getAddress(void) const
Returns the address of the memory.
This class is used as operand wrapper.
TRITON_EXPORT triton::arch::operand_e getType(void) const
Returns the abstract type of the operand.
TRITON_EXPORT const triton::arch::MemoryAccess & getConstMemory(void) const
Returns the memory operand as const.
TRITON_EXPORT const triton::arch::Register & getConstRegister(void) const
Returns the register operand.
TRITON_EXPORT const triton::arch::Immediate & getConstImmediate(void) const
Returns the immediate operand.
This class is used when an instruction has a register operand.
TRITON_EXPORT triton::arch::register_e getId(void) const
Returns the id of the register.
TRITON_EXPORT bool isOverlapWith(const Register &other) const
Returns true if other and self overlap.
The exception class used by an instruction.
std::ostream & operator<<(std::ostream &stream, BasicBlock &block)
Displays an BasicBlock.
condition_e
Types of condition.
@ ID_CONDITION_INVALID
invalid
std::shared_ptr< triton::ast::AbstractNode > SharedAbstractNode
Shared Abstract Node.
std::shared_ptr< triton::engines::symbolic::SymbolicExpression > SharedSymbolicExpression
Shared Symbolic Expression.
std::uint64_t uint64
unisgned 64-bits
std::uint32_t uint32
unisgned 32-bits
std::uint8_t uint8
unisgned 8-bits
std::string toString(const T &obj)
Converts an object to a string.
@ ID_PREFIX_INVALID
invalid