Struct binaryninja::function::Function
source · pub struct Function { /* private fields */ }
Implementations§
source§impl Function
impl Function
pub fn arch(&self) -> CoreArchitecture
pub fn platform(&self) -> Ref<Platform>
pub fn view(&self) -> Ref<BinaryView>
pub fn symbol(&self) -> Ref<Symbol>
pub fn workflow(&self) -> Option<Ref<Workflow>>
pub fn start(&self) -> u64
pub fn lowest_address(&self) -> u64
pub fn highest_address(&self) -> u64
pub fn address_ranges(&self) -> Array<AddressRange>
pub fn comment(&self) -> BnString
pub fn set_comment<S: BnStrCompatible>(&self, comment: S)
pub fn set_can_return_auto<T: Into<Conf<bool>>>(&self, can_return: T)
pub fn set_can_return_user<T: Into<Conf<bool>>>(&self, can_return: T)
pub fn comment_at(&self, addr: u64) -> BnString
pub fn set_comment_at<S: BnStrCompatible>(&self, addr: u64, comment: S)
pub fn basic_blocks(&self) -> Array<BasicBlock<NativeBlock>>
sourcepub fn basic_block_containing(
&self,
addr: u64,
arch: Option<CoreArchitecture>
) -> Option<Ref<BasicBlock<NativeBlock>>>
pub fn basic_block_containing( &self, addr: u64, arch: Option<CoreArchitecture> ) -> Option<Ref<BasicBlock<NativeBlock>>>
Returns the BasicBlock that contains the given address addr
.
addr
- Address of the BasicBlock to retrieve.arch
- Architecture of the basic block if different from the Function’s self.arch
§Example
let blocks = fun.basic_block_containing(0x1000, None);
pub fn block_annotations( &self, addr: u64, arch: Option<CoreArchitecture> ) -> Array<Array<InstructionTextToken>>
pub fn get_variable_name(&self, var: &Variable) -> BnString
pub fn high_level_il( &self, full_ast: bool ) -> Result<Ref<HighLevelILFunction>, ()>
pub fn high_level_il_if_available(&self) -> Option<Ref<HighLevelILFunction>>
sourcepub fn mapped_medium_level_il(&self) -> Result<Ref<MediumLevelILFunction>, ()>
pub fn mapped_medium_level_il(&self) -> Result<Ref<MediumLevelILFunction>, ()>
MediumLevelILFunction used to represent Function mapped medium level IL
pub fn mapped_medium_level_il_if_available( &self ) -> Result<Ref<MediumLevelILFunction>, ()>
pub fn medium_level_il(&self) -> Result<Ref<MediumLevelILFunction>, ()>
pub fn medium_level_il_if_available(&self) -> Option<Ref<MediumLevelILFunction>>
pub fn low_level_il(&self) -> Result<Ref<RegularFunction<CoreArchitecture>>, ()>
pub fn low_level_il_if_available( &self ) -> Option<Ref<RegularFunction<CoreArchitecture>>>
pub fn lifted_il(&self) -> Result<Ref<LiftedFunction<CoreArchitecture>>, ()>
pub fn lifted_il_if_available( &self ) -> Option<Ref<LiftedFunction<CoreArchitecture>>>
pub fn return_type(&self) -> Conf<Ref<Type>>
pub fn set_auto_return_type<'a, C>(&self, return_type: C)
pub fn set_user_return_type<'a, C>(&self, return_type: C)
pub fn function_type(&self) -> Ref<Type>
pub fn has_user_type(&self) -> bool
pub fn set_user_type(&self, t: &Type)
pub fn set_auto_type(&self, t: &Type)
pub fn stack_layout(&self) -> Array<NamedTypedVariable>
sourcepub fn stack_adjustment(&self) -> Conf<i64>
pub fn stack_adjustment(&self) -> Conf<i64>
Gets number of bytes removed from the stack after return
sourcepub fn set_user_stack_adjustment<C>(&self, value: C)
pub fn set_user_stack_adjustment<C>(&self, value: C)
Sets number of bytes removed from the stack after return
sourcepub fn set_auto_stack_adjustment<C>(&self, value: C)
pub fn set_auto_stack_adjustment<C>(&self, value: C)
Sets number of bytes removed from the stack after return
pub fn call_stack_adjustment( &self, addr: u64, arch: Option<CoreArchitecture> ) -> Conf<i64>
pub fn set_user_call_stack_adjustment<I>( &self, addr: u64, adjust: I, arch: Option<CoreArchitecture> )
pub fn set_auto_call_stack_adjustment<I>( &self, addr: u64, adjust: I, arch: Option<CoreArchitecture> )
pub fn call_type_adjustment( &self, addr: u64, arch: Option<CoreArchitecture> ) -> Option<Conf<Ref<Type>>>
sourcepub fn set_user_call_type_adjustment<'a, I>(
&self,
addr: u64,
adjust_type: Option<I>,
arch: Option<CoreArchitecture>
)
pub fn set_user_call_type_adjustment<'a, I>( &self, addr: u64, adjust_type: Option<I>, arch: Option<CoreArchitecture> )
Sets or removes the call type override at a call site to the given type.
addr
- virtual address of the call instruction to adjustadjust_type
- (optional) overridden call type, orNone
to remove an existing adjustmentarch
- (optional) Architecture of the instruction if different from self.arch
pub fn set_auto_call_type_adjustment<'a, I>( &self, addr: u64, adjust_type: I, arch: Option<CoreArchitecture> )
pub fn call_reg_stack_adjustment( &self, addr: u64, arch: Option<CoreArchitecture> ) -> Array<RegisterStackAdjustment<CoreArchitecture>>
pub fn set_user_call_reg_stack_adjustment<I>( self, addr: u64, adjust: I, arch: Option<CoreArchitecture> )
pub fn set_auto_call_reg_stack_adjustment<I>( &self, addr: u64, adjust: I, arch: Option<CoreArchitecture> )
pub fn call_reg_stack_adjustment_for_reg_stack( &self, addr: u64, reg_stack_id: u32, arch: Option<CoreArchitecture> ) -> RegisterStackAdjustment<CoreArchitecture>
pub fn set_user_call_reg_stack_adjustment_for_reg_stack<I>( &self, addr: u64, reg_stack_id: u32, adjust: I, arch: Option<CoreArchitecture> )
pub fn set_auto_call_reg_stack_adjustment_for_reg_stack<I>( &self, addr: u64, reg_stack_id: u32, adjust: I, arch: Option<CoreArchitecture> )
pub fn reg_stack_adjustments( &self ) -> Array<RegisterStackAdjustment<CoreArchitecture>>
pub fn set_user_reg_stack_adjustments<I, A>(&self, values: I)
pub fn set_auto_reg_stack_adjustments<I, A>(&self, values: I)
sourcepub fn variables(&self) -> Array<(&str, Variable, &Type)>
pub fn variables(&self) -> Array<(&str, Variable, &Type)>
List of function variables: including name, variable and type
pub fn split_variables(&self) -> Array<Variable>
pub fn parameter_variables(&self) -> Conf<Vec<Variable>>
pub fn set_user_parameter_variables<I>(&self, values: I, confidence: u8)where
I: IntoIterator<Item = Variable>,
pub fn set_auto_parameter_variables<I>(&self, values: I, confidence: u8)where
I: IntoIterator<Item = Variable>,
pub fn parameter_at( &self, addr: u64, func_type: Option<&Type>, i: usize, arch: Option<CoreArchitecture> ) -> RegisterValue
pub fn parameter_at_low_level_il_instruction( &self, instr: usize, func_type: &Type, i: usize ) -> RegisterValue
pub fn apply_imported_types(&self, sym: &Symbol, t: Option<&Type>)
pub fn apply_auto_discovered_type(&self, func_type: &Type)
sourcepub fn analysis_skipped(&self) -> bool
pub fn analysis_skipped(&self) -> bool
Whether automatic analysis was skipped for this function. Can be set to false to re-enable analysis.
pub fn set_analysis_skipped(&self, skip: bool)
pub fn analysis_skip_reason(&self) -> AnalysisSkipReason
pub fn analysis_skip_override(&self) -> FunctionAnalysisSkipOverride
pub fn set_analysis_skip_override( &self, override_: FunctionAnalysisSkipOverride )
sourcepub fn inline_during_analysis(&self) -> Conf<bool>
pub fn inline_during_analysis(&self) -> Conf<bool>
Whether the function’s IL should be inlined into all callers’ IL
pub fn set_auto_inline_during_analysis<C>(&self, value: C)
pub fn set_user_inline_during_analysis<C>(&self, value: C)
pub fn analysis_performance_info(&self) -> Array<PerformanceInfo>
sourcepub fn add_tag<S: BnStrCompatible>(
&self,
tag_type: &TagType,
data: S,
addr: Option<u64>,
user: bool,
arch: Option<CoreArchitecture>
)
pub fn add_tag<S: BnStrCompatible>( &self, tag_type: &TagType, data: S, addr: Option<u64>, user: bool, arch: Option<CoreArchitecture> )
Creates and adds a Tag object on either a function, or on an address inside of a function.
“Function tags” appear at the top of a function and are a good way to label an entire function with some information. If you include an address when you call Function.add_tag, you’ll create an “address tag”. These are good for labeling specific instructions.
For tagging arbitrary data, consider BinaryViewExt::add_tag.
tag_type_name
- The name of the tag type for this Tag.data
- Additional data for the Tag.addr
- Address at which to add the tag.user
- Whether or not a user tag.
§Example
let important = bv.create_tag_type("Important", "⚠️");
fun.add_tag(&important, "I think this is the main function", None, false, None);
let crash = bv.create_tag_type("Crashes", "🎯");
fun.add_tag(&crash, "Nullpointer dereference", Some(0x1337), false, None);
sourcepub fn remove_tag(
&self,
tag: &Tag,
addr: Option<u64>,
user: bool,
arch: Option<CoreArchitecture>
)
pub fn remove_tag( &self, tag: &Tag, addr: Option<u64>, user: bool, arch: Option<CoreArchitecture> )
Remove Tag object on either a function, or on an address inside of a function.
tag
- The tag to remove.addr
- (optional) Address at which to remove the tag.user
- Whether or not a user tag.
Remove Tag object of type on either a function, or on an address inside of a function.
tag_type
- The type of the to remove.addr
- Address at which to add the tag.user
- Whether or not a user tag.
sourcepub fn add_user_code_ref(
&self,
from_addr: u64,
to_addr: u64,
arch: Option<CoreArchitecture>
)
pub fn add_user_code_ref( &self, from_addr: u64, to_addr: u64, arch: Option<CoreArchitecture> )
Places a user-defined cross-reference from the instruction at the given address and architecture to the specified target address. If the specified source instruction is not contained within this function, no action is performed. To remove the reference, use Function::remove_user_code_ref.
from_addr
- Virtual address of the source instruction.to_addr
- Virtual address of the xref’s destination.arch
- Architecture of the source instruction.
§Example
fun.add_user_code_ref(0x1337, 0x400000, None);
sourcepub fn remove_user_code_ref(
self,
from_addr: u64,
to_addr: u64,
arch: Option<CoreArchitecture>
)
pub fn remove_user_code_ref( self, from_addr: u64, to_addr: u64, arch: Option<CoreArchitecture> )
Removes a user-defined cross-reference. If the given address is not contained within this function, or if there is no such user-defined cross-reference, no action is performed.
from_addr
- virtual address of the source instructionto_addr
- virtual address of the xref’s destination.arch
- architecture of the source instruction
#Example
fun.remove_user_code_ref(0x1337, 0x400000, None);
sourcepub fn add_user_type_ref(
&self,
from_addr: u64,
name: &QualifiedName,
arch: Option<CoreArchitecture>
)
pub fn add_user_type_ref( &self, from_addr: u64, name: &QualifiedName, arch: Option<CoreArchitecture> )
Places a user-defined type cross-reference from the instruction at the given address and architecture to the specified type. If the specified source instruction is not contained within this function, no action is performed. To remove the reference, use Function::remove_user_type_ref.
from_addr
- Virtual address of the source instruction.name
- Name of the referenced type.arch
- Architecture of the source instruction.
§Example
fun.add_user_type_ref(0x1337, &"A".into(), None);
sourcepub fn remove_user_type_ref(
&self,
from_addr: u64,
name: &QualifiedName,
arch: Option<CoreArchitecture>
)
pub fn remove_user_type_ref( &self, from_addr: u64, name: &QualifiedName, arch: Option<CoreArchitecture> )
Removes a user-defined type cross-reference. If the given address is not contained within this function, or if there is no such user-defined cross-reference, no action is performed.
from_addr
- Virtual address of the source instruction.name
- Name of the referenced type.from_arch
- Architecture of the source instruction.
§Example
fun.remove_user_type_ref(0x1337, &"A".into(), None);
sourcepub fn add_user_type_field_ref(
&self,
from_addr: u64,
name: &QualifiedName,
offset: u64,
arch: Option<CoreArchitecture>,
size: Option<usize>
)
pub fn add_user_type_field_ref( &self, from_addr: u64, name: &QualifiedName, offset: u64, arch: Option<CoreArchitecture>, size: Option<usize> )
Places a user-defined type field cross-reference from the instruction at the given address and architecture to the specified type. If the specified source instruction is not contained within this function, no action is performed. To remove the reference, use Function::remove_user_type_field_ref.
from_addr
- Virtual address of the source instruction.name
- Name of the referenced type.offset
- Offset of the field, relative to the type.arch
- Architecture of the source instruction.size
- The size of the access.
§Example
fun.add_user_type_field_ref(0x1337, &"A".into(), 0x8, None, None);
sourcepub fn remove_user_type_field_ref(
&self,
from_addr: u64,
name: &QualifiedName,
offset: u64,
arch: Option<CoreArchitecture>,
size: Option<usize>
)
pub fn remove_user_type_field_ref( &self, from_addr: u64, name: &QualifiedName, offset: u64, arch: Option<CoreArchitecture>, size: Option<usize> )
Removes a user-defined type field cross-reference. If the given address is not contained within this function, or if there is no such user-defined cross-reference, no action is performed.
from_addr
- Virtual address of the source instructionname
- Name of the referenced typeoffset
- Offset of the field, relative to the typearch
- Architecture of the source instructionsize
- The size of the access
§Example
fun.remove_user_type_field_ref(0x1337, &"A".into(), 0x8, None, None);
pub fn constant_data( &self, state: RegisterValueType, value: u64, size: Option<usize> ) -> (DataBuffer, BuiltinType)
pub fn constants_referenced_by( &self, addr: u64, arch: Option<CoreArchitecture> ) -> Array<ConstantReference>
pub fn constants_referenced_by_address_if_available( &self, addr: u64, arch: Option<CoreArchitecture> ) -> Array<ConstantReference>
Returns a list of function Tags for the function.
auto
- If None
, gets all tags, if true
, gets auto tags, if false
, gets user tags
tag_type
- If None
, gets all tags, otherwise only gets tags of the given type
Gets a list of Tags at the address.
addr
- Address to get tags from.auto
- IfNone
, gets all tags, iftrue
, gets auto tags, iffalse
, gets user tags
Gets a list of Tags in the address range.
addr
- Address to get tags from.auto
- IfNone
, gets all tags, iftrue
, gets auto tags, iffalse
, gets user tags
sourcepub fn indirect_branches(&self) -> Array<IndirectBranchInfo>
pub fn indirect_branches(&self) -> Array<IndirectBranchInfo>
List of indirect branches
pub fn set_user_indirect_branches<I>(
&self,
source: u64,
branches: I,
arch: Option<CoreArchitecture>
)where
I: IntoIterator<Item = u64>,
pub fn set_auto_indirect_branches<I>(
&self,
source: u64,
branches: I,
arch: Option<CoreArchitecture>
)where
I: IntoIterator<Item = u64>,
sourcepub fn indirect_branches_at(
&self,
addr: u64,
arch: Option<CoreArchitecture>
) -> Array<IndirectBranchInfo>
pub fn indirect_branches_at( &self, addr: u64, arch: Option<CoreArchitecture> ) -> Array<IndirectBranchInfo>
List of indirect branches at this address
sourcepub fn instr_highlight(
&self,
addr: u64,
arch: Option<CoreArchitecture>
) -> HighlightColor
pub fn instr_highlight( &self, addr: u64, arch: Option<CoreArchitecture> ) -> HighlightColor
§Example
let color = fun.instr_highlight(0x1337, None);
sourcepub fn set_auto_instr_highlight(
&self,
addr: u64,
color: HighlightColor,
arch: Option<CoreArchitecture>
)
pub fn set_auto_instr_highlight( &self, addr: u64, color: HighlightColor, arch: Option<CoreArchitecture> )
Sets the highlights the instruction at the specified address with the supplied color
addr
- virtual address of the instruction to be highlightedcolor
- Color value to use for highlightingarch
- (optional) Architecture of the instruction if different from self.arch
sourcepub fn set_user_instr_highlight(
&self,
addr: u64,
color: HighlightColor,
arch: Option<CoreArchitecture>
)
pub fn set_user_instr_highlight( &self, addr: u64, color: HighlightColor, arch: Option<CoreArchitecture> )
Sets the highlights the instruction at the specified address with the supplied color
addr
- virtual address of the instruction to be highlightedcolor
- Color value to use for highlightingarch
- (optional) Architecture of the instruction if different from self.arch
§Example
let color = HighlightColor::NoHighlightColor { alpha: u8::MAX };
fun.set_user_instr_highlight(0x1337, color, None);
sourcepub fn instruction_containing_address(
&self,
addr: u64,
arch: Option<CoreArchitecture>
) -> Option<u64>
pub fn instruction_containing_address( &self, addr: u64, arch: Option<CoreArchitecture> ) -> Option<u64>
return the address, if any, of the instruction that contains the provided address
sourcepub fn int_display_type(
&self,
instr_addr: u64,
value: u64,
operand: usize,
arch: Option<CoreArchitecture>
) -> IntegerDisplayType
pub fn int_display_type( &self, instr_addr: u64, value: u64, operand: usize, arch: Option<CoreArchitecture> ) -> IntegerDisplayType
Get the current text display type for an integer token in the disassembly or IL views
See also see Function::int_display_type_and_typeid
instr_addr
- Address of the instruction or IL line containing the tokenvalue
- field of the InstructionTextToken object for the token, usually the constant displayedoperand
- Operand index of the token, defined as the number of OperandSeparatorTokens in the disassembly line before the tokenarch
- (optional) Architecture of the instruction or IL line containing the token
sourcepub fn set_int_display_type(
&self,
instr_addr: u64,
value: u64,
operand: usize,
display_type: IntegerDisplayType,
arch: Option<CoreArchitecture>,
enum_display_typeid: Option<impl BnStrCompatible>
)
pub fn set_int_display_type( &self, instr_addr: u64, value: u64, operand: usize, display_type: IntegerDisplayType, arch: Option<CoreArchitecture>, enum_display_typeid: Option<impl BnStrCompatible> )
Change the text display type for an integer token in the disassembly or IL views
instr_addr
- Address of the instruction or IL line containing the tokenvalue
- Field of the InstructionTextToken object for the token, usually the constant displayedoperand
- Operand index of the token, defined as the number of OperandSeparatorTokens in the disassembly line before the tokendisplay_type
- Desired display typearch
- (optional) Architecture of the instruction or IL line containing the tokenenum_display_typeid
- (optional) Whenever passing EnumDisplayType todisplay_type
, passing a type ID here will specify the Enumeration display type. Must be a valid type ID and resolve to an enumeration type.
sourcepub fn int_enum_display_typeid(
&self,
instr_addr: u64,
value: u64,
operand: usize,
arch: Option<CoreArchitecture>
) -> BnString
pub fn int_enum_display_typeid( &self, instr_addr: u64, value: u64, operand: usize, arch: Option<CoreArchitecture> ) -> BnString
Get the current text display enum type for an integer token in the disassembly or IL views.
See also see Function::int_display_type_and_typeid
instr_addr
- Address of the instruction or IL line containing the tokenvalue
- field of the InstructionTextToken object for the token, usually the constant displayedoperand
- Operand index of the token, defined as the number of OperandSeparatorTokens in the disassembly line before the tokenarch
- (optional) Architecture of the instruction or IL line containing the token
sourcepub fn int_display_type_and_typeid(
&self,
instr_addr: u64,
value: u64,
operand: usize,
arch: Option<CoreArchitecture>
) -> (IntegerDisplayType, BnString)
pub fn int_display_type_and_typeid( &self, instr_addr: u64, value: u64, operand: usize, arch: Option<CoreArchitecture> ) -> (IntegerDisplayType, BnString)
Get the current text display type for an integer token in the disassembly or IL views
instr_addr
- Address of the instruction or IL line containing the tokenvalue
- field of the InstructionTextToken object for the token, usually the constant displayedoperand
- Operand index of the token, defined as the number of OperandSeparatorTokens in the disassembly line before the tokenarch
- (optional) Architecture of the instruction or IL line containing the token
sourcepub fn register_value_at(
&self,
addr: u64,
reg: u32,
arch: Option<CoreArchitecture>
) -> RegisterValue
pub fn register_value_at( &self, addr: u64, reg: u32, arch: Option<CoreArchitecture> ) -> RegisterValue
Get the value the provided string register address corresponding to the given virtual address
addr
- virtual address of the instruction to queryreg
- string value of native register to queryarch
- (optional) Architecture for the given function
§Example
let reg = fun.arch().register_by_name("rdi").unwrap();
let value = fun.register_value_at(0x400dbe, reg.id(), None);
sourcepub fn register_value_after(
&self,
addr: u64,
reg: u32,
arch: Option<CoreArchitecture>
) -> RegisterValue
pub fn register_value_after( &self, addr: u64, reg: u32, arch: Option<CoreArchitecture> ) -> RegisterValue
Gets the value instruction address corresponding to the given virtual address
addr
- virtual address of the instruction to queryreg
- string value of native register to queryarch
- (optional) Architecture for the given function
§Example
let reg = fun.arch().register_by_name("rdi").unwrap();
let value = fun.register_value_after(0x400dbe, reg.id(), None);
pub fn register_value_at_exit(&self, reg: u32) -> Conf<RegisterValue>
pub fn registers_read_by( &self, addr: u64, arch: Option<CoreArchitecture> ) -> Array<CoreRegister>
pub fn registers_written_by( &self, addr: u64, arch: Option<CoreArchitecture> ) -> Array<CoreRegister>
sourcepub fn clobbered_registers(&self) -> Conf<Array<CoreRegister>>
pub fn clobbered_registers(&self) -> Conf<Array<CoreRegister>>
Registers that are modified by this function
pub fn set_user_clobbered_registers<I>(&self, registers: I, confidence: u8)where
I: IntoIterator<Item = CoreRegister>,
pub fn set_auto_clobbered_registers<I>(&self, registers: I, confidence: u8)where
I: IntoIterator<Item = CoreRegister>,
pub fn stack_contents_at( &self, addr: u64, offset: i64, size: usize, arch: Option<CoreArchitecture> ) -> RegisterValue
pub fn stack_contents_after( &self, addr: u64, offset: i64, size: usize, arch: Option<CoreArchitecture> ) -> RegisterValue
pub fn stack_var_at_frame_offset( &self, addr: u64, offset: i64, arch: Option<CoreArchitecture> ) -> Option<(Variable, BnString, Conf<Ref<Type>>)>
pub fn stack_variables_referenced_by( &self, addr: u64, arch: Option<CoreArchitecture> ) -> Array<StackVariableReference>
pub fn stack_variables_referenced_by_address_if_available( &self, addr: u64, arch: Option<CoreArchitecture> ) -> Array<StackVariableReference>
sourcepub fn global_pointer_value(&self) -> Conf<RegisterValue>
pub fn global_pointer_value(&self) -> Conf<RegisterValue>
Discovered value of the global pointer register, if the function uses one
pub fn type_tokens( &self, settings: Option<&DisassemblySettings> ) -> Array<DisassemblyTextLine>
pub fn is_call_instruction( &self, addr: u64, arch: Option<CoreArchitecture> ) -> bool
pub fn is_variable_user_defined(&self, var: &Variable) -> bool
pub fn is_pure(&self) -> Conf<bool>
pub fn set_user_pure<C>(&self, value: C)
pub fn set_auto_pure<C>(&self, value: C)
pub fn is_too_large(&self) -> bool
pub fn is_update_needed(&self) -> bool
sourcepub fn mark_updates_required(&self, update_type: FunctionUpdateType)
pub fn mark_updates_required(&self, update_type: FunctionUpdateType)
Indicates that this function needs to be reanalyzed during the next update cycle
update_type
- Desired update type
sourcepub fn mark_caller_updates_required(&self, update_type: FunctionUpdateType)
pub fn mark_caller_updates_required(&self, update_type: FunctionUpdateType)
Indicates that callers of this function need to be reanalyzed during the next update cycle
uppdate_type
- Desired update type
pub fn mark_recent_use(&self)
pub fn merged_variables(&self) -> Array<MergedVariable>
sourcepub fn merge_variables<'a>(
&self,
target: &Variable,
sources: impl IntoIterator<Item = &'a Variable>
)
pub fn merge_variables<'a>( &self, target: &Variable, sources: impl IntoIterator<Item = &'a Variable> )
Merge one or more varibles in sources
into the target
variable. All
variable accesses to the variables in sources
will be rewritten to use target
.
target
- target variablesources
- list of source variables
sourcepub fn unmerge_variables<'a>(
&self,
target: &Variable,
sources: impl IntoIterator<Item = &'a Variable>
)
pub fn unmerge_variables<'a>( &self, target: &Variable, sources: impl IntoIterator<Item = &'a Variable> )
Undoes variable merging performed with Function::merge_variables. The variables in
sources
will no longer be merged into the target
variable.
target
- target variablesources
- list of source variables
sourcepub fn split_variable(&self, var: &Variable)
pub fn split_variable(&self, var: &Variable)
Splits a varible at the definition site. The given var
must be the
variable unique to the definition and should be obtained by using
mlil::MediumLevelILInstruction::get_split_var_for_definition at the definition site.
This function is not meant to split variables that have been previously merged. Use Function::unmerge_variables to split previously merged variables.
Binary Ninja automatically splits all variables that the analysis determines to be safely splittable. Splitting a variable manually with Function::split_variable can cause IL and decompilation to be incorrect. There are some patterns where variables can be safely split semantically but analysis cannot determine that it is safe. This function is provided to allow variable splitting to be performed in these cases by plugins or by the user.
var
- variable to split
sourcepub fn unsplit_variable(&self, var: &Variable)
pub fn unsplit_variable(&self, var: &Variable)
Undoes varible splitting performed with Function::split_variable. The given var
must be the variable unique to the definition and should be obtained by using
mlil::MediumLevelILInstruction::get_split_var_for_definition at the definition site.
var
- variable to unsplit
sourcepub fn reanalyze(&self, update_type: FunctionUpdateType)
pub fn reanalyze(&self, update_type: FunctionUpdateType)
Causes this function to be reanalyzed. This function does not wait for the analysis to finish.
update_type
- Desired update type
If analysis_skipped is true
, using this API will not trigger
re-analysis. Instead, use Function::set_analysis_skipped with false
.
sourcepub fn request_debug_report(&self, name: &str)
pub fn request_debug_report(&self, name: &str)
Generate internal debug reports for a variety of analysis. Current list of possible values include:
- mlil_translator
- stack_adjust_graph
- high_level_il
name
- Name of the debug report
sourcepub fn auto(&self) -> bool
pub fn auto(&self) -> bool
Whether function was automatically discovered s a result of some creation of a ‘user’ function. ‘user’ functions may or may not have been created by a user through the or API. For instance the entry point into a function is always created a ‘user’ function. ‘user’ functions should be considered the root of auto analysis.
sourcepub fn call_sites(&self) -> Array<CodeReference>
pub fn call_sites(&self) -> Array<CodeReference>
Returns a list of possible call sites contained in this function. This includes ordinary calls, tail calls, and indirect jumps. Not all of the returned call sites are necessarily true call sites; some may simply be unresolved indirect jumps, for example.
sourcepub fn caller_sites(&self) -> Array<CodeReference>
pub fn caller_sites(&self) -> Array<CodeReference>
Returns a list of ReferenceSource objects corresponding to the addresses in functions which reference this function
sourcepub fn calling_convention(
&self
) -> Option<Conf<Ref<CallingConvention<CoreArchitecture>>>>
pub fn calling_convention( &self ) -> Option<Conf<Ref<CallingConvention<CoreArchitecture>>>>
Calling convention used by the function
sourcepub fn set_user_calling_convention<'a, I>(&self, value: Option<I>)
pub fn set_user_calling_convention<'a, I>(&self, value: Option<I>)
Set the User calling convention used by the function
sourcepub fn set_auto_calling_convention<'a, I>(&self, value: Option<I>)
pub fn set_auto_calling_convention<'a, I>(&self, value: Option<I>)
Set the calling convention used by the function
pub fn can_return(&self) -> Conf<bool>
pub fn set_user_can_return<I>(&self, value: I)
pub fn set_auto_can_return<I>(&self, value: I)
sourcepub fn has_explicitly_defined_type(&self) -> bool
pub fn has_explicitly_defined_type(&self) -> bool
Whether function has explicitly defined types
pub fn has_user_annotations(&self) -> bool
pub fn has_variable_arguments(&self) -> Conf<bool>
pub fn set_user_has_variable_arguments<I>(&self, value: I)
pub fn set_auto_has_variable_arguments<I>(&self, value: I)
sourcepub fn has_unresolved_indirect_branches(&self) -> bool
pub fn has_unresolved_indirect_branches(&self) -> bool
Has unresolved indirect branches
sourcepub fn unresolved_indirect_branches(&self) -> Array<UnresolvedIndirectBranches>
pub fn unresolved_indirect_branches(&self) -> Array<UnresolvedIndirectBranches>
List of address of unresolved indirect branches
sourcepub fn provenance(&self) -> BnString
pub fn provenance(&self) -> BnString
Returns a string representing the provenance. This portion of the API is under development. Currently the provenance information is undocumented, not persistent, and not saved to a database.
sourcepub fn return_registers(&self) -> Conf<Array<CoreRegister>>
pub fn return_registers(&self) -> Conf<Array<CoreRegister>>
Get registers that are used for the return value
pub fn set_user_return_registers<I>(&self, values: I, confidence: u8)where
I: IntoIterator<Item = CoreRegister>,
pub fn set_auto_return_registers<I>(&self, values: I, confidence: u8)where
I: IntoIterator<Item = CoreRegister>,
sourcepub fn unresolved_stack_adjustment_graph(&self) -> Option<Ref<FlowGraph>>
pub fn unresolved_stack_adjustment_graph(&self) -> Option<Ref<FlowGraph>>
Flow graph of unresolved stack adjustments