オフセットマップの値を出力するこの関数が機能しています。
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
ここで、値を文字列変数に取得して、目的に合わせて変換したいと思います。に置き換えFormat.fprintf fmt
ましたPrintf.sprintf
が、機能しません。コンパイル エラー:
Error: This expression has type
Format.formatter -> Cvalue.V_Offsetmap.t -> unit
but an expression was expected of type unit -> 'a -> string