I have this function working which prints out the value in an offsetmap:
let pretty_offsetmap_original lv fmt offsetmap =
begin match offsetmap with
| None -> Format.fprintf fmt "<BOTTOM>"
| Some off ->
let typ = Some (typeOfLval lv)
in
Format.fprintf fmt "%a%a"
pretty_lval_or_absolute lv
(Cvalue.V_Offsetmap.pretty_typ typ) off
end
Now I would like to get the value in to a string variable to transform it for my purpose. I replaced Format.fprintf fmt
by Printf.sprintf
but it does not work. The compiling error:
Error: This expression has type
Format.formatter -> Cvalue.V_Offsetmap.t -> unit
but an expression was expected of type unit -> 'a -> string