libTriton  version 1.0 build 1532
Public Member Functions | Protected Attributes | List of all members
triton::arch::Architecture Class Reference

The abstract architecture class. More...

#include <architecture.hpp>

Public Member Functions

TRITON_EXPORT Architecture (triton::callbacks::Callbacks *callbacks=nullptr)
 Constructor. More...
 
TRITON_EXPORT bool isFlag (triton::arch::register_e regId) const
 Returns true if the register ID is a flag. More...
 
TRITON_EXPORT bool isFlag (const triton::arch::Register &reg) const
 Returns true if the register is a flag. More...
 
TRITON_EXPORT bool isRegister (triton::arch::register_e regId) const
 Returns true if the register ID is a register. More...
 
TRITON_EXPORT bool isRegister (const triton::arch::Register &reg) const
 Returns true if the register is a register. More...
 
TRITON_EXPORT bool isRegisterValid (triton::arch::register_e regId) const
 Returns true if the register ID is a register or a flag. More...
 
TRITON_EXPORT bool isRegisterValid (const triton::arch::Register &reg) const
 Returns true if the register is a register or a flag. More...
 
TRITON_EXPORT bool isValid (void) const
 Returns true if the architecture is valid. More...
 
TRITON_EXPORT bool isThumb (void) const
 Returns true if the execution mode is Thumb. Only valid for Arm32. More...
 
TRITON_EXPORT void setThumb (bool state)
 Sets CPU state to Thumb mode. Only valid for Arm32. More...
 
TRITON_EXPORT bool isMemoryExclusiveAccess (void) const
 Returns true if the exclusive memory access flag is set. Only valid for Arm32. More...
 
TRITON_EXPORT void setMemoryExclusiveAccess (bool state)
 Sets exclusive memory access flag. Only valid for Arm32. More...
 
TRITON_EXPORT triton::arch::architecture_e getArchitecture (void) const
 Returns the kind of architecture as triton::arch::architecture_e. More...
 
TRITON_EXPORT triton::arch::endianness_e getEndianness (void) const
 Returns the kind of endianness as triton::arch::endianness_e. More...
 
TRITON_EXPORT triton::arch::CpuInterfacegetCpuInstance (void)
 Returns the instance of the current CPU used. More...
 
TRITON_EXPORT triton::uint32 numberOfRegisters (void) const
 Returns the number of registers according to the CPU architecture. More...
 
TRITON_EXPORT triton::uint32 gprBitSize (void) const
 Returns the bit in bit of the General Purpose Registers. More...
 
TRITON_EXPORT triton::uint32 gprSize (void) const
 Returns the bit in byte of the General Purpose Registers. More...
 
TRITON_EXPORT void setArchitecture (triton::arch::architecture_e arch)
 Initializes an architecture. More...
 
TRITON_EXPORT void clearArchitecture (void)
 Clears the architecture states (registers and memory). More...
 
TRITON_EXPORT const std::unordered_map< triton::arch::register_e, const triton::arch::Register > & getAllRegisters (void) const
 Returns all registers. More...
 
TRITON_EXPORT std::set< const triton::arch::Register * > getParentRegisters (void) const
 Returns all parent registers. More...
 
TRITON_EXPORT const triton::arch::RegistergetRegister (triton::arch::register_e id) const
 Returns register from id. More...
 
TRITON_EXPORT const triton::arch::RegistergetRegister (const std::string &name) const
 Returns register from name. More...
 
TRITON_EXPORT const triton::arch::RegistergetParentRegister (triton::arch::register_e id) const
 Returns parent register from id. More...
 
TRITON_EXPORT const triton::arch::RegistergetParentRegister (const triton::arch::Register &reg) const
 Returns parent register from register. More...
 
TRITON_EXPORT const triton::arch::RegistergetProgramCounter (void) const
 Returns the program counter register. More...
 
TRITON_EXPORT const triton::arch::RegistergetStackPointer (void) const
 Returns the stack pointer register. More...
 
TRITON_EXPORT const triton::arch::Instruction getNopInstruction (void) const
 Returns a NOP instruction according to the architecture. More...
 
TRITON_EXPORT void disassembly (triton::arch::Instruction &inst) const
 Disassembles the instruction according to the architecture. More...
 
TRITON_EXPORT void disassembly (triton::arch::BasicBlock &block, triton::uint64 addr=0) const
 Disassembles a block of instructions according to the architecture. More...
 
TRITON_EXPORT std::vector< triton::arch::Instructiondisassembly (triton::uint64 addr, triton::usize count) const
 Disassembles a concrete memory area and returns a list of at most count disassembled instructions. More...
 
TRITON_EXPORT triton::arch::BasicBlock disassembly (triton::uint64 addr) const
 Disassembles a concrete memory area from addr to control flow instruction and returns a BasicBlock. More...
 
TRITON_EXPORT triton::uint8 getConcreteMemoryValue (triton::uint64 addr, bool execCallbacks=true) const
 Returns the concrete value of a memory cell. More...
 
TRITON_EXPORT triton::uint512 getConcreteMemoryValue (const triton::arch::MemoryAccess &mem, bool execCallbacks=true) const
 Returns the concrete value of memory cells. More...
 
TRITON_EXPORT std::vector< triton::uint8getConcreteMemoryAreaValue (triton::uint64 baseAddr, triton::usize size, bool execCallbacks=true) const
 Returns the concrete value of a memory area. More...
 
TRITON_EXPORT triton::uint512 getConcreteRegisterValue (const triton::arch::Register &reg, bool execCallbacks=true) const
 Returns the concrete value of a register. More...
 
TRITON_EXPORT void setConcreteMemoryValue (triton::uint64 addr, triton::uint8 value)
 [architecture api] - Sets the concrete value of a memory cell. More...
 
TRITON_EXPORT void setConcreteMemoryValue (const triton::arch::MemoryAccess &mem, const triton::uint512 &value)
 [architecture api] - Sets the concrete value of memory cells. More...
 
TRITON_EXPORT void setConcreteMemoryAreaValue (triton::uint64 baseAddr, const std::vector< triton::uint8 > &values)
 [architecture api] - Sets the concrete value of a memory area. More...
 
TRITON_EXPORT void setConcreteMemoryAreaValue (triton::uint64 baseAddr, const triton::uint8 *area, triton::usize size)
 [architecture api] - Sets the concrete value of a memory area. More...
 
TRITON_EXPORT void setConcreteRegisterValue (const triton::arch::Register &reg, const triton::uint512 &value)
 [architecture api] - Sets the concrete value of a register. More...
 
TRITON_EXPORT bool isConcreteMemoryValueDefined (const triton::arch::MemoryAccess &mem) const
 Returns true if memory cells have a defined concrete value. More...
 
TRITON_EXPORT bool isConcreteMemoryValueDefined (triton::uint64 baseAddr, triton::usize size=1) const
 Returns true if memory cells have a defined concrete value. More...
 
TRITON_EXPORT void clearConcreteMemoryValue (const triton::arch::MemoryAccess &mem)
 Clears concrete values assigned to the memory cells. More...
 
TRITON_EXPORT void clearConcreteMemoryValue (triton::uint64 baseAddr, triton::usize size=1)
 Clears concrete values assigned to the memory cells. More...
 

Protected Attributes

triton::arch::architecture_e arch
 The kind of architecture used. More...
 
std::unique_ptr< triton::arch::CpuInterfacecpu
 Instance to the real CPU class. More...
 

Detailed Description

The abstract architecture class.

Definition at line 45 of file architecture.hpp.

Constructor & Destructor Documentation

◆ Architecture()

triton::arch::Architecture::Architecture ( triton::callbacks::Callbacks callbacks = nullptr)

Constructor.

Definition at line 25 of file architecture.cpp.

Member Function Documentation

◆ clearArchitecture()

void triton::arch::Architecture::clearArchitecture ( void  )

Clears the architecture states (registers and memory).

Definition at line 70 of file architecture.cpp.

◆ clearConcreteMemoryValue() [1/2]

void triton::arch::Architecture::clearConcreteMemoryValue ( const triton::arch::MemoryAccess mem)

Clears concrete values assigned to the memory cells.

Definition at line 358 of file architecture.cpp.

◆ clearConcreteMemoryValue() [2/2]

void triton::arch::Architecture::clearConcreteMemoryValue ( triton::uint64  baseAddr,
triton::usize  size = 1 
)

Clears concrete values assigned to the memory cells.

Definition at line 365 of file architecture.cpp.

◆ disassembly() [1/4]

void triton::arch::Architecture::disassembly ( triton::arch::BasicBlock block,
triton::uint64  addr = 0 
) const

Disassembles a block of instructions according to the architecture.

Definition at line 232 of file architecture.cpp.

◆ disassembly() [2/4]

void triton::arch::Architecture::disassembly ( triton::arch::Instruction inst) const

Disassembles the instruction according to the architecture.

Definition at line 225 of file architecture.cpp.

◆ disassembly() [3/4]

triton::arch::BasicBlock triton::arch::Architecture::disassembly ( triton::uint64  addr) const

Disassembles a concrete memory area from addr to control flow instruction and returns a BasicBlock.

Definition at line 263 of file architecture.cpp.

◆ disassembly() [4/4]

std::vector< triton::arch::Instruction > triton::arch::Architecture::disassembly ( triton::uint64  addr,
triton::usize  count 
) const

Disassembles a concrete memory area and returns a list of at most count disassembled instructions.

Definition at line 244 of file architecture.cpp.

◆ getAllRegisters()

const std::unordered_map< triton::arch::register_e, const triton::arch::Register > & triton::arch::Architecture::getAllRegisters ( void  ) const

Returns all registers.

Definition at line 169 of file architecture.cpp.

◆ getArchitecture()

triton::arch::architecture_e triton::arch::Architecture::getArchitecture ( void  ) const

Returns the kind of architecture as triton::arch::architecture_e.

Definition at line 31 of file architecture.cpp.

◆ getConcreteMemoryAreaValue()

std::vector< triton::uint8 > triton::arch::Architecture::getConcreteMemoryAreaValue ( triton::uint64  baseAddr,
triton::usize  size,
bool  execCallbacks = true 
) const

Returns the concrete value of a memory area.

Definition at line 295 of file architecture.cpp.

◆ getConcreteMemoryValue() [1/2]

triton::uint512 triton::arch::Architecture::getConcreteMemoryValue ( const triton::arch::MemoryAccess mem,
bool  execCallbacks = true 
) const

Returns the concrete value of memory cells.

Definition at line 288 of file architecture.cpp.

◆ getConcreteMemoryValue() [2/2]

triton::uint8 triton::arch::Architecture::getConcreteMemoryValue ( triton::uint64  addr,
bool  execCallbacks = true 
) const

Returns the concrete value of a memory cell.

Definition at line 281 of file architecture.cpp.

◆ getConcreteRegisterValue()

triton::uint512 triton::arch::Architecture::getConcreteRegisterValue ( const triton::arch::Register reg,
bool  execCallbacks = true 
) const

Returns the concrete value of a register.

Definition at line 302 of file architecture.cpp.

◆ getCpuInstance()

triton::arch::CpuInterface * triton::arch::Architecture::getCpuInstance ( void  )

Returns the instance of the current CPU used.

Definition at line 43 of file architecture.cpp.

◆ getEndianness()

triton::arch::endianness_e triton::arch::Architecture::getEndianness ( void  ) const

Returns the kind of endianness as triton::arch::endianness_e.

Definition at line 36 of file architecture.cpp.

◆ getNopInstruction()

const triton::arch::Instruction triton::arch::Architecture::getNopInstruction ( void  ) const

Returns a NOP instruction according to the architecture.

Definition at line 372 of file architecture.cpp.

◆ getParentRegister() [1/2]

const triton::arch::Register & triton::arch::Architecture::getParentRegister ( const triton::arch::Register reg) const

Returns parent register from register.

Definition at line 211 of file architecture.cpp.

◆ getParentRegister() [2/2]

const triton::arch::Register & triton::arch::Architecture::getParentRegister ( triton::arch::register_e  id) const

Returns parent register from id.

Definition at line 218 of file architecture.cpp.

◆ getParentRegisters()

std::set< const triton::arch::Register * > triton::arch::Architecture::getParentRegisters ( void  ) const

Returns all parent registers.

Definition at line 176 of file architecture.cpp.

◆ getProgramCounter()

const triton::arch::Register & triton::arch::Architecture::getProgramCounter ( void  ) const

Returns the program counter register.

Definition at line 183 of file architecture.cpp.

◆ getRegister() [1/2]

const triton::arch::Register & triton::arch::Architecture::getRegister ( const std::string &  name) const

Returns register from name.

Definition at line 204 of file architecture.cpp.

◆ getRegister() [2/2]

const triton::arch::Register & triton::arch::Architecture::getRegister ( triton::arch::register_e  id) const

Returns register from id.

Definition at line 197 of file architecture.cpp.

◆ getStackPointer()

const triton::arch::Register & triton::arch::Architecture::getStackPointer ( void  ) const

Returns the stack pointer register.

Definition at line 190 of file architecture.cpp.

◆ gprBitSize()

triton::uint32 triton::arch::Architecture::gprBitSize ( void  ) const

Returns the bit in bit of the General Purpose Registers.

Definition at line 162 of file architecture.cpp.

◆ gprSize()

triton::uint32 triton::arch::Architecture::gprSize ( void  ) const

Returns the bit in byte of the General Purpose Registers.

Definition at line 155 of file architecture.cpp.

◆ isConcreteMemoryValueDefined() [1/2]

bool triton::arch::Architecture::isConcreteMemoryValueDefined ( const triton::arch::MemoryAccess mem) const

Returns true if memory cells have a defined concrete value.

Definition at line 344 of file architecture.cpp.

◆ isConcreteMemoryValueDefined() [2/2]

bool triton::arch::Architecture::isConcreteMemoryValueDefined ( triton::uint64  baseAddr,
triton::usize  size = 1 
) const

Returns true if memory cells have a defined concrete value.

Definition at line 351 of file architecture.cpp.

◆ isFlag() [1/2]

bool triton::arch::Architecture::isFlag ( const triton::arch::Register reg) const

Returns true if the register is a flag.

Definition at line 91 of file architecture.cpp.

◆ isFlag() [2/2]

bool triton::arch::Architecture::isFlag ( triton::arch::register_e  regId) const

Returns true if the register ID is a flag.

Definition at line 84 of file architecture.cpp.

◆ isMemoryExclusiveAccess()

bool triton::arch::Architecture::isMemoryExclusiveAccess ( void  ) const

Returns true if the exclusive memory access flag is set. Only valid for Arm32.

Definition at line 134 of file architecture.cpp.

◆ isRegister() [1/2]

bool triton::arch::Architecture::isRegister ( const triton::arch::Register reg) const

Returns true if the register is a register.

Definition at line 103 of file architecture.cpp.

◆ isRegister() [2/2]

bool triton::arch::Architecture::isRegister ( triton::arch::register_e  regId) const

Returns true if the register ID is a register.

Definition at line 96 of file architecture.cpp.

◆ isRegisterValid() [1/2]

bool triton::arch::Architecture::isRegisterValid ( const triton::arch::Register reg) const

Returns true if the register is a register or a flag.

Definition at line 115 of file architecture.cpp.

◆ isRegisterValid() [2/2]

bool triton::arch::Architecture::isRegisterValid ( triton::arch::register_e  regId) const

Returns true if the register ID is a register or a flag.

Definition at line 108 of file architecture.cpp.

◆ isThumb()

bool triton::arch::Architecture::isThumb ( void  ) const

Returns true if the execution mode is Thumb. Only valid for Arm32.

Definition at line 120 of file architecture.cpp.

◆ isValid()

bool triton::arch::Architecture::isValid ( void  ) const

Returns true if the architecture is valid.

Definition at line 77 of file architecture.cpp.

◆ numberOfRegisters()

triton::uint32 triton::arch::Architecture::numberOfRegisters ( void  ) const

Returns the number of registers according to the CPU architecture.

Definition at line 148 of file architecture.cpp.

◆ setArchitecture()

void triton::arch::Architecture::setArchitecture ( triton::arch::architecture_e  arch)

Initializes an architecture.

Definition at line 50 of file architecture.cpp.

◆ setConcreteMemoryAreaValue() [1/2]

void triton::arch::Architecture::setConcreteMemoryAreaValue ( triton::uint64  baseAddr,
const std::vector< triton::uint8 > &  values 
)

[architecture api] - Sets the concrete value of a memory area.

Note that by setting a concrete value will probably imply a desynchronization with the symbolic state (if it exists). You should probably use the concretize functions after this.

Definition at line 323 of file architecture.cpp.

◆ setConcreteMemoryAreaValue() [2/2]

void triton::arch::Architecture::setConcreteMemoryAreaValue ( triton::uint64  baseAddr,
const triton::uint8 area,
triton::usize  size 
)

[architecture api] - Sets the concrete value of a memory area.

Note that by setting a concrete value will probably imply a desynchronization with the symbolic state (if it exists). You should probably use the concretize functions after this.

Definition at line 330 of file architecture.cpp.

◆ setConcreteMemoryValue() [1/2]

void triton::arch::Architecture::setConcreteMemoryValue ( const triton::arch::MemoryAccess mem,
const triton::uint512 value 
)

[architecture api] - Sets the concrete value of memory cells.

Note that by setting a concrete value will probably imply a desynchronization with the symbolic state (if it exists). You should probably use the concretize functions after this.

Definition at line 316 of file architecture.cpp.

◆ setConcreteMemoryValue() [2/2]

void triton::arch::Architecture::setConcreteMemoryValue ( triton::uint64  addr,
triton::uint8  value 
)

[architecture api] - Sets the concrete value of a memory cell.

Note that by setting a concrete value will probably imply a desynchronization with the symbolic state (if it exists). You should probably use the concretize functions after this.

Definition at line 309 of file architecture.cpp.

◆ setConcreteRegisterValue()

void triton::arch::Architecture::setConcreteRegisterValue ( const triton::arch::Register reg,
const triton::uint512 value 
)

[architecture api] - Sets the concrete value of a register.

Note that by setting a concrete value will probably imply a desynchronization with the symbolic state (if it exists). You should probably use the concretize functions after this.

Definition at line 337 of file architecture.cpp.

◆ setMemoryExclusiveAccess()

void triton::arch::Architecture::setMemoryExclusiveAccess ( bool  state)

Sets exclusive memory access flag. Only valid for Arm32.

Definition at line 141 of file architecture.cpp.

◆ setThumb()

void triton::arch::Architecture::setThumb ( bool  state)

Sets CPU state to Thumb mode. Only valid for Arm32.

Definition at line 127 of file architecture.cpp.

Member Data Documentation

◆ arch

triton::arch::architecture_e triton::arch::Architecture::arch
protected

The kind of architecture used.

Definition at line 52 of file architecture.hpp.

◆ cpu

std::unique_ptr<triton::arch::CpuInterface> triton::arch::Architecture::cpu
protected

Instance to the real CPU class.

Definition at line 55 of file architecture.hpp.


The documentation for this class was generated from the following files: