-
Notifications
You must be signed in to change notification settings - Fork 218
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement functions from python Function #5378
Conversation
Tests being written at: https://github.com/rbran/binaryninja-test mostly on mlil_vars |
At least for basic blocks, the UI does the following with highlight colors:
|
9b7a012
to
7c82a00
Compare
I guess it all depends on the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is tremendous! Thank you for your work. Just a couple changes requested:
- Rename
VariableDefinitions
- Finish implementing
PossibleValueSet
(or correct me if I'm wrong) - Squash your commits so there are approx. <=5. (though I do appreciate the small, well described commits, we prefer not to merge too many separate commits at one time...please retain their commit messages when you squash)
Squashed: add Function::add_tag method add Function::{add_user_code_ref,remove_user_code_ref} methods add Function::{add_user_type_field_ref, remove_user_type_field_ref} methods add Function::{add_user_type_ref, remove_user_type_ref} methods add Function::apply_auto_discovered_type add Function/MediumLevelILFunction user_var_values and related functions simplify UserVariableValues::values_from_variable cargo fmt fix fix doc and QualifiedName params fix MediumLevelILFunction::is_var_user_defined parameter Remove unecessary Safety comment add Function::{create_auto_stack_var,delete_auto_stack_var} methods add MediumLevelILFunction::create_auto_var method move Function::{create_auto_stack_var,delete_auto_stack_var} methods to MediumLevelILFunction add MediumLevelILFunction::{create_user_stack_var,delete_user_stack_var} methods add Function::block_annotations method add Function::{call_stack_adjustment, call_type_adjustment} method add Function::{constant_data, constants_referenced_by, constants_referenced_by_address_if_available} methods add Function::function_tags method add Function::{indirect_branches, indirect_branches_at} methods add Function::instr_highlight method add Function::instruction_containing_address method add Function::{int_display_type,int_enum_display_typeid,int_display_type_and_typeid} methods add MediumLevelILFunction::{var_refs, var_refs_from} methods add Function::{parameter_at, parameter_at_low_level_il_instruction} methods rebase GAT changes add Function::{reg_value_at, reg_value_after, reg_value_at_exit} methods Add alpha to HighlightColor::NoHighlightColor add Function::{regs_read_by, regs_written_by} methods add Function::{stack_contents_at, stack_contents_after} methods add Function::{stack_vars_referenced_by, stack_vars_referenced_by_address_if_available} methods add Function::{tags_at, tags_at_range} methods add Function::type_tokens method add Function::variables method add Function::{is_call_instruction, is_var_user_defined} methods add Function::{mark_updates_required, mark_caller_updates_required, mark_recent_use} methods add Function::{merge_vars, unmerge_vars, split_var, unsplit_var} methods add Function::reanalyze method add Function::request_debug_report method add Function::remove_tag method add Function::remove_tags_of_type method add Function::analysis_performance_info method add Function::call_sites method add Function::caller_sites method add Function::{calling_convention, set_calling_convention} methods add Function::{can_return, set_can_return} methods add Function::comments method add Function::{clobbered_regs, set_clobbered_regs} methods add Function::{has_explicitly_defined_type, has_user_annotations, has_user_type, has_variable_arguments} methods fix Function::set_can_return_user function add Function::{high_level_il_if_available, medium_level_il_if_available, low_level_il_if_available, lifted_il_if_available} methods add Function::{global_pointer_value, has_unresolved_indirect_branches} methods add Function::lowest_address method add Function::{inline_during_analysis, set_auto_inline_during_analysis, set_user_inline_during_analysis} methods add Function::{is_pure, is_too_large, is_update_needed} methods add Function::{provenance, stack_adjustment, set_user_stack_adjustment, set_auto_stack_adjustment} methods add Function::{set_user_pure, set_auto_pure} methods add Function::set_auto_type method add Function::{return_regs, set_return_regs} methods add Function::{set_auto_return_type, set_user_return_type} methods add Function::unresolved_stack_adjustment_graph method add Function::create_graph method add Function::tags method add Function::split_variables method add Function::{reg_stack_adjustments, set_reg_stack_adjustments} methods add Function::{mapped_medium_level_il, merged_variables} methods add Function::{set_auto_instr_highlight, set_user_instr_highlight} methods add stack_adjustments methods add Function::set_user_call_stack_adjustment add Function::set_auto_call_stack_adjustment add Function::call_type_adjustment add Function::set_user_call_type_adjustment add Function::set_auto_call_type_adjustment add Function::call_reg_stack_adjustment add Function::set_user_call_reg_stack_adjustment add Function::set_auto_call_reg_stack_adjustment add Function::call_reg_stack_adjustment_for_reg_stack add Function::set_user_call_reg_stack_adjustment_for_reg_stack add Function::set_auto_call_reg_stack_adjustment_for_reg_stack add Function::set_user_reg_stack_adjustments add Function::set_auto_reg_stack_adjustments add Function::set_auto_reg_stack_adjustments add Function::set_auto_calling_convention method add Function::set_auto_can_return method add Function::{set_user_has_variable_arguments, set_auto_has_variable_arguments} methods add Function::{set_user_indirect_branches, set_auto_indirect_branches} methods add Function::set_int_display_type method add Function::{set_user_parameter_variables, set_auto_parameter_variables} methods fix documentation add Function::unresolved_indirect_branches method add Function::mapped_medium_level_il_if_available method change methods `Function::{set_user_type, set_auto_type}` to receive `&Type` merge RegisterList and RegisterSet into CoreRegister impl fix function names fix function names fix documentation syntax fix documentation syntax fix Function documentation by adding MediumLevelILInstruction::get_split_var_for_definition fix documentation links rename `VariableDefinitions` to `MediumLevelILInstructionList` fix `PossibleValueSet` switched `NotInSetOfValues` and `ReturnAddressValue`
TODO:
QualifiedNameAndType
toFunction::add_user_type_ref
andFunction::remove_user_type_ref
BNHighlightColor{style: StandardHighlightColor, color: NoHighlightColor, alpha: value, ..zeroed}
?RegisterList
andRegisterSet
, can both be merged? DoesBNFreeRegisterSet
just callsBNFreeRegisterList
?Function::set_user_type
receive aType
parameter, should it be&Type
orRef<Type>
instead?int_display_type
/int_enum_display_typeid
andint_display_type_and_typeid
?Implemented:
⭕: Deprecated
🔀: Belongs in other struct
🐍: Pythonism, shold not be part of rust
🟢: Implemented by this PR
🟡: Exists on dev
🔴: Will not implement on this PR
BNAddTag
add_tag
add_tag
BNAddAutoFunctionTag
add_tag
add_tag
BNAddAutoAddressTag
add_tag
add_tag
BNAddUserFunctionTag
add_tag
add_tag
BNAddUserAddressTag
add_tag
add_tag
BNAddAutoFunctionTag
add_tag
add_tag
BNGetFunctionAddressRanges
address_ranges
address_ranges
BNGetAddressTagReferences
tags
tags
BNAddUserCodeReference
add_user_code_ref
add_user_code_ref
BNAddUserTypeFieldReference
add_user_type_field_ref
add_user_type_field_ref
BNAddUserTypeReference
add_user_type_ref
add_user_type_ref
BNGetFunctionAnalysisPerformanceInfo
analysis_performance_info
analysis_performance_info
BNGetFunctionAnalysisSkipOverride
analysis_skip_override
analysis_skip_override
BNSetFunctionAnalysisSkipOverride
analysis_skip_override
set_analysis_skip_override
BNIsFunctionAnalysisSkipped
analysis_skipped
analysis_skipped
BNSetFunctionAnalysisSkipOverride
analysis_skipped
set_analysis_skipped
BNSetFunctionAnalysisSkipOverride
set_analysis_skip_override
set_analysis_skip_override
BNGetAnalysisSkipReason
analysis_skip_reason
analysis_skip_reason
BNApplyAutoDiscoveredFunctionType
apply_auto_discovered_type
apply_auto_discovered_type
BNApplyImportedTypes
apply_imported_types
apply_imported_types
BNGetFunctionArchitecture
arch
arch
BNWasFunctionAutomaticallyDiscovered
auto
auto
BNGetAutoAddressTagReferences
auto_address_tags
BNGetFunctionBasicBlockList
basic_blocks
basic_blocks
callees
callee_addresses
callers
caller_sites
BNGetFunctionCallSites
call_sites
call_sites
BNGetFunctionCallingConvention
calling_convention
calling_convention
BNSetUserFunctionCallingConvention
calling_convention
set_user_calling_convention
BNSetAutoFunctionCallingConvention
set_auto_calling_convention
set_auto_calling_convention
BNGetFunctionCallSites
call_sites
call_sites
BNCanFunctionReturn
can_return
can_return
BNSetUserFunctionCanReturn
can_return
set_user_can_return
BNSetAutoFunctionCanReturn
set_auto_can_return
set_auto_can_return
BNGetFunctionClobberedRegisters
clobbered_regs
clobbered_registers
BNSetUserFunctionClobberedRegisters
clobbered_regs
set_clobbered_registers
BNSetUserFunctionClobberedRegisters
set_user_clobbered_regs
set_user_clobbered_registers
BNSetAutoFunctionClobberedRegisters
set_auto_clobbered_regs
set_auto_clobbered_registers
BNGetFunctionComment
comment
comment
BNSetFunctionComment
comment
set_comment
BNGetCommentedAddresses
comments
comments
components
BNGetFunctionVariables
core_vars
variables
BNGetStackLayout
core_var_stack_layout
stack_layout
BNCreateFunctionGraph
create_graph
create_graph
BNGetFunctionBasicBlockAtAddress
get_basic_block_at
basic_block_containing
BNGetFunctionBlockAnnotations
get_block_annotations
block_annotations
BNGetCallRegisterStackAdjustment
get_call_reg_stack_adjustment
call_reg_stack_adjustment
BNGetCallRegisterStackAdjustmentForRegisterStack
get_call_reg_stack_adjustment_for_reg_stack
call_reg_stack_adjustment_for_reg_stack
BNGetCallStackAdjustment
get_call_stack_adjustment
call_stack_adjustment
BNGetCallTypeAdjustment
get_call_type_adjustment
call_type_adjustment
BNGetCommentForAddress
get_comment_at
comment_at
BNGetConstantData
get_constant_data
constant_data
BNGetConstantsReferencedByInstruction
get_constants_referenced_by
constants_referenced_by
BNGetConstantsReferencedByInstructionIfAvailable
get_constants_referenced_by_address_if_available
constants_referenced_by_address_if_available
BNGetFlagsReadByLiftedILInstruction
get_flags_read_by_lifted_il_instruction
BNGetFlagsWrittenByLiftedILInstruction
get_flags_written_by_lifted_il_instruction
BNGetFunctionTagsOfType
get_function_tags
function_tags
BNGetAutoFunctionTagsOfType
get_function_tags
function_tags
BNGetUserFunctionTagsOfType
get_function_tags
function_tags
BNGetFunctionTags
get_function_tags
function_tags
BNGetAutoFunctionTags
get_function_tags
function_tags
BNGetUserFunctionTags
get_function_tags
function_tags
BNGetHighLevelILVariableReferences
get_hlil_var_refs
BNGetHighLevelILVariableReferencesFrom
get_hlil_var_refs_from
BNGetHighLevelILVariableReferencesInRange
get_hlil_var_refs_from
BNGetIndirectBranchesAt
get_indirect_branches_at
indirect_branches_at
BNGetInstructionHighlight
get_instr_highlight
instr_highlight
BNGetInstructionContainingAddress
get_instruction_containing_address
instruction_containing_address
BNGetIntegerConstantDisplayType
get_int_display_type
int_display_type
BNGetIntegerConstantDisplayTypeEnumerationType
get_int_enum_display_typeid
int_enum_display_typeid
get_int_display_type_and_typeid
int_display_type_and_typeid
BNGetLiftedILForInstruction
get_lifted_il_at
BNGetLiftedILFlagDefinitionsForUse
get_lifted_il_flag_definitions_for_use
BNGetLiftedILFlagUsesForDefinition
get_lifted_il_flag_uses_for_definition
BNGetLiftedILInstructionsForAddress
get_lifted_ils_at
get_llil_at
BNGetLowLevelILInstructionsForAddress
get_llils_at
BNGetLowLevelILForInstruction
get_low_level_il_at
BNGetLowLevelILExitsForInstruction
get_low_level_il_exits_at
BNGetParameterValueAtInstruction
get_parameter_at
parameter_at
BNGetParameterValueAtLowLevelILInstruction
get_parameter_at_low_level_il_instruction
parameter_at_low_level_il_instruction
BNGetRegistersReadByInstruction
get_regs_read_by
registers_read_by
BNGetRegistersWrittenByInstruction
get_regs_written_by
registers_written_by
BNGetRegisterValueAfterInstruction
get_reg_value_after
reg_value_after
BNGetRegisterValueAtInstruction
get_reg_value_at
reg_value_at
BNGetFunctionRegisterValueAtExit
get_reg_value_at_exit
reg_value_at_exit
BNGetStackContentsAfterInstruction
get_stack_contents_after
stack_contents_after
BNGetStackContentsAtInstruction
get_stack_contents_at
stack_contents_at
BNGetStackVariableAtFrameOffset
get_stack_var_at_frame_offset
stack_var_at_frame_offset
BNGetStackVariablesReferencedByInstruction
get_stack_vars_referenced_by
stack_variables_referenced_by
BNGetStackVariablesReferencedByInstructionIfAvailable
get_stack_vars_referenced_by_address_if_available
stack_variables_referenced_by_address_if_available
BNGetAddressTags
get_tags_at
tags_at
BNGetAutoAddressTags
get_tags_at
tags_at
BNGetUserAddressTags
get_tags_at
tags_at
BNGetAddressTagsInRange
get_tags_in_range
tags_in_range
BNGetAutoAddressTagsInRange
get_tags_in_range
tags_in_range
BNGetUserAddressTagsInRange
get_tags_in_range
tags_in_range
BNGetFunctionTypeTokens
get_type_tokens
type_tokens
get_variable_by_name
BNGetFunctionGlobalPointerValue
global_pointer_value
global_pointer_value
BNFunctionHasExplicitlyDefinedType
has_explicitly_defined_type
has_explicitly_defined_type
BNHasUnresolvedIndirectBranches
has_unresolved_indirect_branches
has_unresolved_indirect_branches
BNFunctionHasUserAnnotations
has_user_annotations
has_user_annotations
BNFunctionHasUserType
has_user_type
has_user_type
BNFunctionHasVariableArguments
has_variable_arguments
has_variable_arguments
BNSetUserFunctionHasVariableArguments
has_variable_arguments
set_user_has_variable_arguments
BNSetAutoFunctionHasVariableArguments
set_auto_has_variable_arguments
set_auto_has_variable_arguments
BNGetFunctionLowestAddress
lowest_address
lowest_address
BNGetFunctionHighestAddress
highest_address
highest_address
BNGetFunctionLiftedIL
lifted_il
lifted_il
BNGetFunctionLiftedILIfAvailable
lifted_il_if_available
lifted_il_if_available
BNGetFunctionMediumLevelIL
medium_level_il
medium_level_il
BNGetFunctionMappedMediumLevelIL
mapped_medium_level_il
mapped_medium_level_il
BNGetFunctionMappedMediumLevelILIfAvailable
mmlil_if_available
mapped_medium_level_il_if_available
BNGetFunctionMediumLevelILIfAvailable
mlil_if_available
medium_level_il_if_available
BNGetFunctionHighLevelIL
high_level_il
high_level_il
BNGetFunctionHighLevelILIfAvailable
hlil_if_available
high_level_il_if_available
BNGetIndirectBranches
indirect_branches
indirect_branches
BNIsFunctionInlinedDuringAnalysis
inline_during_analysis
inline_during_analysis
BNSetUserFunctionInlinedDuringAnalysis
set_user_inline_during_analysis
set_user_inline_during_analysis
BNSetAutoFunctionInlinedDuringAnalysis
set_auto_inline_during_analysis
set_auto_inline_during_analysis
instructions
BNIsCallInstruction
is_call_instruction
is_call_instruction
BNIsFunctionPure
is_pure
is_pure
BNSetUserFunctionPure
is_pure
set_is_pure
is_thunk
BNIsVariableUserDefined
is_var_user_defined
is_variable_user_defined
llil_basic_blocks
llil_instructions
BNMarkCallerUpdatesRequired
mark_caller_updates_required
mark_caller_updates_required
BNMarkFunctionAsRecentlyUsed
mark_recent_use
mark_recent_use
BNMarkUpdatesRequired
mark_updates_required
mark_updates_required
BNGetMergedVariables
merged_vars
merged_variables
BNMergeVariables
merge_vars
merge_variables
mlil_basic_blocks
mlil_instructions
name
BNIsFunctionUpdateNeeded
needs_update
is_update_needed
BNGetFunctionParameterVariables
parameter_vars
parameter_variables
BNSetUserFunctionParameterVariables
parameter_vars
set_user_parameter_variables
BNSetAutoFunctionParameterVariables
set_auto_parameter_vars
set_auto_parameter_variables
BNGetFunctionPlatform
platform
platform
BNGetProvenanceString
provenance
provenance
BNReanalyzeFunction
reanalyze
reanalyze
BNGetFunctionRegisterStackAdjustments
reg_stack_adjustments
reg_stack_adjustments
BNSetUserFunctionRegisterStackAdjustments
reg_stack_adjustments
set_user_reg_stack_adjustments
BNSetAutoFunctionRegisterStackAdjustments
set_auto_reg_stack_adjustments
set_auto_reg_stack_adjustments
BNRequestAdvancedFunctionAnalysisData
release_advanced_analysis_data
BNReleaseAdvancedFunctionAnalysisData
request_advanced_analysis_data
BNRemoveAutoFunctionTag
remove_auto_function_tag
remove_tag
BNRemoveAutoAddressTag
remove_auto_address_tag
remove_tag
BNRemoveUserFunctionTag
remove_user_function_tag
remove_tag
BNRemoveUserAddressTag
remove_user_address_tag
remove_tag
BNRemoveAutoFunctionTagsOfType
remove_auto_function_tags_of_type
remove_tags_of_type
BNRemoveAutoAddressTagsOfType
remove_auto_address_tags_of_type
remove_tags_of_type
BNRemoveUserFunctionTagsOfType
remove_user_function_tags_of_type
remove_tags_of_type
BNRemoveUserAddressTagsOfType
remove_user_address_tags_of_type
remove_tags_of_type
BNRemoveUserCodeReference
remove_user_code_ref
remove_user_code_ref
BNRemoveUserTypeReference
remove_user_type_ref
remove_user_type_ref
BNRequestFunctionDebugReport
request_debug_report
request_debug_report
BNGetFunctionReturnRegisters
return_regs
return_registers
BNSetUserFunctionReturnRegisters
return_regs
set_user_return_registers
BNSetAutoFunctionReturnRegisters
set_auto_return_regs
set_auto_return_registers
BNGetFunctionReturnType
return_type
return_type
BNSetUserFunctionReturnType
return_type
set_user_return_type
BNSetAutoFunctionReturnType
set_auto_return_type
set_auto_return_type
session_data
set_default_session_data
BNSetAutoFunctionCallingConvention
set_auto_calling_convention
set_auto_calling_convention
BNSetAutoCallRegisterStackAdjustment
set_auto_call_reg_stack_adjustment
set_auto_call_reg_stack_adjustment
BNSetAutoCallRegisterStackAdjustmentForRegisterStack
set_auto_call_reg_stack_adjustment_for_reg_stack
set_auto_call_reg_stack_adjustment_for_reg_stack
BNSetAutoCallStackAdjustment
set_auto_call_stack_adjustment
set_auto_call_stack_adjustment
BNSetAutoFunctionCanReturn
set_auto_can_return
set_auto_can_return
BNSetAutoFunctionHasVariableArguments
set_auto_has_variable_arguments
set_auto_has_variable_arguments
BNSetAutoIndirectBranches
set_auto_indirect_branches
set_auto_indirect_branches
BNSetAutoFunctionInlinedDuringAnalysis
set_auto_inline_during_analysis
set_auto_inline_during_analysis
BNSetAutoInstructionHighlight
set_auto_instr_highlight
set_auto_instr_highlight
BNSetAutoFunctionParameterVariables
set_auto_parameter_vars
set_auto_parameter_variables
BNSetAutoFunctionPure
set_auto_pure
set_auto_pure
BNSetAutoFunctionRegisterStackAdjustments
set_auto_reg_stack_adjustments
set_auto_reg_stack_adjustments
BNSetAutoFunctionReturnRegisters
set_auto_return_regs
set_auto_return_regs
BNSetAutoFunctionReturnType
set_auto_return_type
set_auto_return_type
BNSetAutoFunctionStackAdjustment
set_auto_stack_adjustment
set_auto_stack_adjustment
BNSetFunctionAutoType
set_auto_type
set_auto_type
BNSetUserCallRegisterStackAdjustment
set_call_reg_stack_adjustment
set_user_call_reg_stack_adjustment
BNSetUserCallRegisterStackAdjustmentForRegisterStack
set_call_reg_stack_adjustment_for_reg_stack
set_user_call_reg_stack_adjustment_for_reg_stack
BNSetUserCallStackAdjustment
set_call_stack_adjustment
set_user_call_stack_adjustment
BNSetUserCallTypeAdjustment
set_call_type_adjustment
set_user_call_type_adjustment
BNSetCommentForAddress
set_comment_at
set_comment_at
BNSetIntegerConstantDisplayType
set_int_display_type
set_int_display_type
BNSetUserIndirectBranches
set_user_indirect_branches
set_user_indirect_branches
BNSetUserFunctionInlinedDuringAnalysis
set_user_inline_during_analysis
set_user_inline_during_analysis
BNSetUserInstructionHighlight
set_user_instr_highlight
set_user_instr_highlight
BNGetSplitVariables
split_vars
split_variables
BNSplitVariable
split_var
split_variable
BNGetFunctionStackAdjustment
stack_adjustment
stack_adjustment
BNSetUserFunctionStackAdjustment
stack_adjustment
set_user_stack_adjustment
BNSetAutoFunctionStackAdjustment
set_auto_stack_adjustment
set_auto_stack_adjustment
BNGetStackLayout
stack_layout
stack_layout
BNGetFunctionStart
start
start
BNGetFunctionSymbol
symbol
symbol
BNGetAddressTagReferences
tags
tags
BNIsFunctionTooLarge
too_large
too_large
total_bytes
BNGetFunctionType
type
type
BNSetFunctionUserType
type
set_user_type
BNGetFunctionTypeTokens
type_tokens
type_tokens
BNUnmergeVariables
unmerge_vars
unmerge_variables
BNGetUnresolvedIndirectBranches
unresolved_indirect_branches
unresolved_indirect_branches
BNGetUnresolvedStackAdjustmentGraph
unresolved_stack_adjustment_graph
unresolved_stack_adjustment_graph
BNUnsplitVariable
unsplit_var
unsplit_variable
BNGetUserAddressTagReferences
user_address_tags
BNGetFunctionVariables
vars
variables
BNGetFunctionData
view
view
BNGetWorkflowForFunction
workflow
Mlil
Some functions belong to the mlil mod, and should not being part of this PR, but I only noticed that after those functions where written...