@@ -99,6 +99,45 @@ let no_lineq = ref []
9999let add_no_lineq s = no_lineq := s :: ! no_lineq
100100
101101
102+ (* * Expands a list of function address hex strings with the direct application
103+ callees of each function, as recorded in saved function info. Silently
104+ skips functions whose info is not yet available (e.g. first analysis pass).
105+ Emits a diagnostics log entry for every callee added. *)
106+ let expand_fns_with_callees (fns : string list ) : string list =
107+ List. fold_left
108+ (fun acc faddr_str ->
109+ match string_to_doubleword faddr_str with
110+ | Error _ -> acc
111+ | Ok faddr ->
112+ let callees =
113+ try
114+ let finfo = load_function_info faddr in
115+ List. filter_map
116+ (fun ct ->
117+ if ct#is_app_call then Some ct#get_app_address
118+ else None )
119+ finfo#get_callees
120+ with _ -> []
121+ in
122+ List. fold_left
123+ (fun acc2 callee ->
124+ let s = callee#to_hex_string in
125+ if List. mem s acc2 then
126+ acc2
127+ else
128+ begin
129+ log_diagnostics_result
130+ ~tag: " expand_fns_with_callees"
131+ __FILE__ __LINE__
132+ [" add callee: " ^ s ^ " of: " ^ faddr_str];
133+ s :: acc2
134+ end )
135+ acc
136+ callees)
137+ fns
138+ fns
139+
140+
102141let analyze_x86_function faddr f count =
103142 let _ =
104143 if system_settings#show_function_timing then
@@ -173,7 +212,9 @@ let analyze_x86_function faddr f count =
173212
174213
175214let analyze starttime =
176- let fns_included = included_functions () in
215+ let fns_included =
216+ let fns = included_functions () in
217+ if fn_include_callees () then expand_fns_with_callees fns else fns in
177218 let fns_excluded = excluded_functions () in
178219 let count = ref 0 in
179220 let failedfunctions = ref [] in
@@ -409,7 +450,9 @@ let analyze_mips_function faddr f count =
409450
410451
411452let analyze_mips starttime =
412- let fns_included = included_functions () in
453+ let fns_included =
454+ let fns = included_functions () in
455+ if fn_include_callees () then expand_fns_with_callees fns else fns in
413456 let fns_excluded = excluded_functions () in
414457 let count = ref 0 in
415458 let failedfunctions = ref [] in
@@ -565,7 +608,9 @@ let analyze_arm_function faddr f count =
565608
566609
567610let analyze_arm starttime =
568- let fns_included = included_functions () in
611+ let fns_included =
612+ let fns = included_functions () in
613+ if fn_include_callees () then expand_fns_with_callees fns else fns in
569614 let fns_excluded = excluded_functions () in
570615 let count = ref 0 in
571616 let failedfunctions = ref [] in
@@ -678,7 +723,9 @@ let analyze_pwr_function
678723
679724
680725let analyze_pwr (starttime : float ) =
681- let fns_included = included_functions () in
726+ let fns_included =
727+ let fns = included_functions () in
728+ if fn_include_callees () then expand_fns_with_callees fns else fns in
682729 let fns_excluded = excluded_functions () in
683730 let count = ref 0 in
684731 begin
0 commit comments