Skip to content

Commit

Permalink
Remove debug printout.
Browse files Browse the repository at this point in the history
  • Loading branch information
jerhard committed Dec 11, 2023
1 parent d139cee commit 8705369
Showing 1 changed file with 4 additions and 11 deletions.
15 changes: 4 additions & 11 deletions src/common/util/modularHeuristics.ml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,8 @@ let contains_function_call_through_pointer (f : fundec) : bool =
| _ -> DoChildren
end in
ignore (visitCilFunction visitor f);
let result = !contains_call in
Printf.printf "contains_function_call_through_pointer: %s -> %b\n" f.svar.vname result;
result
!contains_call


let collect_functions_without_call_through_pointers (file : file) : fundec list =
let functions_without_call_through_pointers = ref [] in
Expand Down Expand Up @@ -54,25 +53,19 @@ let get_called_functions (f : Cil.fundec) : Cil.varinfo list =
(* TODO: Mark function that are passed to pthread_create as non-modular, or automatically analyze them non-modularly if they are created as threads *)
let collect_functions_without_function_pointers (find_varinfo_fundec) (file : Cil.file) : Cil.fundec list =
let functions_without_call_through_pointers = collect_functions_without_call_through_pointers file in
Printf.printf "functions_without_call_through_pointers: %s\n" (String.concat ", " (List.map (fun f -> f.svar.vname) functions_without_call_through_pointers));
let only_good_callees (f: fundec) : bool =
let callees = get_called_functions f in
let callees = (List.map find_varinfo_fundec) callees in
Printf.printf "callees: %s\n" (String.concat ", " (List.map (fun f -> BatOption.map_default (fun f -> f.svar.vname) "None" f) callees));
let is_good g = match g with
| None ->
(* Assume unknown functions do not spawn / execute function pointers *)
true
| Some g ->
List.mem g functions_without_call_through_pointers
in
let result = List.for_all is_good callees in
Printf.printf "only_good_callees: %s -> %b\n" f.svar.vname result;
result
List.for_all is_good callees
in
let result = List.filter only_good_callees functions_without_call_through_pointers in
Printf.printf "functions_without_function_pointers: %s\n" (String.concat ", " (List.map (fun f -> f.svar.vname) result));
result
List.filter only_good_callees functions_without_call_through_pointers

module StringSet = BatSet.Make(String)

Expand Down

0 comments on commit 8705369

Please sign in to comment.