Project

General

Profile

Actions

Feature #3809

closed

allow multiple set_trace_func() calls

Added by sunaku (Suraj Kurapati) over 14 years ago. Updated about 7 years ago.

Status:
Closed
Target version:
[ruby-core:32220]

Description

=begin
Hello,

The current set_trace_func() method in Ruby 1.8 and 1.9 cannot be safely
called multiple times because each call overwrites the current trace_func.

Please consider adding a mechanism, such as the multitrace library1, to
allow users to attach multiple tracing functions simultaneously to Ruby.

An alternative to the multitrace library1 is to add some new methods:

  • attach_trace_func(proc) #=> proc
  • detach_trace_func(proc) #=> proc

When you call attach_trace_func(), it will register your tracing
function and return it. You can pass the same tracing function
later to detach_trace_func() to unregister it.

Here is a convoluted example:

detach_trace_func(attach_trace_func(proc {}))

Here is a more realistic example:

foo = proc {}
bar = proc {}
attach_trace_func foo

...

attach_trace_func bar

...

detach_trace_func foo
detach_trace_func bar

Thanks for your consideration.

=end

Actions #1

Updated by shyouhei (Shyouhei Urabe) over 14 years ago

  • Status changed from Open to Assigned

=begin

=end

Updated by mame (Yusuke Endoh) about 12 years ago

  • Description updated (diff)
  • Target version set to 2.6

Updated by trans (Thomas Sawyer) about 12 years ago

Isn't this taken care of by the new TracePoint API?

Updated by ko1 (Koichi Sasada) about 7 years ago

Please use TracePoint API.

Actions #5

Updated by ko1 (Koichi Sasada) about 7 years ago

  • Status changed from Assigned to Closed
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0