aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--test/ruby/test_trace.rb15
-rw-r--r--thread.c1
2 files changed, 16 insertions, 0 deletions
diff --git a/test/ruby/test_trace.rb b/test/ruby/test_trace.rb
index 77be94e9be..0be545e515 100644
--- a/test/ruby/test_trace.rb
+++ b/test/ruby/test_trace.rb
@@ -59,4 +59,19 @@ class TestTrace < Test::Unit::TestCase
a.any? {true}
}.value, bug2722)
end
+
+ def test_trace_stackoverflow
+ assert_normal_exit("#{<<-"begin;"}\n#{<<~"end;"}")
+ begin;
+ require 'tracer'
+ class HogeError < StandardError
+ def to_s
+ message.upcase # disable tailcall optimization
+ end
+ end
+ Tracer.stdout = open(IO::NULL, "w")
+ Tracer.on
+ HogeError.new.to_s
+ end;
+ end
end
diff --git a/thread.c b/thread.c
index a93c6100bf..54b4fd599c 100644
--- a/thread.c
+++ b/thread.c
@@ -2169,6 +2169,7 @@ NORETURN(void ruby_thread_stack_overflow(rb_thread_t *th));
void
ruby_thread_stack_overflow(rb_thread_t *th)
{
+ ruby_vm_event_flags = 0;
th->raised_flag = 0;
#ifdef USE_SIGALTSTACK
if (!rb_threadptr_during_gc(th)) {