Version française
Home     About     Download     Resources     Contact us    
Browse thread
Smart caml editor and smart debugger
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Gabriel Kerneis <kerneis@p...>
Subject: Re: [Caml-list] Smart caml editor and smart debugger
On Fri, Oct 15, 2010 at 11:38:21AM +0200, Dumitru Potop-Butucaru wrote:
>     Is there some tool allowing me, for instance,
>     to choose the functions whose calls I want to trace?
>     (so that the call and its parameters are
>     automatically logged).

In a toplevel, use the #trace directive:

# let rec f x = if x = 0 then 42 else f (x-1);;
value f : int -> int = <fun>
# #trace f;;
f is now traced.
# f 3 ;;
f <-- 3
f <-- 2
f <-- 1
f <-- 0
f --> 42
f --> 42
f --> 42
f --> 42
- : int = 42

Best,
-- 
Gabriel