Skip to content
Snippets Groups Projects
Commit 0a41f035 authored by Valentin Perrelle's avatar Valentin Perrelle Committed by David Bühler
Browse files

[Eva] api: fix a bug in the computation of callsites

parent c9164f5b
No related branches found
No related tags found
No related merge requests found
...@@ -739,7 +739,7 @@ let is_reachable_kinstr kinstr = ...@@ -739,7 +739,7 @@ let is_reachable_kinstr kinstr =
let callers kf = let callers kf =
let f = function let f = function
| [] | [_] -> None | [] | [_] -> None
| _ :: (kf,_) :: _-> Some kf | _ :: (caller,_) :: _-> Some caller
in in
at_start_of kf |> callstacks |> at_start_of kf |> callstacks |>
List.filter_map f |> List.sort_uniq Kernel_function.compare List.filter_map f |> List.sort_uniq Kernel_function.compare
...@@ -750,8 +750,10 @@ let callsites kf = ...@@ -750,8 +750,10 @@ let callsites kf =
let module Map = Kernel_function.Map in let module Map = Kernel_function.Map in
let f acc = function let f acc = function
| [] | (_,Cil_types.Kglobal) :: _ -> acc | [] | (_,Cil_types.Kglobal) :: _ -> acc
| (kf,Kstmt stmt) :: _-> | [(_,Kstmt _)] -> assert false (* End of callstacks should have no callsite *)
Map.update kf (fun old -> Some (stmt :: Option.value ~default:[] old)) acc | (_kf,Kstmt stmt) :: (caller,_) :: _ -> (* kf = _kf *)
Map.update caller
(fun old -> Some (stmt :: Option.value ~default:[] old)) acc
in in
at_start_of kf |> callstacks |> at_start_of kf |> callstacks |>
List.fold_left f Map.empty |> Map.to_seq |> List.of_seq |> List.fold_left f Map.empty |> Map.to_seq |> List.of_seq |>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment