singleton class. `set_trace_func' passed attached class (which is
attached/modified by singleton class) by 6th block parameter if it
is singleton class. Previous behavior follows this spec.
However, this method named `defined_class' should return singleton
class directly because singleton methods are defined in singleton
class. There are no compatible issue because TracePoint is introduced
after 2.0.
But compatiblity with `set_trace_func' is brokne. This means that
you can not replace all `set_trace_func' code with TracePoint
without consideration of this behavior.
[Bug #7554]
* test/ruby/test_settracefunc.rb: change a test to catch up
an above chagne.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38430 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
On test-all with -j, it may crash in TH_POP_TAG.
Detailed mechanism is not known but this fixes it.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38371 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* vm_trace.c (rb_threadptr_exec_event_hooks): exceptions in event
hooks should not propagate outside.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38293 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
when it is already enabled. TracePoint#disable is too.
[ruby-core:50561] [ruby-trunk - Bug #7513]
* test/ruby/test_settracefunc.rb: add tests.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38227 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* test/ruby/test_settracefunc.rb: add a test for this change.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38132 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* iseq.c: add following two methods.
* ISeq#line_trace_all returns all line traces (line numbers)
* ISeq#line_trace_specify(pos, set) set `pos'th line event to
specified_line event (if set is true).
These features are introduced for debuggers (mainly to make
breakpoint).
* iseq.h: add decl. of C APIs.
* test/ruby/test_iseq.rb: add tests.
* vm_trace.c: add `specified_line' event.
* include/ruby/ruby.h: ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38076 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
fix block parameter.
No arugment should be given to a block which is passed
to TracePoint#enable (and disable).
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38050 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
instead of rb_tracepoint_attr_*().
These APIs are for debuggers/profilers.
They will be explained in another docs somtime.
* vm_trace.c: ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37975 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
to TracePoint#path and TracePoint#lineno respectively.
They are consistent to RubyVM::Backtrace::Location.
* include/ruby/debug.h: ditto.
* vm_core.h: ditto.
* test/ruby/test_settracefunc.rb: ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37876 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* `klass_solved' represents klass and id is checked.
* `line' represents line calculated from cfp.
* `file' represents line calculated from cfp.
* vm_trace.c: fix to use above data stractures.
No need to calculate klass and id, line and file
pairs for each trace points.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37874 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
value before event checking.
* vm_trace.c (rb_tracepoint_attr_return_value): ditto.
* test/ruby/test_settracefunc.rb: add tests for TracePoint#return_value
and TracePoint#raised_exception.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37830 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Debugging/profiling features will be located.
* vm_trace.c: expose C-level TracePoint APIs.
Note that they are experimental.
* vm_trace.c, include/ruby/debug.h: rename `rb_hook_flag_t'
to `rb_event_hook_flag_t'.
Macro names `RUBY_HOOK_FLAG_*' are also renamed to
`RUBY_EVENT_HOOK_FLAG_*'.
* debug.h, vm_debug.h: rename debug.h to vm_debug.h.
* common.mk: ditto.
* debug.c, main.c, vm_core.h: ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37765 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
(1) TracePoint.new(...){...} creates a new trace point
but does not make it enable.
(2) TracePoint.trace(...){...} creats a new trace point
and enable it (same as old behavior).
(3) TracePoint#enable make it enable (renamed from TracePoint#retrace).
If block given, when enable only in block.
(4) TracePoint#disable make it disable (renamed from TracePoint#untrace).
If block given, when disable only in block.
(5) TracePoint#enabled? returns this trace is enable or not.
* test/ruby/test_settracefunc.rb: addd tests.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37753 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
(1) TracePoint#return_value which returns return
value on the :return and :c_return event.
(2) TracePoint#raised_exception which returns raised exception
value on the :raise event.
Eeach methods raise RuntimeError if it is called at unsupported
event.
Please review and give us feedback until next preview
release (Dec/2012) of Ruby 2.0.0.
* insns.def, vm.c, vm_eval.c, vm_insnhelper.c, eval.c, thread.c:
ditto.
* vm_trace.c, vm_core.h: move definition of rb_trace_arg_t from
vm_trace.c to vm_core.h.
Caller fills rb_trace_arg_t and pass the pointer of this variable.
* test/ruby/test_settracefunc.rb: fix tests to test this change.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37752 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
vm_trace.c (rb_suppress_tracing): use TH_PUSH_TAG() instead of
PUSH_TAG().
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37305 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
`trace_running' to store vm global tracing status.
* vm_trace.c: fix SEGV bug. event_hook was free'd
even when the hook is still used in another thread.
[ruby-dev:46141] [Bug #7032]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37280 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* vm_trace.c (rb_threadptr_exec_event_hooks): fix uninitialized state
when no events is excuted.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36861 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* test/ruby/test_settracefunc.rb: add tests for above.
* proc.c (rb_binding_new_with_cfp): add an internal function.
* vm.c (rb_vm_control_frame_id_and_class): add an internal function.
* vm_trace.c: add rb_add_event_hook2() and rb_thread_add_event_hook2().
Give us the good name for them!
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36773 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
(1) add rb_hook_list_t data structure which includes
hooks, events (flag) and `need_clean' flag.
If the last flag is true, then clean the hooks list.
In other words, deleted hooks are contained by `hooks'.
Cleanup process should run before traversing the list.
(2) Change check mechanism
See EXEC_EVENT_HOOK() in vm_core.h.
(3) Add `raw' hooks APIs
Normal hooks are guarded from exception by rb_protect().
However, this protection is overhead for too simple
functions which never cause exceptions. `raw' hooks
are executed without protection and faster.
Now, we only provide registration APIs. All `raw'
hooks are kicked under protection (same as normal hooks).
* include/ruby/ruby.h: remove internal data definition and
macros.
* internal.h (ruby_suppress_tracing), vm_trace.c: rename
ruby_suppress_tracing() to rb_suppress_tracing()
and remove unused function parameter.
* parse.y: fix to use renamed rb_suppress_tracing().
* thread.c (thread_create_core): no need to set RUBY_VM_VM.
* vm.c (mark_event_hooks): move definition to vm_trace.c.
* vm.c (ruby_vm_event_flags): add a global variable.
This global variable represents all of Threads and VM's
event masks (T1#events | T2#events | ... | VM#events).
You can check the possibility kick trace func or not
with ruby_vm_event_flags.
ruby_vm_event_flags is maintained by vm_trace.c.
* cont.c (fiber_switch, rb_cont_call): restore tracing status.
[Feature #4347]
* test/ruby/test_continuation.rb: ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36715 b2dd03c8-39d4-4d8f-98ff-823fe69b080e