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_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
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 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.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 Architecturearch
at the given addressaddr
.get_block_annotations
(addr[, arch])get_call_reg_stack_adjustment
(addr[, arch])get_call_stack_adjustment
(addr[, arch])get_call_type_adjustment
(addr[, arch])get_comment_at
(addr)get_constants_referenced_by
(addr[, arch])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 functionfunc
, of the architecturearch
, and at the addressaddr
.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_ils_at
(addr[, arch])get_lifted_ils_at
gets the Lifted IL Instruction(s) corresponding to the given virtual addressget_llil_at
(addr[, arch])get_llil_at
gets the LowLevelILInstruction corresponding to the given virtual addressget_llils_at
(addr[, arch])get_llils_at
gets the LowLevelILInstruction(s) corresponding to the given virtual addressget_low_level_il_at
(addr[, arch])get_low_level_il_at
gets the LowLevelILInstruction corresponding to the given virtual addressget_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 functionfunc
, of the architecturearch
, and at the addressaddr
.get_parameter_at
(addr, func_type, i[, arch])get_reg_value_after
(addr, reg[, arch])get_reg_value_after
gets the value instruction address corresponding to the given virtual addressget_reg_value_at
(addr, reg[, arch])get_reg_value_at
gets the value the provided string register address corresponding to the given virtual addressget_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 addressaddr
, stack offsetoffset
and size ofsize
.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)reanalyze
causes this functions to be reanalyzed.remove_auto_address_tag
(addr, tag[, arch])remove_auto_address_tag
removes a Tag object at a given address.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
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_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_stack_adjustment
(addr, adjust)set_auto_calling_convention
(value)set_auto_can_return
(value)set_auto_clobbered_regs
(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 colorset_auto_parameter_vars
(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_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 specifiedset_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 colorset_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
All of the address ranges covered by a function
address_tags
gets a list of all address Tags in the function.Override for skipping of automatic analysis
Function analysis skip reason
Whether automatic analysis was skipped for this function, set to true to disable analysis.
Function architecture (read-only)
Whether function was automatically discovered (read-only)
List of basic blocks (read-only)
call_sites
returns a list of possible call sites contained in this function.callee_addressses
returns a list of start addresses for functions that call this function.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
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 used by the function
Whether function can return
Registers that are modified by this function
Gets the comment for the current function
Dict of comments (read-only)
Whether function has explicitly defined types (read-only)
function_tags
gets a list of all function Tags for the function.Function type object, can be set with either a string representing the function prototype (str(function) shows examples) or a
Type
objectDiscovered value of the global pointer register, if the function uses one (read-only)
Has unresolved indirect branches (read-only)
Whether the function takes a variable number of arguments
Deprecated property provided for compatibility.
The highest virtual address contained in a function.
Function high level IL (read-only)
Function high level IL, or None if not loaded (read-only)
List of indirect branches (read-only)
A generator of instruction tokens and their start addresses for the current function
returns LowLevelILFunction used to represent lifted IL (read-only)
returns LowLevelILFunction used to represent lifted IL, or None if not loaded (read-only)
returns LowLevelILFunction used to represent Function low level IL (read-only)
A generator of all LowLevelILBasicBlock objects in the current function
returns LowLevelILFunction used to represent Function low level IL, or None if not loaded (read-only)
Deprecated method provided for compatibility.
Deprecated property provided for compatibility.
The lowest virtual address contained in a function.
Deprecated property provided for compatibility.
Function medium level IL (read-only)
A generator of all MediumLevelILBasicBlock objects in the current function
Function medium level IL, or None if not loaded (read-only)
Deprecated method provided for compatibility.
Symbol name for the function
Whether the function has analysis that needs to be updated (read-only)
List of variables for the incoming function parameters
Function platform (read-only)
Number of entries removed from each register stack after return
Registers that are used for the return value
Return type of the function
Dictionary object where plugins can store arbitrary data associated with the function
Number of bytes removed from the stack after return
List of function stack variables (read-only)
Function start address (read-only)
Function symbol(read-only)
Whether the function is too large to automatically perform analysis (read-only)
Total bytes of a function calculated by summing each basic_block.
Text tokens for this function’s prototype
List of unresolved indirect branches (read-only)
Flow graph of unresolved stack adjustments (read-only)
List of function variables (read-only)
Function view (read-only)
-