Automatic trace utility

Hi All,

Recently I'm writing lots of recursive functions that I'd like to test by examining their backtraces. I wonder if something like the following is possible:

def foo (x, y, z)
  trace if $DEBUG
# ...
end

foo(1,2,3)
"trace: foo (1,2,3) called"

The trace function would have to figure out function's name and list arguments. If someone has some ideas, please let me know. Thanks in anticipation.

There's #set_trace_func built-in to Ruby. Or for a more complete
solution try Calibre's TracePoint. (see Rubyforge)

HTH,
T.

Ruby Bug Validator does all of the above and can apply filters and also
colour highlight items of interest that you select based on keywords.

        http://www.softwareverify.com

Stephen

···

In message <200512042117.50348.kyku@os.pl>, Kyku <kyku@os.pl> writes

The trace function would have to figure out function's name and list
arguments.

--
Stephen Kellett
Object Media Limited http://www.objmedia.demon.co.uk/software.html
Computer Consultancy, Software Development
Windows C++, Java, Assembler, Performance Analysis, Troubleshooting

Quite nice, but how about auto-magical tracing of passed arguments.

···

Dnia niedziela, 4 grudnia 2005 22:03, Trans napisał:

There's #set_trace_func built-in to Ruby. Or for a more complete
solution try Calibre's TracePoint. (see Rubyforge)

HTH,
T.

--------------------------------
Darmowe konta pocztowe 500 MB !!
    http://www.free.os.pl