@@ -4,11 +4,10 @@ use std::ffi::CStr;
4
4
use binaryninjacore_sys:: * ;
5
5
6
6
use crate :: architecture:: CoreArchitecture ;
7
- use crate :: binary_view:: BinaryViewExt ;
8
7
use crate :: high_level_il:: HighLevelILFunction ;
9
- use crate :: low_level_il:: function :: { Finalized , LowLevelILFunction , NonSSA , RegularNonSSA } ;
8
+ use crate :: low_level_il:: RegularLowLevelILFunction ;
10
9
use crate :: medium_level_il:: MediumLevelILFunction ;
11
- use crate :: rc:: { Array , CoreArrayProvider , CoreArrayProviderInner } ;
10
+ use crate :: rc:: { Array , CoreArrayProvider , CoreArrayProviderInner , Ref } ;
12
11
use crate :: string:: BnStrCompatible ;
13
12
use crate :: { BinaryView , Function } ;
14
13
@@ -217,20 +216,19 @@ define_enum! {
217
216
} ,
218
217
BNGetValidPluginCommandsForLowLevelILFunction , BNRegisterPluginCommandForLowLevelILFunction , LowLevelILFunctionPluginCommand , CustomLowLevelILFunctionPluginCommand {
219
218
lowLevelILFunctionCommand:: lowLevelILFunctionIsValid(
220
- // TODO I don't know what Generics should be used here
221
- func: * mut BNLowLevelILFunction : & LowLevelILFunction <CoreArchitecture , Finalized , NonSSA <RegularNonSSA >> =
222
- func. handle => & LowLevelILFunction :: from_raw(
223
- BinaryView :: from_raw( view) . default_arch( ) . unwrap( ) ,
224
- func,
219
+ llil: * mut BNLowLevelILFunction : & RegularLowLevelILFunction <CoreArchitecture > =
220
+ llil. handle => & RegularLowLevelILFunction :: from_raw(
221
+ get_function_from_llil( llil) . arch( ) ,
222
+ llil,
225
223
) ,
226
224
) ,
227
225
} ,
228
226
BNGetValidPluginCommandsForLowLevelILInstruction , BNRegisterPluginCommandForLowLevelILInstruction , LowLevelILInstructionPluginCommand , CustomLowLevelILInstructionPluginCommand {
229
227
lowLevelILInstructionCommand:: lowLevelILInstructionIsValid(
230
- func : * mut BNLowLevelILFunction : & LowLevelILFunction <CoreArchitecture , Finalized , NonSSA < RegularNonSSA > > =
231
- func . handle => & LowLevelILFunction :: from_raw(
232
- BinaryView :: from_raw ( view ) . default_arch ( ) . unwrap ( ) ,
233
- func ,
228
+ llil : * mut BNLowLevelILFunction : & RegularLowLevelILFunction <CoreArchitecture > =
229
+ llil . handle => & RegularLowLevelILFunction :: from_raw(
230
+ get_function_from_llil ( llil ) . arch ( ) ,
231
+ llil ,
234
232
) ,
235
233
instr: usize : usize = instr => instr,
236
234
) ,
@@ -259,3 +257,9 @@ define_enum! {
259
257
) ,
260
258
} ,
261
259
}
260
+
261
+ // TODO merge this into the low_level_il module
262
+ unsafe fn get_function_from_llil ( llil : * mut BNLowLevelILFunction ) -> Ref < Function > {
263
+ let func = BNGetLowLevelILOwnerFunction ( llil) ;
264
+ Function :: ref_from_raw ( func)
265
+ }
0 commit comments