File tree Expand file tree Collapse file tree 3 files changed +24
-1
lines changed Expand file tree Collapse file tree 3 files changed +24
-1
lines changed Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ use core::hash::{Hash, Hasher};
2
2
3
3
use binaryninjacore_sys:: BNFreeMediumLevelILFunction ;
4
4
use binaryninjacore_sys:: BNGetMediumLevelILBasicBlockList ;
5
+ use binaryninjacore_sys:: BNGetMediumLevelILIndexForInstruction ;
5
6
use binaryninjacore_sys:: BNGetMediumLevelILInstructionCount ;
6
7
use binaryninjacore_sys:: BNGetMediumLevelILOwnerFunction ;
7
8
use binaryninjacore_sys:: BNGetMediumLevelILSSAForm ;
@@ -65,6 +66,19 @@ impl MediumLevelILFunction {
65
66
self . instruction_from_idx ( expr_idx) . lift ( )
66
67
}
67
68
69
+ pub fn instruction_from_instruction_idx ( & self , instr_idx : usize ) -> MediumLevelILInstruction {
70
+ MediumLevelILInstruction :: new ( self . to_owned ( ) , unsafe {
71
+ BNGetMediumLevelILIndexForInstruction ( self . handle , instr_idx)
72
+ } )
73
+ }
74
+
75
+ pub fn lifted_instruction_from_instruction_idx (
76
+ & self ,
77
+ instr_idx : usize ,
78
+ ) -> MediumLevelILLiftedInstruction {
79
+ self . instruction_from_instruction_idx ( instr_idx) . lift ( )
80
+ }
81
+
68
82
pub fn instruction_count ( & self ) -> usize {
69
83
unsafe { BNGetMediumLevelILInstructionCount ( self . handle ) }
70
84
}
Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ pub struct MediumLevelILInstruction {
18
18
pub function : Ref < MediumLevelILFunction > ,
19
19
pub address : u64 ,
20
20
pub index : usize ,
21
+ pub size : usize ,
21
22
pub kind : MediumLevelILInstructionKind ,
22
23
}
23
24
@@ -704,7 +705,12 @@ impl MediumLevelILInstruction {
704
705
} ) ,
705
706
// translated directly into a list for Expression or Variables
706
707
// TODO MLIL_MEMORY_INTRINSIC_SSA needs to be handled properly
707
- MLIL_CALL_OUTPUT | MLIL_CALL_PARAM | MLIL_CALL_PARAM_SSA | MLIL_CALL_OUTPUT_SSA | MLIL_MEMORY_INTRINSIC_OUTPUT_SSA | MLIL_MEMORY_INTRINSIC_SSA => {
708
+ MLIL_CALL_OUTPUT
709
+ | MLIL_CALL_PARAM
710
+ | MLIL_CALL_PARAM_SSA
711
+ | MLIL_CALL_OUTPUT_SSA
712
+ | MLIL_MEMORY_INTRINSIC_OUTPUT_SSA
713
+ | MLIL_MEMORY_INTRINSIC_SSA => {
708
714
unreachable ! ( )
709
715
}
710
716
} ;
@@ -713,6 +719,7 @@ impl MediumLevelILInstruction {
713
719
function,
714
720
address : op. address ,
715
721
index,
722
+ size : op. size ,
716
723
kind,
717
724
}
718
725
}
@@ -1022,6 +1029,7 @@ impl MediumLevelILInstruction {
1022
1029
function : self . function . clone ( ) ,
1023
1030
address : self . address ,
1024
1031
index : self . index ,
1032
+ size : self . size ,
1025
1033
kind,
1026
1034
}
1027
1035
}
Original file line number Diff line number Diff line change @@ -27,6 +27,7 @@ pub struct MediumLevelILLiftedInstruction {
27
27
pub function : Ref < MediumLevelILFunction > ,
28
28
pub address : u64 ,
29
29
pub index : usize ,
30
+ pub size : usize ,
30
31
pub kind : MediumLevelILLiftedInstructionKind ,
31
32
}
32
33
You can’t perform that action at this time.
0 commit comments