* vm_trace.c: prohibit to specify normal events and internal events

simultaneously.
  I will introduce special care for internal events later.
* ext/-test-/tracepoint/tracepoint.c: test this behavior.
* test/-ext-/tracepoint/test_tracepoint.rb: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43854 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
ko1 2013-11-26 08:41:44 +00:00
Родитель 079009fb93
Коммит 5b40cb6a2c
5 изменённых файлов: 32 добавлений и 1 удалений

Просмотреть файл

@ -1,3 +1,13 @@
Tue Nov 26 17:38:16 2013 Koichi Sasada <ko1@atdot.net>
* vm_trace.c: prohibit to specify normal events and internal events
simultaneously.
I will introduce special care for internal events later.
* ext/-test-/tracepoint/tracepoint.c: test this behavior.
* test/-ext-/tracepoint/test_tracepoint.rb: ditto.
Tue Nov 26 16:30:31 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
* file.c (rb_readlink): fix buffer overflow on a long symlink. since

2
NEWS
Просмотреть файл

@ -331,3 +331,5 @@ with all sufficient information, see the ChangeLog file.
* RUBY_INTERNAL_EVENT_FREEOBJ
* RUBY_INTERNAL_EVENT_GC_START
* RUBY_INTERNAL_EVENT_GC_END
* Note that you *can not* specify "internal events" with normal events
(such as RUBY_EVENT_CALL, RUBY_EVENT_RETURN) simultaneously.

Просмотреть файл

@ -69,9 +69,18 @@ tracepoint_track_objspace_events(VALUE self)
return result;
}
static VALUE
tracepoint_specify_normal_and_internal_events(VALUE self)
{
VALUE tpval = rb_tracepoint_new(0, RUBY_INTERNAL_EVENT_NEWOBJ | RUBY_EVENT_CALL, 0, 0);
rb_tracepoint_enable(tpval);
return Qnil; /* should not be reached */
}
void
Init_tracepoint(void)
{
VALUE mBug = rb_define_module("Bug");
rb_define_module_function(mBug, "tracepoint_track_objspace_events", tracepoint_track_objspace_events, 0);
rb_define_module_function(mBug, "tracepoint_specify_normal_and_internal_events", tracepoint_specify_normal_and_internal_events, 0);
}

Просмотреть файл

@ -50,4 +50,8 @@ class TestTracepointObj < Test::Unit::TestCase
assert_operator gc_start_count, :>=, gc_end_count
assert_operator stat2[:count] - stat1[:count] - 1, :<=, gc_end_count
end
def test_tracepoint_specify_normal_and_internal_events
assert_raise(TypeError){ Bug.tracepoint_specify_normal_and_internal_events }
end
end

Просмотреть файл

@ -105,7 +105,13 @@ thval2thread_t(VALUE thval)
static rb_event_hook_t *
alloc_event_hook(rb_event_hook_func_t func, rb_event_flag_t events, VALUE data, rb_event_hook_flag_t hook_flags)
{
rb_event_hook_t *hook = ALLOC(rb_event_hook_t);
rb_event_hook_t *hook;
if ((events & RUBY_INTERNAL_EVENT_MASK) && (events & ~RUBY_INTERNAL_EVENT_MASK)) {
rb_raise(rb_eTypeError, "Can not specify normal event and internal event simultaneously.");
}
hook = ALLOC(rb_event_hook_t);
hook->hook_flags = hook_flags;
hook->events = events;
hook->func = func;