Hi Ramana, There's nothing specific but the new DebuggingInterface structure should allow you to build this yourself.
First build the new compiler with "make compiler" then compile your function with PolyML.Compiler.debug := true; before it. You don't need to compile your whole program with debugging; just the bit with the function you're interested in.
PolyML.Compiler.debug := false; (* Don't compile this with debugging! *) open PolyML.DebuggerInterface PolyML.NameSpace;
fun trace(fnName, _) = if String.isSubstring "myname" fnName then let val args = debugFunctionArg(hd(debugState(Thread.Thread.self()))) in PolyML.prettyPrint(TextIO.print, 90 (* Line length *)) (displayVal(args, 100 (* Depth *), PolyML.globalNameSpace)) end else (); setOnEntry(SOME trace);
Run your program and every time it enters a function that matches the test it will print the arguments.
The DebuggerInterface structure is still a bit fluid so some things may change before the final release.
David
On 11/10/2015 08:20, Ramana Kumar wrote:
Hi all,
Does Poly/ML include any facility for tracing calls to (certain) functions? I am interested in generating a log of all calls to certain functions (including their arguments), in order, during the run of some program.
Perhaps there is something in the profiler that can help with this?
Cheers, Ramana
polyml mailing list polyml at inf.ed.ac.uk http://lists.inf.ed.ac.uk/mailman/listinfo/polyml