I'm trying to debug some Java code involving complicated mutually recursive functions, and wishing for a debugging facility I have only encountered in Lisp, and wondering if there is a way to implement an equivalent of it.
In Lisp, you can mark a function for tracing, and then each time it is called, a note will be printed to the console along with the argument values. (Okay, this much is easy enough to hack in any language.) Each time it returns, a note will be printed along with the return value. (This is more difficult and more valuable.) Finally, part of what makes it really valuable, recursive calls are marked with indentation. An example from http://clhs.lisp.se/Body/m_tracec.htm if the factorial function FACT is defined recursively:
;; Of course, the format of traced output is implementation-dependent.
(fact 3)
>> 1 Enter FACT 3
>> | 2 Enter FACT 2
>> | 3 Enter FACT 1
>> | | 4 Enter FACT 0
>> | | 4 Exit FACT 1
>> | 3 Exit FACT 1
>> | 2 Exit FACT 2
>> 1 Exit FACT 6
=> 6
Is there a way to do something like this in Java?