From a05f5f3c1fe0b0521c9777c68150cf1e5247bf99 Mon Sep 17 00:00:00 2001 From: Dan Gohman Date: Wed, 14 Oct 2015 15:14:23 -0700 Subject: [PATCH] Experimental interpreter tracing code. --- ml-proto/spec/eval.ml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/ml-proto/spec/eval.ml b/ml-proto/spec/eval.ml index 32d16ba0a9..527e2f5060 100644 --- a/ml-proto/spec/eval.ml +++ b/ml-proto/spec/eval.ml @@ -131,6 +131,7 @@ let func_type instance f = *) let rec eval_expr (c : config) (e : expr) = + let result_value = ( match e.it with | Nop -> None @@ -250,6 +251,14 @@ let rec eval_expr (c : config) (e : expr) = let mem = some_memory c e.at in eval_hostop c.instance.host mem hostop vs e.at + ) in + + let value_str = match result_value with + | Some v -> string_of_value v + | None -> "no value" in + Printf.printf "trace: %s: %s\n" (string_of_region e.at) value_str; + result_value + and eval_expr_opt c = function | Some e -> eval_expr c e | None -> None