miasm
Reverse engineering framework
miasm.core.types.Type Class Reference
Inheritance diagram for miasm.core.types.Type:
Collaboration diagram for miasm.core.types.Type:

Public Member Functions

def set (self, vm, addr, val)
 
def get (self, vm, addr)
 
def lval (self)
 
def size (self)
 
def __len__ (self)
 
def __neq__ (self, other)
 
def __eq__ (self, other)
 
def __ne__ (self, other)
 

Detailed Description

Base class to provide methods to describe a type, as well as how to set
and get fields from virtual mem.

Each Type subclass is linked to a MemType subclass (e.g. Struct to
MemStruct, Ptr to MemPtr, etc.).

When nothing is specified, MemValue is used to access the type in memory.
MemValue instances have one `.val` field, setting and getting it call
the set and get of the Type.

Subclasses can either override _pack and _unpack, or get and set if data
serialization requires more work (see Struct implementation for an example).

TODO: move any trace of vm and addr out of these classes?

Member Function Documentation

◆ __eq__()

def miasm.core.types.Type.__eq__ (   self,
  other 
)

◆ __len__()

def miasm.core.types.Type.__len__ (   self)
Here is the call graph for this function:

◆ __ne__()

◆ __neq__()

def miasm.core.types.Type.__neq__ (   self,
  other 
)

◆ get()

def miasm.core.types.Type.get (   self,
  vm,
  addr 
)
Get the python value of a field from a VmMngr memory at @addr.

Reimplemented in miasm.core.types.Str, miasm.core.types.Bits, miasm.core.types.Array, miasm.core.types.Struct, and miasm.core.types.Ptr.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ lval()

def miasm.core.types.Type.lval (   self)
Returns a class with a (vm, addr) constructor that allows to
interact with this type in memory.

In compilation terms, it returns a class allowing to instantiate an
lvalue of this type.

@return: a MemType subclass.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ set()

def miasm.core.types.Type.set (   self,
  vm,
  addr,
  val 
)
Set a VmMngr memory from a value.

@vm: VmMngr instance
@addr: the start address in memory to set
@val: the python value to serialize in @vm at @addr

Reimplemented in miasm.core.types.BitField, miasm.core.types.Bits, miasm.core.types.Array, miasm.core.types.Struct, miasm.core.types.Ptr, and miasm.core.types.Str.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ size()

def miasm.core.types.Type.size (   self)
Return the size in bytes of the serialized version of this field

Reimplemented in miasm.core.types.Str, miasm.core.types.Bits, miasm.core.types.Array, miasm.core.types.Union, miasm.core.types.Struct, and miasm.core.types.RawStruct.

Here is the caller graph for this function:

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