From: nobu.nakada@... Date: 2002-11-08T17:38:20+09:00 Subject: [ruby-dev:18699] Re: ENABLE/DISABLE_TRACE (was Re: source file name at -r option) なかだです。 At Fri, 8 Nov 2002 17:04:56 +0900, NAKAMURA, Hiroshi wrote: > > 逆に私もdebug.rbの内部をよく知らなかったりします。 > > DISABLE_TRACE()を取ってしまうとなぜかinitializeの中がトレースで > > きなくなったりとか。 > > initializeの中がトレースされない、のではなく、 > c-callである:newを呼ぶと、DISABLE_TRACEにより、 > その中で呼ばれるinitializeがトレースされない、 > ということでした。 > > という話ではない? いや、なんか操作を間違ってたようです。 > ちなみになひは現在手元では、カバレジを取るため、 > DISABLE_TRACE()をコメントアウトして使っています。 > 1.7でプロファイル、トレース、デバッグ、カバレジ取得を > する方は、気をつけてください。# ま、開発枝ですし。 ENABLE/DISABLE_TRACE()全部取っちゃってもよさそうです。 # これから日曜まで留守なので、これでいいならどなたかよろしく。 Index: eval.c =================================================================== RCS file: /cvs/ruby/src/ruby/eval.c,v retrieving revision 1.350 diff -u -2 -p -r1.350 eval.c --- eval.c 7 Nov 2002 19:18:10 -0000 1.350 +++ eval.c 8 Nov 2002 08:34:54 -0000 @@ -894,6 +894,4 @@ static VALUE trace_func = 0; static int tracing = 0; static void call_trace_func _((char*,NODE*,VALUE,ID,VALUE)); -#define ENABLE_TRACE() (tracing &= ~2) -#define DISABLE_TRACE() (tracing |= 2) #define SET_CURRENT_SOURCE() (ruby_sourcefile = ruby_current_node->nd_file, \ @@ -3795,5 +3793,4 @@ rb_yield_0(val, self, klass, pcall) { NODE *node; - volatile int old_tracing = tracing; volatile VALUE result = Qnil; volatile VALUE old_cref; @@ -3878,5 +3875,4 @@ rb_yield_0(val, self, klass, pcall) } else { - ENABLE_TRACE(); result = rb_eval(self, node); } @@ -3904,5 +3900,4 @@ rb_yield_0(val, self, klass, pcall) POP_TAG(); POP_ITER(); - tracing = old_tracing; pop_state: POP_CLASS(); @@ -4577,8 +4572,6 @@ rb_call0(klass, recv, id, oid, argc, arg if (trace_func) { int state; - volatile int old_tracing = tracing; call_trace_func("c-call", ruby_current_node, recv, id, klass); - DISABLE_TRACE(); PUSH_TAG(PROT_FUNC); if ((state = EXEC_TAG()) == 0) { @@ -4586,5 +4579,4 @@ rb_call0(klass, recv, id, oid, argc, arg } POP_TAG(); - tracing = old_tracing; ruby_current_node = ruby_frame->node; call_trace_func("c-return", ruby_current_node, recv, id, klass); @@ -5049,5 +5041,4 @@ eval(self, src, scope, file, line) NODE *nodesave = ruby_current_node; volatile int iter = ruby_frame->iter; - volatile int old_tracing = tracing; int state; @@ -5112,5 +5103,4 @@ eval(self, src, scope, file, line) } if (!NIL_P(result)) ruby_errinfo = result; - ENABLE_TRACE(); result = eval_node(self, node); } @@ -5154,5 +5144,4 @@ eval(self, src, scope, file, line) ruby_current_node = nodesave; ruby_set_current_source(); - tracing = old_tracing; if (state) { if (state == TAG_RAISE) { @@ -5388,5 +5377,4 @@ rb_load(fname, wrap) volatile VALUE wrapper = 0; volatile VALUE self = ruby_top_self; - volatile int old_tracing = tracing; NODE *saved_cref = ruby_cref; TMP_PROTECT; @@ -5443,5 +5431,4 @@ rb_load(fname, wrap) ALLOW_INTS; if (ruby_nerrs == 0) { - ENABLE_TRACE(); eval_node(self, node); } @@ -5460,5 +5447,4 @@ rb_load(fname, wrap) POP_VARS(); ruby_wrapper = wrapper; - tracing = old_tracing; if (ruby_nerrs > 0) { ruby_nerrs = 0; -- --- 僕の前にBugはない。 --- 僕の後ろにBugはできる。 中田 伸悦