@@ -595,7 +595,7 @@ pub trait ArchitectureWithFunctionContext: Architecture {
595595
596596pub struct FunctionLifterContext {
597597 pub ( crate ) handle : * mut BNFunctionLifterContext ,
598- pub function : * mut BNLowLevelILFunction ,
598+ pub function : Ref < LowLevelILMutableFunction > ,
599599 pub platform : Ref < Platform > ,
600600 pub logger : Ref < Logger > ,
601601 pub blocks : Vec < Ref < BasicBlock < NativeBlock > > > ,
@@ -604,7 +604,7 @@ pub struct FunctionLifterContext {
604604 pub inlined_remapping : HashMap < Location , Location > ,
605605 pub user_indirect_branches : HashMap < Location , HashSet < Location > > ,
606606 pub auto_indirect_branches : HashMap < Location , HashSet < Location > > ,
607- // pub inlined_calls: HashSet<u64>,
607+ pub inlined_calls : HashSet < u64 > ,
608608}
609609
610610unsafe fn lifter_context_slice < ' a , T > ( ptr : * const T , len : usize ) -> & ' a [ T ] {
@@ -620,6 +620,14 @@ impl FunctionLifterContext {
620620 pub unsafe fn from_raw (
621621 function : * mut BNLowLevelILFunction ,
622622 handle : * mut BNFunctionLifterContext ,
623+ ) -> Self {
624+ Self :: from_raw_with_arch ( function, handle, None )
625+ }
626+
627+ pub ( crate ) unsafe fn from_raw_with_arch (
628+ function : * mut BNLowLevelILFunction ,
629+ handle : * mut BNFunctionLifterContext ,
630+ arch : Option < CoreArchitecture > ,
623631 ) -> Self {
624632 debug_assert ! ( !function. is_null( ) ) ;
625633 debug_assert ! ( !handle. is_null( ) ) ;
@@ -699,9 +707,18 @@ impl FunctionLifterContext {
699707 }
700708 }
701709
710+ let inlined_calls: HashSet < u64 > =
711+ lifter_context_slice ( flc_ref. inlinedCalls , flc_ref. inlinedCallsCount )
712+ . iter ( )
713+ . copied ( )
714+ . collect ( ) ;
715+
702716 FunctionLifterContext {
703717 handle,
704- function : BNNewLowLevelILFunctionReference ( function) ,
718+ function : LowLevelILMutableFunction :: ref_from_raw_with_arch (
719+ BNNewLowLevelILFunctionReference ( function) ,
720+ arch,
721+ ) ,
705722 platform,
706723 logger,
707724 blocks,
@@ -710,6 +727,7 @@ impl FunctionLifterContext {
710727 inlined_remapping,
711728 user_indirect_branches,
712729 auto_indirect_branches,
730+ inlined_calls,
713731 }
714732 }
715733
@@ -739,14 +757,6 @@ impl FunctionLifterContext {
739757 }
740758}
741759
742- impl Drop for FunctionLifterContext {
743- fn drop ( & mut self ) {
744- if !self . function . is_null ( ) {
745- unsafe { BNFreeLowLevelILFunction ( self . function ) } ;
746- }
747- }
748- }
749-
750760// TODO: WTF?!?!?!?
751761pub struct CoreArchitectureList ( * mut * mut BNArchitecture , usize ) ;
752762
@@ -1765,7 +1775,9 @@ where
17651775 LowLevelILMutableFunction :: from_raw_with_arch ( function, Some ( * custom_arch. as_ref ( ) ) )
17661776 } ;
17671777
1768- let mut ctx = unsafe { FunctionLifterContext :: from_raw ( function, context) } ;
1778+ let mut ctx = unsafe {
1779+ FunctionLifterContext :: from_raw_with_arch ( function, context, Some ( * custom_arch. as_ref ( ) ) )
1780+ } ;
17691781 custom_arch. lift_function ( llil, & mut ctx)
17701782 }
17711783
0 commit comments