Граф коммитов

139 Коммитов

Автор SHA1 Сообщение Дата
naruse 056bdfd2e5 Revert r38371 and r38384. they didn't solve the issue
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38455 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-19 02:25:40 +00:00
zzak ec3226d826 * vm_trace.c (tracepoint_attr_defined_class): Clean up rdoc for
TracePoint#defined_class


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38440 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-18 04:18:06 +00:00
ko1 6247099f4c * vm_trace.c (fill_id_and_klass): TracePoint#defined_class returns
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-17 20:28:51 +00:00
nobu 688f3ec67d vm_trace.c: suppress warning
* 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 18:59:12 +00:00
naruse 497f8904cb * vm_trace.c (exec_hooks): add volatile to avoid segv.
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-14 01:38:14 +00:00
nobu 63d0ea4c03 vm.c: pass exceptions while handling an exception
* 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-11 18:45:43 +00:00
nobu 13e83d055f vm_trace.c: exceptions in event hooks
* 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-10 06:23:44 +00:00
zzak 5ffc1a3aaa Fix typo
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38228 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-06 04:57:20 +00:00
ko1 c2f5a57403 * vm_trace.c: TracePoint#enable should not cause an error
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-06 03:13:50 +00:00
ko1 921385a644 * vm_trace.c: add TracePoint#inspect.
* 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 17:47:37 +00:00
nobu e78cf44a99 * vm_trace.c (rb_tracepoint_new): commit miss.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38131 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-01 15:26:52 +00:00
nobu 66fd9d44d8 adjust style.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38128 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-01 15:25:28 +00:00
ko1 12f2f7371f [EXPERIMENTAL]
* 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 17:00:30 +00:00
zzak 57540a4932 * vm_trace.c:
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 10:29:49 +00:00
ko1 6df1b3a9de * vm_trace.c (tracepoint_disable_m, tracepoint_enable_m):
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 09:55:32 +00:00
zzak f2fee84466 * vm_trace.c: Documentation for TracePoint API
[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 09:25:24 +00:00
zzak 0d672c18cf * vm_trace.c (set_trace_func): Formatting of params and events
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38037 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-30 06:15:59 +00:00
ko1 4db8340398 [EXPERIMENTAL: NEED DISCUSS]
* 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 22:28:16 +00:00
ko1 585ac7f1a2 * include/ruby/debug.h: add rb_debug_inspector_* APIs.
* 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 07:05:27 +00:00
ko1 3f606b7063 * include/ruby/debug.h: provide rb_tracearg_*() APIs,
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 06:43:31 +00:00
ko1 479e396192 * vm_trace.c (rb_tracepoint_attr_method_id):
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 05:57:35 +00:00
ko1 89c889d4e7 * vm_trace.c (rb_tracepoint_attr_defined_class):
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-29 05:52:27 +00:00
ko1 d187f4bc21 * vm_trace.c: rename TracePoint#file and TracePoint#line
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 23:25:21 +00:00
ko1 8c138db3d2 * vm_core.h: add members to rb_trace_arg_t:
* `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-26 23:01:45 +00:00
ko1 9d803dfd5f * vm_trace.c (rb_tracepoint_attr_raised_exception): should not check
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-24 04:12:30 +00:00
ko1 cea7600b52 * include/ruby/debug.h: introdudced.
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 12:57:49 +00:00
ko1 1da641a16b * vm_trace.c: rename and add TracePoint APIs.
(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 11:05:20 +00:00
ko1 553931962a * vm_trace.c: add two methods:
(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-11-20 09:48:24 +00:00
ko1 378041cfbf * eval_error.c (error_print), vm_eval.c (eval_string_with_cref),
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-23 20:42:45 +00:00
ktsj 811d072dcb * vm_trace.c (rb_threadptr_exec_event_hooks, rb_suppress_tracing):
constified.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37281 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-10-21 10:14:29 +00:00
ktsj f21d7d9831 * vm_core.h (rb_vm_t::trace_running): add a new field
`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-10-21 10:14:26 +00:00
nobu 5fbfc21b67 internal.h: allocator function in rb_classext_t
* 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-09-08 09:52:26 +00:00
nobu dde690bc32 vm_trace.c: freed memory access
* 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-31 05:03:47 +00:00
nobu 4faf219853 vm_trace.c: uninitialized state
* 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-31 05:02:47 +00:00
nobu d90b023603 vm_trace.c: warning
* 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-30 07:20:05 +00:00
ko1 d28e07d57b * vm_trace.c: support TracePoint. [ruby-trunk - Feature #6895]
* 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-22 05:12:31 +00:00
nobu 78f8ad683b vm_trace.c: remove meaningless assingments
* 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-17 02:13:31 +00:00
ko1 4a4a702e61 * vm_trace.c, vm_core.h: simplify tracing mechanism.
(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-16 11:41:24 +00:00
ko1 8eb93103e4 * vm_trace.c: separate trace_func related functions from
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
2012-08-15 04:39:10 +00:00