зеркало из https://github.com/github/ruby.git
* 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:
Родитель
079009fb93
Коммит
5b40cb6a2c
10
ChangeLog
10
ChangeLog
|
@ -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
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;
|
||||
|
|
Загрузка…
Ссылка в новой задаче