|
LIEF: Library to Instrument Executable Formats Version 1.0.0
|
This class represents an assembly instruction. More...
#include <Instruction.hpp>

Classes | |
| class | Iterator |
| Lazy-forward iterator that disassembles instructions on demand. More... | |
Public Types | |
| enum class | MemoryAccess : uint8_t { NONE = 0 , READ = 1 << 0 , WRITE = 1 << 1 , READ_WRITE = READ | WRITE } |
| Memory operation flags. More... | |
Public Member Functions | |
| uint64_t | address () const |
| Address of the instruction. | |
| size_t | size () const |
| Size of the instruction in bytes. | |
| const std::vector< uint8_t > & | raw () const |
| Raw bytes of the current instruction. | |
| std::string | mnemonic () const |
| Instruction mnemonic (e.g. br). | |
| std::string | to_string (bool with_address=true) const |
| Representation of the current instruction in a pretty assembly way. | |
| bool | is_call () const |
| True if the instruction is a call. | |
| bool | is_terminator () const |
| True if the instruction marks the end of a basic block. | |
| bool | is_branch () const |
| True if the instruction is a branch. | |
| bool | is_syscall () const |
| True if the instruction is a syscall. | |
| bool | is_memory_access () const |
| True if the instruction performs a memory access. | |
| bool | is_move_reg () const |
| True if the instruction is a register to register move. | |
| bool | is_add () const |
| True if the instruction performs an arithmetic addition. | |
| bool | is_trap () const |
| True if the instruction is a trap. | |
| bool | is_barrier () const |
| True if the instruction prevents executing the instruction that immediately follows the current. This includes return or unconditional branch instructions. | |
| bool | is_return () const |
| True if the instruction is a return. | |
| bool | is_indirect_branch () const |
| True if the instruction is an indirect branch. | |
| bool | is_conditional_branch () const |
| True if the instruction is conditionally jumping to the next instruction or an instruction into some other basic block. | |
| bool | is_unconditional_branch () const |
| True if the instruction is jumping (unconditionally) to some other basic block. | |
| bool | is_compare () const |
| True if the instruction is a comparison. | |
| bool | is_move_immediate () const |
| True if the instruction is moving an immediate. | |
| bool | is_bitcast () const |
| True if the instruction is doing a bitcast. | |
| MemoryAccess | memory_access () const |
| Memory access flags. | |
| result< uint64_t > | branch_target () const |
| Given a is_branch() instruction, try to evaluate the address of the destination. | |
| const llvm::MCInst & | mcinst () const |
| Return the underlying llvm::MCInst implementation. | |
| template<class T> | |
| const T * | as () const |
| This function can be used to down cast an Instruction instance: | |
| virtual | ~Instruction () |
This class represents an assembly instruction.
|
strong |
|
virtual |
Reimplemented in LIEF::assembly::aarch64::Instruction, LIEF::assembly::arm::Instruction, LIEF::assembly::ebpf::Instruction, LIEF::assembly::mips::Instruction, LIEF::assembly::powerpc::Instruction, LIEF::assembly::riscv::Instruction, and LIEF::assembly::x86::Instruction.
References LIEF_LIFETIMEBOUND, and LIEF_LOCAL.
| uint64_t LIEF::assembly::Instruction::address | ( | ) | const |
Address of the instruction.
|
inline |
This function can be used to down cast an Instruction instance:
References as(), and LIEF_LIFETIMEBOUND.
Referenced by as().
| result< uint64_t > LIEF::assembly::Instruction::branch_target | ( | ) | const |
Given a is_branch() instruction, try to evaluate the address of the destination.
References branch_target().
Referenced by branch_target().
| bool LIEF::assembly::Instruction::is_add | ( | ) | const |
| bool LIEF::assembly::Instruction::is_barrier | ( | ) | const |
True if the instruction prevents executing the instruction that immediately follows the current. This includes return or unconditional branch instructions.
References is_barrier().
Referenced by is_barrier().
| bool LIEF::assembly::Instruction::is_bitcast | ( | ) | const |
| bool LIEF::assembly::Instruction::is_branch | ( | ) | const |
| bool LIEF::assembly::Instruction::is_call | ( | ) | const |
| bool LIEF::assembly::Instruction::is_compare | ( | ) | const |
| bool LIEF::assembly::Instruction::is_conditional_branch | ( | ) | const |
True if the instruction is conditionally jumping to the next instruction or an instruction into some other basic block.
References is_conditional_branch().
Referenced by is_conditional_branch().
| bool LIEF::assembly::Instruction::is_indirect_branch | ( | ) | const |
True if the instruction is an indirect branch.
This includes instructions that branch through a register (e.g. jmp rax, br x1).
References is_indirect_branch().
Referenced by is_indirect_branch().
| bool LIEF::assembly::Instruction::is_memory_access | ( | ) | const |
True if the instruction performs a memory access.
References is_memory_access().
Referenced by is_memory_access().
| bool LIEF::assembly::Instruction::is_move_immediate | ( | ) | const |
True if the instruction is moving an immediate.
References is_move_immediate().
Referenced by is_move_immediate().
| bool LIEF::assembly::Instruction::is_move_reg | ( | ) | const |
True if the instruction is a register to register move.
References is_move_reg().
Referenced by is_move_reg().
| bool LIEF::assembly::Instruction::is_return | ( | ) | const |
| bool LIEF::assembly::Instruction::is_syscall | ( | ) | const |
| bool LIEF::assembly::Instruction::is_terminator | ( | ) | const |
True if the instruction marks the end of a basic block.
References is_terminator().
Referenced by is_terminator().
| bool LIEF::assembly::Instruction::is_trap | ( | ) | const |
| bool LIEF::assembly::Instruction::is_unconditional_branch | ( | ) | const |
True if the instruction is jumping (unconditionally) to some other basic block.
References is_unconditional_branch().
Referenced by is_unconditional_branch().
| const llvm::MCInst & LIEF::assembly::Instruction::mcinst | ( | ) | const |
Return the underlying llvm::MCInst implementation.
References LIEF_LIFETIMEBOUND, and mcinst().
Referenced by mcinst().
| MemoryAccess LIEF::assembly::Instruction::memory_access | ( | ) | const |
| std::string LIEF::assembly::Instruction::mnemonic | ( | ) | const |
| const std::vector< uint8_t > & LIEF::assembly::Instruction::raw | ( | ) | const |
Raw bytes of the current instruction.
References LIEF_LIFETIMEBOUND.
| size_t LIEF::assembly::Instruction::size | ( | ) | const |
Size of the instruction in bytes.
| std::string LIEF::assembly::Instruction::to_string | ( | bool | with_address = true | ) | const |
Representation of the current instruction in a pretty assembly way.
References to_string().
Referenced by operator<<, and to_string().