angr.knowledge_plugins.key_definitions.atoms¶
- class angr.knowledge_plugins.key_definitions.atoms.AtomKind¶
Bases:
EnumAn enum indicating the class of an atom
- REGISTER = 1¶
- MEMORY = 2¶
- TMP = 3¶
- GUARD = 4¶
- CONSTANT = 5¶
- class angr.knowledge_plugins.key_definitions.atoms.Atom¶
Bases:
objectThis class represents a data storage location manipulated by IR instructions.
It could either be a Tmp (temporary variable), a Register, a MemoryLocation.
- __init__(size)¶
- Parameters:
size – The size of the atom in bytes
- size
- static from_ail_expr(expr, arch, full_reg=False)¶
- Return type:
- Parameters:
expr (Expression)
arch (Arch)
full_reg (bool)
- static from_argument(argument, arch, full_reg=False, sp=None)¶
Instantiate an Atom from a given argument.
- Parameters:
argument (
SimFunctionArgument) – The argument to create a new atom from.arch (
Arch) – The argument representing archinfo architecture for argument.full_reg – Whether to return an atom indicating the entire register if the argument only specifies a slice of the register.
sp (
int|None) – The current stack offset. Optional. Only used when argument is a SimStackArg.
- Return type:
- static reg(thing, size=None, arch=None)¶
Create a Register atom.
- Parameters:
thing (
str|RegisterOffset) – The register offset (e.g., project.arch.registers[“rax”][0]) or the register name (e.g., “rax”).size (
int|None) – Size of the register atom. Must be provided when creating the atom using a register offset.arch (
Arch|None) – The architecture. Must be provided when creating the atom using a register name.
- Return type:
- Returns:
The Register Atom object.
- static register(thing, size=None, arch=None)¶
Create a Register atom.
- Parameters:
thing (
str|RegisterOffset) – The register offset (e.g., project.arch.registers[“rax”][0]) or the register name (e.g., “rax”).size (
int|None) – Size of the register atom. Must be provided when creating the atom using a register offset.arch (
Arch|None) – The architecture. Must be provided when creating the atom using a register name.
- Return type:
- Returns:
The Register Atom object.
- static mem(addr, size, endness=None)¶
Create a MemoryLocation atom,
- Parameters:
- Return type:
- Returns:
The MemoryLocation Atom object.
- static memory(addr, size, endness=None)¶
Create a MemoryLocation atom,
- Parameters:
- Return type:
- Returns:
The MemoryLocation Atom object.
- class angr.knowledge_plugins.key_definitions.atoms.GuardUse¶
Bases:
AtomImplements a guard use.
- target
- class angr.knowledge_plugins.key_definitions.atoms.ConstantSrc¶
Bases:
AtomRepresents a constant.
- value: int
- class angr.knowledge_plugins.key_definitions.atoms.Tmp¶
Bases:
AtomRepresents a variable used by the IR to store intermediate values.
- tmp_idx
- class angr.knowledge_plugins.key_definitions.atoms.Register¶
Bases:
AtomRepresents a given CPU register.
As an IR abstracts the CPU design to target different architectures, registers are represented as a separated memory space. Thus a register is defined by its offset from the base of this memory and its size.
- Variables:
- reg_offset
- arch
- class angr.knowledge_plugins.key_definitions.atoms.VirtualVariable¶
Bases:
AtomRepresents a virtual variable.
- varid
- category
- oident
- class angr.knowledge_plugins.key_definitions.atoms.MemoryLocation¶
Bases:
AtomRepresents a memory slice.
It is characterized by its address and its size.
- __init__(addr, size, endness=None)¶
- Parameters:
addr (
SpOffset|HeapAddress|int) – The address of the beginning memory location slice.size (
int) – The size of the represented memory location, in bytes.endness (Endness | None)
- endness