summaryrefslogtreecommitdiff
path: root/vm_trace.c
AgeCommit message (Collapse)Author
2012-12-21* vm_trace.c (tracepoint_new): add code to support specified thread.ko1
But not tested and this feature is not supported officially. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38531 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-21* vm_core.h, vm_trace.c: fix multi-threading bug for tracing.ko1
Move `trace_arg' from rb_tp_t::trace_arg to rb_thread_t::trace_arg. `trace_arg' may changed by multiple threads. rb_thread_t::trace_arg can represent rb_thread_t::trace_running (null or non-null) and rb_thread_t::trace_running is removed. After that, `rb_tp_t' is not needed to check tracing or not (A running thread knows tracing or not). This is why I remove tp_attr_check_active() and make new function get_trace_arg(). And this modification disable to work the following code: TracePoint.trace{|tp| Thread.new{p tp.event} # access `tp' from other threads. } I believe nobody mix threads at trace procedure. This is current limitation. * cont.c (fiber_switch, rb_cont_call): use rb_thread_t::trace_arg instead of rb_thread_t::trace_running. * test/ruby/test_settracefunc.rb: add a multi-threading test. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38524 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-21vm_trace.c: stylenobu
* vm_trace.c (rb_suppress_tracing): adjust style. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38518 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-20 * vm_trace.c (rb_suppress_tracing): remove unused variable 'vm_tracing'tarui
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38513 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-20 * vm_trace.c (rb_suppress_tracing): bugfix for vm->trace_runningtarui
counter. And if tracing is already true, vm_trace_running ops is skipped to control overflow. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38509 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-19 * vm_trace.c (rb_threadptr_exec_event_hooks): get rid of racetarui
condition. [Bug #7589] [ruby-dev:46763] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38464 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-19Revert r38371 and r38384. they didn't solve the issuenaruse
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38455 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-18* vm_trace.c (tracepoint_attr_defined_class): Clean up rdoc forzzak
TracePoint#defined_class git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38440 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-17* vm_trace.c (fill_id_and_klass): TracePoint#defined_class returnsko1
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
2012-12-14vm_trace.c: suppress warningnobu
* vm_trace.c (exec_hooks): suppress unused-variable warning by RB_UNUSED_VAR(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38384 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-14* vm_trace.c (exec_hooks): add volatile to avoid segv.naruse
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
2012-12-11vm.c: pass exceptions while handling an exceptionnobu
* vm.c (vm_exec): pass exceptions while handling an exception. * vm_trace.c (rb_threadptr_exec_event_hooks): propagate exceptions. revert r38293 partially. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38331 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-10vm_trace.c: exceptions in event hooksnobu
* 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
2012-12-06Fix typozzak
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38228 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-06* vm_trace.c: TracePoint#enable should not cause an errorko1
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
2012-12-01* vm_trace.c: add TracePoint#inspect.ko1
* 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
2012-12-01* vm_trace.c (rb_tracepoint_new): commit miss.nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38131 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-01adjust style.nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38128 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-30 [EXPERIMENTAL]ko1
* 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
2012-11-30* vm_trace.c:zzak
tracepoint_attr_return_value (TracePoint#return_value): include `:b_return` for method doc tracepoint_enable_m, tracepoint_disable_m (#enable/#disable): don't have block argument, document block scope git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38052 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-30* vm_trace.c (tracepoint_disable_m, tracepoint_enable_m):ko1
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
2012-11-30* vm_trace.c: Documentation for TracePoint APIzzak
[ruby-core:47243] [Feature #6895] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38045 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-30* vm_trace.c (set_trace_func): Formatting of params and eventszzak
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38037 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-29 [EXPERIMENTAL: NEED DISCUSS]ko1
* vm_trace.c: add events * :thread_begin - hook at thread beggining. * :thead_end - hook at thread ending. * :b_call - hook at block enter. * :b_return - hook at block leave. This change slow down block invocation. Please try and give us feedback until 2.0 code freeze. * include/ruby/ruby.h: ditto. * compile.c (rb_iseq_compile_node): ditto. * insns.def: ditto. * thread.c: ditto. * vm.c: ditto. * include/ruby/debug.h: add a comment. * test/ruby/test_settracefunc.rb: add a tests. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38007 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-29* include/ruby/debug.h: add rb_debug_inspector_* APIs.ko1
* vm_backtrace.c: ditto. * common.mk: add dpendency from vm_backtrace.o to include/ruby/debug.h. * proc.c (rb_binding_new_with_cfp): constify. * vm.c (rb_vm_get_ruby_level_next_cfp): consitify. * vm_core.h, vm_trace.c: move decls. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37979 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-29* include/ruby/debug.h: provide rb_tracearg_*() APIs,ko1
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
2012-11-29* vm_trace.c (rb_tracepoint_attr_method_id):ko1
rename TracePoint#id to TracePoint#method_id. * include/ruby/debug.h: ditto. * test/ruby/test_settracefunc.rb: ditto, git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37973 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-29* vm_trace.c (rb_tracepoint_attr_defined_class):ko1
rename TracePoint#klass to TracePoint#defined_class. [ruby-core:50187] Re: [ruby-trunk - Feature #6895] * include/ruby/debug.h: ditto. * test/ruby/test_settracefunc.rb: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37972 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-26* vm_trace.c: rename TracePoint#file and TracePoint#lineko1
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
2012-11-26* vm_core.h: add members to rb_trace_arg_t:ko1
* `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
2012-11-24* vm_trace.c (rb_tracepoint_attr_raised_exception): should not checkko1
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
2012-11-20* include/ruby/debug.h: introdudced.ko1
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
2012-11-20* vm_trace.c: rename and add TracePoint APIs.ko1
(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
2012-11-20* vm_trace.c: add two methods:ko1
(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
2012-10-23* eval_error.c (error_print), vm_eval.c (eval_string_with_cref),ko1
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
2012-10-21* vm_trace.c (rb_threadptr_exec_event_hooks, rb_suppress_tracing):ktsj
constified. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37281 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-10-21* vm_core.h (rb_vm_t::trace_running): add a new fieldktsj
`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
2012-09-08internal.h: allocator function in rb_classext_tnobu
* internal.h (struct rb_classext_struct): move allocator function into rb_classext_t from ordinary method table. [ruby-dev:46121] [Feature #6993] * object.c (rb_obj_alloc): call allocator function directly. * vm_method.c (rb_define_alloc_func, rb_undef_alloc_func) (rb_get_alloc_func): use allocator function in rb_classext_t. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36925 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-08-31vm_trace.c: freed memory accessnobu
* vm_trace.c (clean_hooks): do not access freed memory. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36862 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-08-31vm_trace.c: uninitialized statenobu
* 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
2012-08-30vm_trace.c: warningnobu
* vm_trace.c (exec_hooks): supress clobbered warning. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36855 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-08-22* vm_trace.c: support TracePoint. [ruby-trunk - Feature #6895]ko1
* 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
2012-08-17vm_trace.c: remove meaningless assingmentsnobu
* vm_trace.c (call_trace_func): remove meaningless assingments to same variables. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36716 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-08-16* vm_trace.c, vm_core.h: simplify tracing mechanism.ko1
(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
2012-08-15* vm_trace.c: separate trace_func related functions fromko1
thread.c. * thread.c: ditto. * common.mk: add vm_trace.o. * inits.c: call Init_vm_trace(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36703 b2dd03c8-39d4-4d8f-98ff-823fe69b080e