diff options
| author | Rubens Brandao <git@rubens.io> | 2024-05-21 13:25:03 -0300 |
|---|---|---|
| committer | Kyle Martin <krm504@nyu.edu> | 2024-05-28 19:26:10 -0400 |
| commit | 9ca13512527ca62effce85bfcd9c41b8ed9cb86c (patch) | |
| tree | 9c2d2a68bf8ab2d24b670977c34a93362a2415b4 /rust/src/types.rs | |
| parent | 2c69eb22efddebde1027ba6cc62b446b052a35b6 (diff) | |
Implement python MLIL related functions
add `MediumLevelILInstruction::tokens`
add `MediumLevelILInstruction::value`
add `MediumLevelILInstruction::possible_values`
add `MediumLevelILInstruction::branch_dependence`
add `MediumLevelILInstruction::ssa_memory_version`
add `MediumLevelILInstruction::expr_type`
add `MediumLevelILInstruction::possible_values_with_options`
add `MediumLevelILInstruction::possible_ssa_variable_values`
add `MediumLevelILInstruction::ssa_variable_version`
add `MediumLevelILInstruction::variable_for_register`
add `MediumLevelILInstruction::variable_for_flag`
add `MediumLevelILInstruction::variable_for_stack_location`
add `MediumLevelILInstruction::register_value`
add `MediumLevelILInstruction::register_value_after`
add `MediumLevelILInstruction::possible_register_values`
add `MediumLevelILInstruction::possible_register_values_after`
add `MediumLevelILInstruction::flag_value`
add `MediumLevelILInstruction::flag_value_after`
add `MediumLevelILInstruction::possible_flag_values`
add `MediumLevelILInstruction::possible_flag_values_after`
add `MediumLevelILInstruction::stack_contents`
add `MediumLevelILInstruction::stack_contents_after`
add `MediumLevelILInstruction::possible_stack_contents`
add `MediumLevelILInstruction::possible_stack_contents_after`
add `MediumLevelILInstruction::branch_dependence_at`
add `MediumLevelILInstruction::split_var_for_definition`
move functions
add `MediumLevelILFunction::current_address`
add `MediumLevelILFunction::set_current_address`
add `MediumLevelILFunction::basic_block_containing`
add `MediumLevelILFunction::finalize`
add `MediumLevelILFunction::generate_ssa_form`
add `MediumLevelILFunction::ssa_variable_definition`
add `MediumLevelILFunction::ssa_memory_definition`
add `MediumLevelILFunction::ssa_variable_uses`
add `MediumLevelILFunction::ssa_memory_uses`
add `MediumLevelILFunction::is_ssa_variable_live`
add `MediumLevelILFunction::variable_definitions`
add `MediumLevelILFunction::variable_uses`
add `MediumLevelILFunction::live_instruction_for_variable`
add `MediumLevelILFunction::ssa_variable_value`
add `MediumLevelILFunction::create_graph`
add `MediumLevelILFunction::variables`
add `MediumLevelILFunction::aliased_variables`
add `MediumLevelILFunction::ssa_variables`
add `MediumLevelILInstruction::set_expr_type`
fix `MediumLevelILInstruction::generate_ssa_form` redundant type
Diffstat (limited to 'rust/src/types.rs')
| -rw-r--r-- | rust/src/types.rs | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/rust/src/types.rs b/rust/src/types.rs index 7adc449e..29cdb2d3 100644 --- a/rust/src/types.rs +++ b/rust/src/types.rs @@ -24,6 +24,7 @@ use crate::{ callingconvention::CallingConvention, filemetadata::FileMetadata, function::Function, + mlil::MediumLevelILFunction, rc::*, string::{raw_to_string, BnStrCompatible, BnString}, symbol::Symbol, @@ -51,6 +52,8 @@ pub type TypeClass = BNTypeClass; pub type NamedTypeReferenceClass = BNNamedTypeReferenceClass; pub type MemberAccess = BNMemberAccess; pub type MemberScope = BNMemberScope; +pub type ILBranchDependence = BNILBranchDependence; +pub type DataFlowQueryOption = BNDataFlowQueryOption; //////////////// // Confidence @@ -1442,6 +1445,41 @@ impl SSAVariable { } } +impl CoreArrayProvider for SSAVariable { + type Raw = usize; + type Context = Variable; + type Wrapped<'a> = Self; +} + +unsafe impl CoreArrayProviderInner for SSAVariable { + unsafe fn free(raw: *mut Self::Raw, _count: usize, _context: &Self::Context) { + BNFreeILInstructionList(raw) + } + + unsafe fn wrap_raw<'a>(raw: &'a Self::Raw, context: &'a Self::Context) -> Self::Wrapped<'a> { + SSAVariable::new(*context, *raw) + } +} + +impl CoreArrayProvider for Array<SSAVariable> { + type Raw = BNVariable; + type Context = Ref<MediumLevelILFunction>; + type Wrapped<'a> = Self; +} + +unsafe impl CoreArrayProviderInner for Array<SSAVariable> { + unsafe fn free(raw: *mut Self::Raw, _count: usize, _context: &Self::Context) { + BNFreeVariableList(raw) + } + + unsafe fn wrap_raw<'a>(raw: &'a Self::Raw, context: &'a Self::Context) -> Self::Wrapped<'a> { + let mut count = 0; + let versions = + unsafe { BNGetMediumLevelILVariableSSAVersions(context.handle, raw, &mut count) }; + Array::new(versions, count, Variable::from_raw(*raw)) + } +} + /////////////// // NamedVariable |
