From: Ned Konz Date: 2001-11-17T03:24:33+09:00 Subject: [ruby-talk:25563] Re: Writting a profiler / line coverager / debugger for ruby On Friday 16 November 2001 08:10 am, Lothar Scholz wrote: > I just looked in the ruby reference and didn't find something like the > "trace" callback in python. Is it possible to specify a function that > will be called after every ruby statement. see set_trace_func ------------------------------------------------- Kernel::set_trace_func set_trace_func( aProc ) -> aProc set_trace_func( nil ) -> nil ------------------------------------------------------------------------ Establishes aProc as the handler for tracing, or disables tracing if the parameter is nil. aProc takes up to six parameters: an event name, a filename, a line number, an object id, a binding, and the name of a class. aProc is invoked whenever an event occurs. Events are: c-call (call a C-language routine), c-return (return from a C-language routine), call (call a Ruby method), class (start a class or module definition), end (finish a class or module definition), line (execute code on a new line), raise (raise an exception), and return (return from a Ruby method). Tracing is disabled within the context of aProc. See the example starting on page 271 for more information. -- Ned Konz currently: Stanwood, WA email: ned@bike-nomad.com homepage: http://bike-nomad.com