libTriton version 1.0 build 1592
Loading...
Searching...
No Matches
MemoryAccess

[python api] All information about the memory access Python object.

Description


This object is used to represent a memory access.

Example

>>> ctxt.processing(inst)
0
>>> print(inst)
0x40000: mov ah, byte ptr [rdx + rcx*2 + 0x100]
>>> op1 = inst.getOperands()[1]
>>> print(op1)
[@0x100]:8 bv[7..0]
>>> print(op1.getBaseRegister())
rdx:64 bv[63..0]
>>> print(op1.getIndexRegister())
rcx:64 bv[63..0]
>>> print(op1.getScale())
0x2:64 bv[63..0]
>>> print(op1.getDisplacement())
0x100:64 bv[63..0]
>>> print(op1.getLeaAst())
(bvadd (bvadd (_ bv0 64) (bvmul (_ bv0 64) (_ bv2 64))) (_ bv256 64))
>>> print(hex(op1.getLeaAst().evaluate()))
0x100
>>> print(hex(op1.getAddress()))
0x100
>>> print(op1.getSize())
1

Constructor

>>> mem = MemoryAccess(0x400f4d3, 8)
>>> print(mem)
[@0x400f4d3]:64 bv[63..0]
>>> hex(mem.getAddress())
'0x400f4d3'
>>> mem.getSize()
8

Python API - Methods of the MemoryAccess class


  • integer getAddress(void)
    Returns the target address of the memory access.
    e.g: 0x7fffdd745ae0
  • Register getBaseRegister(void)
    Returns the base register (if exists) of the memory access.
  • integer getBitSize(void)
    Returns the size (in bits) of the memory access.
    e.g: 64
  • BitsVector getBitvector(void)
    Returns the bit vector of the memory cells.
  • Immediate getDisplacement(void)
    Returns the displacement (if exists) of the memory access.
  • Register getIndexRegister(void)
    Returns the index register (if exists) of the memory access.
  • AstNode getLeaAst(void)
    Returns the AST of the memory access (LEA).
  • Immediate getScale(void)
    Returns the scale (if exists) of the memory access.
  • Register getSegmentRegister(void)
    Returns the segment register (if exists) of the memory access. Note that to be user-friendly, the segment register is used as base register and not as a selector into the GDT.
  • integer getSize(void)
    Returns the size (in bytes) of the memory access.
    e.g: 8
  • OPERAND getType(void)
    Returns the type of the memory access. In this case this function returns OPERAND.MEM.
  • bool isOverlapWith(MemoryAccess other)
    Returns true if other and self overlap.
  • void setBaseRegister(Register reg)
    Sets the base register of the memory access.
  • void setDisplacement(Immediate imm)
    Sets the displacement of the memory access.
  • void setIndexRegister(Register reg)
    Sets the index register of the memory access.
  • void setScale(Immediate imm)
    Sets the scale of the memory access.