Forum: Ruby Automatic trace utility.

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
F694b99916656d000c57b6a9d9326d67?d=identicon&s=25 kyku (Guest)
on 2005-12-04 21:16
(Received via mailing list)
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.
45196398e9685000d195ec626d477f0e?d=identicon&s=25 transfire (Guest)
on 2005-12-04 22:05
(Received via mailing list)
There's #set_trace_func built-in to Ruby. Or for a more complete
solution try Calibre's TracePoint. (see Rubyforge)

HTH,
T.
Dba0cb4cdad3b8e3b7ed0fddff5d20a5?d=identicon&s=25 snail (Guest)
on 2005-12-05 12:26
(Received via mailing list)
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.

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
F694b99916656d000c57b6a9d9326d67?d=identicon&s=25 kyku (Guest)
on 2005-12-05 12:46
(Received via mailing list)
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.

Quite nice, but how about auto-magical tracing of passed arguments.
This topic is locked and can not be replied to.