From a82fcc52ee1145f61698ea7e71141ebd76ff04d2 Mon Sep 17 00:00:00 2001 From: Alasdair Armstrong Date: Tue, 31 Oct 2017 17:16:47 +0000 Subject: Improvements to register read tracing in ocaml backend --- lib/ocaml_rts/Makefile | 2 +- lib/ocaml_rts/sail_lib.ml | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/ocaml_rts/Makefile b/lib/ocaml_rts/Makefile index eee59dd7..3d837e25 100644 --- a/lib/ocaml_rts/Makefile +++ b/lib/ocaml_rts/Makefile @@ -53,7 +53,7 @@ import: rsync -rv --include "*/" --include="*.ml" --include="*.mli" --exclude="*" $(BITBUCKET_ROOT)/lem/ocaml-lib/ lem main: import - ocamlbuild -pkg uint -pkg zarith main.native + ocamlbuild -pkg uint -pkg zarith main.native -use-ocamlfind clean: rm -r linksem diff --git a/lib/ocaml_rts/sail_lib.ml b/lib/ocaml_rts/sail_lib.ml index 249d61fc..c550b2ce 100644 --- a/lib/ocaml_rts/sail_lib.ml +++ b/lib/ocaml_rts/sail_lib.ml @@ -28,6 +28,9 @@ let trace str = let trace_write name str = trace ("Write: " ^ name ^ " " ^ str) +let trace_read name str = + trace ("Read: " ^ name ^ " " ^ str) + let sail_trace_call (type t) (name : string) (in_string : string) (string_of_out : t -> string) (f : _ -> t) = let module M = struct exception Return of t end @@ -444,3 +447,7 @@ let string_of_zbool = function let string_of_zreal r = Num.string_of_num r let string_of_zstring str = "\"" ^ String.escaped str ^ "\"" +let rec string_of_list sep string_of = function + | [] -> "" + | [x] -> string_of x + | x::ls -> (string_of x) ^ sep ^ (string_of_list sep string_of ls) -- cgit v1.2.3