1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* thread.c (ruby_suppress_tracing): restore the state and invoke

the func with normal state.  a patch from Satoshi Shiba <shiba
  AT rvm.jp> at [ruby-dev:42162].  [ruby-core:31783]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29155 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2010-09-01 03:56:39 +00:00
parent 3121057559
commit 8086b525ac
4 changed files with 25 additions and 3 deletions

View file

@ -1,3 +1,9 @@
Wed Sep 1 12:56:36 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
* thread.c (ruby_suppress_tracing): restore the state and invoke
the func with normal state. a patch from Satoshi Shiba <shiba
AT rvm.jp> at [ruby-dev:42162]. [ruby-core:31783]
Tue Aug 31 21:10:23 2010 Tanaka Akira <akr@fsij.org> Tue Aug 31 21:10:23 2010 Tanaka Akira <akr@fsij.org>
* ext/pathname/pathname.c (path_exist_p): Pathname#exist? translated * ext/pathname/pathname.c (path_exist_p): Pathname#exist? translated

View file

@ -46,4 +46,16 @@ class TestTrace < Test::Unit::TestCase
ensure ensure
untrace_var :$x untrace_var :$x
end end
def test_trace_break
bug2722 = '[ruby-core:31783]'
a = Object.new.extend(Enumerable)
def a.each
yield
end
assert(Thread.start {
Thread.current.add_trace_func(proc{})
a.any? {true}
}.value, bug2722)
end
end end

View file

@ -4099,6 +4099,7 @@ ruby_suppress_tracing(VALUE (*func)(VALUE, int), VALUE arg, int always)
rb_thread_t *th = GET_THREAD(); rb_thread_t *th = GET_THREAD();
int state, tracing; int state, tracing;
volatile int raised; volatile int raised;
volatile int outer_state;
VALUE result = Qnil; VALUE result = Qnil;
if ((tracing = th->tracing) != 0 && !always) { if ((tracing = th->tracing) != 0 && !always) {
@ -4109,6 +4110,8 @@ ruby_suppress_tracing(VALUE (*func)(VALUE, int), VALUE arg, int always)
} }
raised = rb_threadptr_reset_raised(th); raised = rb_threadptr_reset_raised(th);
outer_state = th->state;
th->state = 0;
PUSH_TAG(); PUSH_TAG();
if ((state = EXEC_TAG()) == 0) { if ((state = EXEC_TAG()) == 0) {
@ -4124,6 +4127,7 @@ ruby_suppress_tracing(VALUE (*func)(VALUE, int), VALUE arg, int always)
if (state) { if (state) {
JUMP_TAG(state); JUMP_TAG(state);
} }
th->state = outer_state;
return result; return result;
} }

View file

@ -1,11 +1,11 @@
#define RUBY_VERSION "1.9.3" #define RUBY_VERSION "1.9.3"
#define RUBY_RELEASE_DATE "2010-08-31" #define RUBY_RELEASE_DATE "2010-09-01"
#define RUBY_PATCHLEVEL -1 #define RUBY_PATCHLEVEL -1
#define RUBY_BRANCH_NAME "trunk" #define RUBY_BRANCH_NAME "trunk"
#define RUBY_RELEASE_YEAR 2010 #define RUBY_RELEASE_YEAR 2010
#define RUBY_RELEASE_MONTH 8 #define RUBY_RELEASE_MONTH 9
#define RUBY_RELEASE_DAY 31 #define RUBY_RELEASE_DAY 1
#include "ruby/version.h" #include "ruby/version.h"