Automatic trace utility.

K

Kyku

--Boundary-00=_u70kD5qOhV8wfs+
Content-Type: text/plain;
charset="us-ascii"
Content-Transfer-Encoding: 7bit

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.
--Boundary-00=_u70kD5qOhV8wfs+--
 
T

Trans

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

HTH,
T.
 
K

Kyku

Dnia niedziela, 4 grudnia 2005 22:03, Trans napisa=B3:
There's #set_trace_func built-in to Ruby. Or for a more complete
solution try Calibre's TracePoint. (see Rubyforge)

HTH,
T.

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,147
Messages
2,570,833
Members
47,380
Latest member
AlinaBlevi

Latest Threads

Top