summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-05-23 09:34:09 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-05-23 09:34:09 +0000
commit0cc87df01c49ef96e4fb7cbd5ce74135c409db90 (patch)
treef978ed94e0a589e1a037e38d0388862d67801420
parentcec20793cb3dd76ea310b443171e22e24e484247 (diff)
* eval.c (rb_longjmp): get rid of reentering while debug warning.
(ruby-bugs-ja:PR473) git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3860 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog5
-rw-r--r--eval.c35
2 files changed, 35 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index 563feddf7d..0df19be2fe 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Fri May 23 18:34:05 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * eval.c (rb_longjmp): get rid of reentering while debug warning.
+ (ruby-bugs-ja:PR473)
+
Fri May 23 15:16:16 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
* pack.c (pack_unpack): sign-extend if sizeof long is bigger than
diff --git a/eval.c b/eval.c
index 2e09d9b41d..a19601700d 100644
--- a/eval.c
+++ b/eval.c
@@ -3826,6 +3826,9 @@ rb_iter_break()
NORETURN(static void rb_longjmp _((int, VALUE)));
static VALUE make_backtrace _((void));
+static int thread_set_raised();
+static void thread_reset_raised();
+
static void
rb_longjmp(tag, mesg)
int tag;
@@ -3851,14 +3854,22 @@ rb_longjmp(tag, mesg)
}
if (RTEST(ruby_debug) && !NIL_P(ruby_errinfo)
+ && !thread_set_raised()
&& !rb_obj_is_kind_of(ruby_errinfo, rb_eSystemExit)) {
VALUE e = ruby_errinfo;
+ int status;
- StringValue(e);
- warn_printf("Exception `%s' at %s:%d - %s\n",
- rb_obj_classname(ruby_errinfo),
- ruby_sourcefile, ruby_sourceline,
- RSTRING(e)->ptr);
+ PUSH_TAG(PROT_NONE);
+ if ((status = EXEC_TAG()) == 0) {
+ StringValue(e);
+ warn_printf("Exception `%s' at %s:%d - %s\n",
+ rb_obj_classname(ruby_errinfo),
+ ruby_sourcefile, ruby_sourceline,
+ RSTRING(e)->ptr);
+ }
+ POP_TAG();
+ thread_reset_raised();
+ JUMP_TAG(tag);
}
rb_trap_restore_mask();
@@ -7762,6 +7773,20 @@ struct thread_status_t {
(dst)->join = (src)->join, \
0)
+static int
+thread_set_raised()
+{
+ if (curr_thread->flags & THREAD_RAISED) return 1;
+ curr_thread->flags |= THREAD_RAISED;
+ return 0;
+}
+
+static void
+thread_reset_raised()
+{
+ curr_thread->flags &= ~THREAD_RAISED;
+}
+
static void rb_thread_ready _((rb_thread_t));
static VALUE