I edit the question, because I have advanced with the program. It still does not do what I want. So the problem is due to ignorance of Ocaml, the variable "aux2"
is of type: "Function_From.Deps.t -> Function_From.Deps.t"
. C How could I access each one and display the data ?,that is to say, enter the type on the right and the left.
This is my code:
open Cil_types
open Function_Froms
(* usage: frama-c file.c -load-script print_vals.ml *)
let aux depsReturn =
match depsReturn with
|Function_Froms.Memory.Top -> Locations.Zone.bottom
|Function_Froms.Memory.Bottom -> Locations.Zone.bottom
|Function_Froms.Memory.Map m -> Function_Froms.Memory.fold (fun z v acc ->
let open DepsOrUnassigned in
match v with
| DepsBottom | Unassigned -> acc
| AssignedFrom _ | MaybeAssignedFrom _ -> Locations.Zone.join z acc)
m Locations.Zone.bottom
let () =
Db.Main.extend (fun () ->
Format.printf "computing value...@.";
!Db.Value.compute();
let fun_name = "main" in
let kf = Globals.Functions.find_by_name fun_name in
if !Db.From.is_computed kf then
Format.printf "Do to pass?...\n";
let deps = !Db.From.get kf in
let depsReturn = deps.deps_table in
let aux1 =aux depsReturn
in
let aux2 =Function_Froms.Memory.substitute depsReturn in
Format.printf " Passed \n";
)
This is the result you get with -deps and below that I would like to put.
....
[from] ====== DEPENDENCIES COMPUTED ======
These dependencies hold at termination for the executions that terminate:
[from] Function f:
y FROM x
\result FROM x
[from] Function main:
y FROM \nothing
z FROM \nothing (and SELF)
[from] ====== END OF DEPENDENCIES ======
computing value...
Do to pass?...
To Pass..
new way:
Function main:
sub fuction: y
val: nothing
sub function: z
val: nothing
Thanks.