From: Robert Feldt Date: 2001-11-17T02:47:25+09:00 Subject: [ruby-talk:25546] Re: Writting a profiler / line coverager / debugger for ruby On Sat, 17 Nov 2001, 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. > $ ri set_trace ------------------------------------------------- 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. Regards, /Robert