binaryninja.function.Function

class Function(view=None, handle=None)[source]
__init__(view=None, handle=None)[source]

Initialize self. See help(type(self)) for accurate signature.

Methods

__init__([view, handle])

Initialize self.

add_auto_address_tag(addr, tag[, arch])

add_auto_address_tag adds an already-created Tag object at a given address.

add_auto_function_tag(tag)

add_user_function_tag adds an already-created Tag object as a function tag.

add_user_address_tag(addr, tag[, arch])

add_user_address_tag adds an already-created Tag object at a given address.

add_user_code_ref(from_addr, to_addr[, …])

add_user_code_ref places a user-defined cross-reference from the instruction at the given address and architecture to the specified target address.

add_user_function_tag(tag)

add_user_function_tag adds an already-created Tag object as a function tag.

add_user_type_field_ref(from_addr, name, offset)

add_user_type_field_ref places a user-defined type field cross-reference from the instruction at the given address and architecture to the specified type.

add_user_type_ref(from_addr, name[, from_arch])

add_user_type_ref places a user-defined type cross-reference from the instruction at the given address and architecture to the specified type.

apply_auto_discovered_type(func_type)

apply_imported_types(sym[, type])

clear_all_user_var_values()

Clear all user defined variable values.

clear_user_var_value(var, def_addr)

Clears a previously defined user variable value.

create_auto_address_tag(addr, type, data[, …])

create_auto_address_tag creates and adds a Tag object at a given address.

create_auto_function_tag(type, data[, unique])

add_user_function_tag creates and adds a Tag object as a function tag.

create_auto_stack_var(offset, var_type, name)

create_auto_tag(type, data)

create_auto_var(var, var_type, name[, …])

create_graph([graph_type, settings])

create_tag(type, data[, user])

create_tag creates a new Tag object but does not add it anywhere.

create_user_address_tag(addr, type, data[, …])

create_user_address_tag creates and adds a Tag object at a given address.

create_user_function_tag(type, data[, unique])

add_user_function_tag creates and adds a Tag object as a function tag.

create_user_stack_var(offset, var_type, name)

create_user_tag(type, data)

create_user_var(var, var_type, name[, …])

delete_auto_stack_var(offset)

delete_auto_var(var)

delete_user_stack_var(offset)

delete_user_var(var)

get_address_tags_at(addr[, arch])

get_address_tags_at gets a list of all Tags in the function at a given address.

get_all_user_var_values()

Returns a map of current defined user variable values.

get_basic_block_at(addr[, arch])

get_basic_block_at returns the BasicBlock of the optionally specified Architecture arch at the given address addr.

get_block_annotations(addr[, arch])

get_call_reg_stack_adjustment(addr[, arch])

get_call_reg_stack_adjustment_for_reg_stack(…)

get_call_stack_adjustment(addr[, arch])

get_call_type_adjustment(addr[, arch])

get_comment_at(addr)

get_constants_referenced_by(addr[, arch])

get_flags_read_by_lifted_il_instruction(i)

get_flags_written_by_lifted_il_instruction(i)

get_hlil_var_refs(var)

get_hlil_var_refs returns a list of ILReferenceSource objects (IL xrefs or cross-references) that reference the given variable.

get_hlil_var_refs_from(addr[, length, arch])

get_hlil_var_refs_from returns a list of variables referenced by code in the function func, of the architecture arch, and at the address addr.

get_indirect_branches_at(addr[, arch])

get_instr_highlight(addr[, arch])

Example

get_instruction_containing_address(addr[, arch])

get_int_display_type(instr_addr, value, operand)

get_lifted_il_at(addr[, arch])

get_lifted_il_flag_definitions_for_use(i, flag)

get_lifted_il_flag_uses_for_definition(i, flag)

get_lifted_ils_at(addr[, arch])

get_lifted_ils_at gets the Lifted IL Instruction(s) corresponding to the given virtual address

get_llil_at(addr[, arch])

get_llil_at gets the LowLevelILInstruction corresponding to the given virtual address

get_llils_at(addr[, arch])

get_llils_at gets the LowLevelILInstruction(s) corresponding to the given virtual address

get_low_level_il_at(addr[, arch])

get_low_level_il_at gets the LowLevelILInstruction corresponding to the given virtual address

get_low_level_il_exits_at(addr[, arch])

get_mlil_var_refs(var)

get_mlil_var_refs returns a list of ILReferenceSource objects (IL xrefs or cross-references) that reference the given variable.

get_mlil_var_refs_from(addr[, length, arch])

get_mlil_var_refs_from returns a list of variables referenced by code in the function func, of the architecture arch, and at the address addr.

get_parameter_at(addr, func_type, i[, arch])

get_parameter_at_low_level_il_instruction(…)

get_reg_value_after(addr, reg[, arch])

get_reg_value_after gets the value instruction address corresponding to the given virtual address

get_reg_value_at(addr, reg[, arch])

get_reg_value_at gets the value the provided string register address corresponding to the given virtual address

get_reg_value_at_exit(reg)

get_regs_read_by(addr[, arch])

get_regs_written_by(addr[, arch])

get_stack_contents_after(addr, offset, size)

get_stack_contents_at(addr, offset, size[, arch])

get_stack_contents_at returns the RegisterValue for the item on the stack in the current function at the given virtual address addr, stack offset offset and size of size.

get_stack_var_at_frame_offset(offset, addr)

get_stack_vars_referenced_by(addr[, arch])

get_type_tokens([settings])

is_call_instruction(addr[, arch])

is_var_user_defined(var)

mark_recent_use()

reanalyze()

reanalyze causes this functions to be reanalyzed.

release_advanced_analysis_data()

remove_auto_address_tag(addr, tag[, arch])

remove_auto_address_tag removes a Tag object at a given address.

remove_auto_function_tag(tag)

remove_user_function_tag removes a Tag object as a function tag.

remove_user_address_tag(addr, tag[, arch])

remove_user_address_tag removes a Tag object at a given address.

remove_user_code_ref(from_addr, to_addr[, …])

remove_user_code_ref removes a user-defined cross-reference.

remove_user_function_tag(tag)

remove_user_function_tag removes a Tag object as a function tag.

remove_user_type_field_ref(from_addr, name, …)

remove_user_type_field_ref removes a user-defined type field cross-reference.

remove_user_type_ref(from_addr, name[, …])

remove_user_type_ref removes a user-defined type cross-reference.

request_advanced_analysis_data()

request_debug_report(name)

request_debug_report can generate interanl debug reports for a variety of analysis.

set_auto_call_reg_stack_adjustment(addr, adjust)

set_auto_call_reg_stack_adjustment_for_reg_stack(…)

set_auto_call_stack_adjustment(addr, adjust)

set_auto_calling_convention(value)

set_auto_can_return(value)

set_auto_clobbered_regs(value)

set_auto_has_variable_arguments(value)

set_auto_indirect_branches(source, branches)

set_auto_instr_highlight(addr, color[, arch])

set_auto_instr_highlight highlights the instruction at the specified address with the supplied color

set_auto_parameter_vars(value)

set_auto_reg_stack_adjustments(value)

set_auto_return_regs(value)

set_auto_return_type(value)

set_auto_stack_adjustment(value)

set_auto_type(value)

set_call_reg_stack_adjustment(addr, adjust)

set_call_reg_stack_adjustment_for_reg_stack(…)

set_call_stack_adjustment(addr, adjust[, arch])

set_call_type_adjustment(addr, adjust_type)

set_comment(addr, comment)

Deprecated method provided for compatibility.

set_comment_at(addr, comment)

set_comment_at sets a comment for the current function at the address specified

set_default_session_data(name, value)

set_int_display_type(instr_addr, value, …)

param int instr_addr

set_user_indirect_branches(source, branches)

set_user_instr_highlight(addr, color[, arch])

set_user_instr_highlight highlights the instruction at the specified address with the supplied color

set_user_type(value)

set_user_var_value(var, def_addr, value)

set_user_var_value allows the user to specify a PossibleValueSet value for an MLIL variable at its definition site.

Attributes

address_ranges

All of the address ranges covered by a function

address_tags

address_tags gets a list of all address Tags in the function.

analysis_performance_info

analysis_skip_override

Override for skipping of automatic analysis

analysis_skip_reason

Function analysis skip reason

analysis_skipped

Whether automatic analysis was skipped for this function, set to true to disable analysis.

arch

Function architecture (read-only)

auto

Whether function was automatically discovered (read-only)

basic_blocks

List of basic blocks (read-only)

call_sites

call_sites returns a list of possible call sites contained in this function.

callee_addresses

callee_addressses returns a list of start addresses for functions that call this function.

callees

callees returns a list of functions that this function calls This does not include the address of those calls, rather just the function objects themselves.

callers

callers returns a list of functions that call this function Does not point to the actual address where the call occurs, just the start of the function that contains the call.

calling_convention

Calling convention used by the function

can_return

Whether function can return

clobbered_regs

Registers that are modified by this function

comment

Gets the comment for the current function

comments

Dict of comments (read-only)

explicitly_defined_type

Whether function has explicitly defined types (read-only)

function_tags

function_tags gets a list of all function Tags for the function.

function_type

Function type object, can be set with either a string representing the function prototype (str(function) shows examples) or a Type object

global_pointer_value

Discovered value of the global pointer register, if the function uses one (read-only)

has_unresolved_indirect_branches

Has unresolved indirect branches (read-only)

has_variable_arguments

Whether the function takes a variable number of arguments

high_level_il

Deprecated property provided for compatibility.

highest_address

The highest virtual address contained in a function.

hlil

Function high level IL (read-only)

hlil_if_available

Function high level IL, or None if not loaded (read-only)

indirect_branches

List of indirect branches (read-only)

instructions

A generator of instruction tokens and their start addresses for the current function

lifted_il

returns LowLevelILFunction used to represent lifted IL (read-only)

lifted_il_if_available

returns LowLevelILFunction used to represent lifted IL, or None if not loaded (read-only)

llil

returns LowLevelILFunction used to represent Function low level IL (read-only)

llil_basic_blocks

A generator of all LowLevelILBasicBlock objects in the current function

llil_if_available

returns LowLevelILFunction used to represent Function low level IL, or None if not loaded (read-only)

llil_instructions

Deprecated method provided for compatibility.

low_level_il

Deprecated property provided for compatibility.

lowest_address

The lowest virtual address contained in a function.

medium_level_il

Deprecated property provided for compatibility.

mlil

Function medium level IL (read-only)

mlil_basic_blocks

A generator of all MediumLevelILBasicBlock objects in the current function

mlil_if_available

Function medium level IL, or None if not loaded (read-only)

mlil_instructions

Deprecated method provided for compatibility.

name

Symbol name for the function

needs_update

Whether the function has analysis that needs to be updated (read-only)

parameter_vars

List of variables for the incoming function parameters

platform

Function platform (read-only)

reg_stack_adjustments

Number of entries removed from each register stack after return

return_regs

Registers that are used for the return value

return_type

Return type of the function

session_data

Dictionary object where plugins can store arbitrary data associated with the function

stack_adjustment

Number of bytes removed from the stack after return

stack_layout

List of function stack variables (read-only)

start

Function start address (read-only)

symbol

Function symbol(read-only)

too_large

Whether the function is too large to automatically perform analysis (read-only)

total_bytes

Total bytes of a function calculated by summing each basic_block.

type_tokens

Text tokens for this function’s prototype

unresolved_indirect_branches

List of unresolved indirect branches (read-only)

unresolved_stack_adjustment_graph

Flow graph of unresolved stack adjustments (read-only)

vars

List of function variables (read-only)

view

Function view (read-only)