binaryninja.lowlevelil.LowLevelILFunction

class binaryninja.lowlevelil.LowLevelILFunction(arch, handle=None, source_func=None)[source]

class LowLevelILFunction contains the list of LowLevelILExpr objects that make up a function. LowLevelILExpr objects can be added to the LowLevelILFunction by calling append and passing the result of the various class methods which return LowLevelILExpr objects.

LowLevelILFlagCondition values used as parameters in the flag_condition method.

LowLevelILFlagCondition Operator Description
LLFC_E == Equal
LLFC_NE != Not equal
LLFC_SLT s< Signed less than
LLFC_ULT u< Unsigned less than
LLFC_SLE s<= Signed less than or equal
LLFC_ULE u<= Unsigned less than or equal
LLFC_SGE s>= Signed greater than or equal
LLFC_UGE u>= Unsigned greater than or equal
LLFC_SGT s> Signed greather than
LLFC_UGT u> Unsigned greater than
LLFC_NEG
Negative
LLFC_POS
Positive
LLFC_O overflow Overflow
LLFC_NO !overflow No overflow
__init__(arch, handle=None, source_func=None)[source]

Methods

__init__(arch[, handle, source_func])
add(size, a, b[, flags]) add adds expression a to expression b potentially setting flags flags and returning
add_carry(size, a, b, carry[, flags]) add_carry adds with carry expression a to expression b potentially setting flags flags and
add_label_for_address(arch, addr) add_label_for_address adds a low-level IL label for the given architecture arch at the given virtual
add_label_list(labels) add_label_list returns a label list expression for the given list of LowLevelILLabel objects.
add_operand_list(operands) add_operand_list returns an operand list expression for the given list of integer operands.
and_expr(size, a, b[, flags]) and_expr bitwise and’s expression a and expression b potentially setting flags flags
append(expr) append adds the LowLevelILExpr expr to the current LowLevelILFunction.
arith_shift_right(size, a, b[, flags]) arith_shift_right shifts arithmatic right expression a by expression b potentially setting flags
breakpoint() breakpoint returns a processor breakpoint expression.
call(dest) call returns an expression which first pushes the address of the next instruction onto the stack then jumps
clear_indirect_branches()
compare_equal(size, a, b) compare_equal returns comparison expression of size size checking if expression a is equal to
compare_not_equal(size, a, b) compare_not_equal returns comparison expression of size size checking if expression a is not equal to
compare_signed_greater_equal(size, a, b) compare_signed_greater_equal returns comparison expression of size size checking if expression a is
compare_signed_greater_than(size, a, b) compare_signed_greater_than returns comparison expression of size size checking if expression a is
compare_signed_less_equal(size, a, b) compare_signed_less_equal returns comparison expression of size size checking if expression a is
compare_signed_less_than(size, a, b) compare_signed_less_than returns comparison expression of size size checking if expression a is
compare_unsigned_greater_equal(size, a, b) compare_unsigned_greater_equal returns comparison expression of size size checking if expression a
compare_unsigned_greater_than(size, a, b) compare_unsigned_greater_than returns comparison expression of size size checking if expression a is
compare_unsigned_less_equal(size, a, b) compare_unsigned_less_equal returns comparison expression of size size checking if expression a is
compare_unsigned_less_than(size, a, b) compare_unsigned_less_than returns comparison expression of size size checking if expression a is
const(size, value) const returns an expression for the constant integer value with size size
const_pointer(size, value) const_pointer returns an expression for the constant pointer value with size size
div_double_prec_signed(size, hi, lo, b[, flags]) div_double_prec_signed signed double precision divide using expression hi and expression lo as a
div_double_prec_unsigned(size, hi, lo, b[, ...]) div_double_prec_unsigned unsigned double precision divide using expression hi and expression lo as
div_signed(size, a, b[, flags]) div_signed signed divide expression a by expression b potentially setting flags flags
div_unsigned(size, a, b[, flags]) div_unsigned unsigned divide expression a by expression b potentially setting flags flags
expr(operation[, a, b, c, d, size, flags])
finalize() finalize ends the function and computes the list of basic blocks.
flag(reg) flag returns a flag expression for the given flag name.
flag_bit(size, reg, bit) flag_bit sets the flag named reg and size size to the constant integer value bit
flag_condition(cond) flag_condition returns a flag_condition expression for the given LowLevelILFlagCondition
get_instruction_start(addr[, arch])
get_label_for_address(arch, addr) get_label_for_address returns the LowLevelILLabel for the given Architecture arch and IL address addr.
get_mapped_medium_level_il_expr_index(expr)
get_mapped_medium_level_il_instruction_index(instr)
get_non_ssa_instruction_index(instr)
get_ssa_flag_definition(flag_ssa)
get_ssa_flag_uses(flag_ssa)
get_ssa_flag_value(flag_ssa)
get_ssa_instruction_index(instr)
get_ssa_memory_definition(index)
get_ssa_memory_uses(index)
get_ssa_reg_definition(reg_ssa)
get_ssa_reg_uses(reg_ssa)
get_ssa_reg_value(reg_ssa)
goto(label) goto returns a goto expression which jumps to the provided LowLevelILLabel.
if_expr(operand, t, f) if_expr returns the if expression which depending on condition operand jumps to the LowLevelILLabel
jump(dest) jump returns an expression which jumps (branches) to the expression dest
load(size, addr) laod Reads size bytes from the expression addr
logical_shift_right(size, a, b[, flags]) logical_shift_right shifts logically right expression a by expression b potentially setting flags
low_part(size, value[, flags]) low_part truncates value to size bytes
mark_label(label) mark_label assigns a LowLevelILLabel to the current IL address.
mod_double_prec_signed(size, hi, lo, b[, flags]) mod_double_prec_signed signed double precision modulus using expression hi and expression lo as a single
mod_double_prec_unsigned(size, hi, lo, b[, ...]) mod_double_prec_unsigned unsigned double precision modulus using expression hi and expression lo as
mod_signed(size, a, b[, flags]) mod_signed signed modulus expression a by expression b potentially setting flags flags
mod_unsigned(size, a, b[, flags]) mod_unsigned unsigned modulus expression a by expression b potentially setting flags flags
mult(size, a, b[, flags]) mult multiplies expression a by expression b potentially setting flags flags and returning an
mult_double_prec_signed(size, a, b[, flags]) mult_double_prec_signed multiplies signed with double precision expression a by expression b
mult_double_prec_unsigned(size, a, b[, flags]) mult_double_prec_unsigned multiplies unsigned with double precision expression a by expression b
neg_expr(size, value[, flags]) neg_expr two’s complement sign negation of expression value of size size potentially setting flags
no_ret() no_ret returns an expression halts disassembly
nop() nop no operation, this instruction does nothing
not_expr(size, value[, flags]) not_expr bitwise inverse of expression value of size size potentially setting flags
operand(n, expr) operand sets the operand number of the expression expr and passes back expr without modification.
or_expr(size, a, b[, flags]) or_expr bitwise or’s expression a and expression b potentially setting flags flags
pop(size) pop reads size bytes from the stack, adjusting the stack by size.
push(size, value) push writes size bytes from expression value to the stack, adjusting the stack by size.
reg(size, reg) reg returns a register of size size with name name
ret(dest) ret returns an expression which jumps (branches) to the expression dest. ret is a special alias for
rotate_left(size, a, b[, flags]) rotate_left bitwise rotates left expression a by expression b potentially setting flags flags
rotate_left_carry(size, a, b, carry[, flags]) rotate_left_carry bitwise rotates left with carry expression a by expression b potentially setting
rotate_right(size, a, b[, flags]) rotate_right bitwise rotates right expression a by expression b potentially setting flags flags
rotate_right_carry(size, a, b, carry[, flags]) rotate_right_carry bitwise rotates right with carry expression a by expression b potentially setting
set_current_address(value[, arch])
set_flag(flag, value) set_flag sets the flag flag to the LowLevelILExpr value
set_indirect_branches(branches)
set_reg(size, reg, value[, flags]) set_reg sets the register reg of size size to the expression value
set_reg_split(size, hi, lo, value[, flags]) set_reg_split uses hi and lo as a single extended register setting hi:lo to the expression
shift_left(size, a, b[, flags]) shift_left subtracts with borrow expression b from expression a potentially setting flags flags
sign_extend(size, value[, flags]) sign_extend two’s complement sign-extends the expression in value to size bytes
store(size, addr, value) store Writes size bytes to expression addr read from expression value
sub(size, a, b[, flags]) sub subtracts expression b from expression a potentially setting flags flags and returning
sub_borrow(size, a, b, carry[, flags]) sub_borrow subtracts with borrow expression b from expression a potentially setting flags flags
system_call() system_call return a system call expression.
test_bit(size, a, b)
trap(value) trap returns a processor trap (interrupt) expression of the given integer value.
undefined() undefined returns the undefined expression. This should be used for instructions which perform functions but
unimplemented() unimplemented returns the unimplemented expression. This should be used for all instructions which aren’t
unimplemented_memory_ref(size, addr) unimplemented_memory_ref a memory reference to expression addr of size size with unimplemented operation.
xor_expr(size, a, b[, flags]) xor_expr xor’s expression a with expression b potentially setting flags flags
zero_extend(size, value[, flags]) zero_extend zero-extends the expression in value to size bytes

Attributes

basic_blocks list of LowLevelILBasicBlock objects (read-only)
current_address Current IL Address (read/write)
mapped_medium_level_il Medium level IL with mappings between low level IL and medium level IL.
medium_level_il Medium level IL for this low level IL.
non_ssa_form Low level IL in non-SSA (default) form (read-only)
ssa_form Low level IL in SSA form (read-only)
temp_flag_count Number of temporary flags (read-only)
temp_reg_count Number of temporary registers (read-only)