From: Rocky Bernstein Date: 2008-03-12T20:11:23+09:00 Subject: Re: Ruby 1.8.6 trace return line numbers wrong ------=_Part_8884_6111434.1205320292669 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline I tried the patch out. It works great! And it seems to match what's done on a C-RETURN. Shouldn't the same things be done with on NODE_BMETHOD? Thanks. Index: eval.c =================================================================== --- eval.c (revision 15753) +++ eval.c (working copy) @@ -5891,7 +5891,7 @@ } result = proc_invoke(body->nd_cval, rb_ary_new4(argc, argv), recv, klass); if (event_hooks) { - EXEC_EVENT_HOOK(RUBY_EVENT_RETURN, body, recv, id, klass); + EXEC_EVENT_HOOK(RUBY_EVENT_RETURN, ruby_current_node, recv, id, klass); } break; @@ -6014,7 +6014,7 @@ } POP_TAG(); if (event_hooks) { - EXEC_EVENT_HOOK(RUBY_EVENT_RETURN, body, recv, id, klass); + EXEC_EVENT_HOOK(RUBY_EVENT_RETURN, ruby_current_node, recv, id, klass); } POP_VARS(); POP_CLASS(); On Tue, Mar 11, 2008 at 10:46 PM, Nobuyoshi Nakada wrote: > Hi, > > At Tue, 11 Mar 2008 18:30:28 +0900, > Rocky Bernstein wrote in [ruby-core:15855]: > > Notice that we give a *line* trace for line 3 but the *return *line > number > > which follows that goes back to line 2. > > It yielded the first line of the method. Although it's > difficult to yield the exact line number at `end', but easy for > the last executed line. Considering the case using return, > this might be better. > > > Index: eval.c > =================================================================== > --- eval.c (revision 15746) > +++ eval.c (working copy) > @@ -6015,5 +6015,5 @@ rb_call0(klass, recv, id, oid, argc, arg > POP_TAG(); > if (event_hooks) { > - EXEC_EVENT_HOOK(RUBY_EVENT_RETURN, body, recv, id, klass); > + EXEC_EVENT_HOOK(RUBY_EVENT_RETURN, ruby_current_node, > recv, id, klass); > } > POP_VARS(); > > > -- > Nobu Nakada > > ------=_Part_8884_6111434.1205320292669 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline I tried the patch out. It works great! And it seems to match what's done on a C-RETURN.

Shouldn't the same things be done with on NODE_BMETHOD?

Thanks.

Index: eval.c
===================================================================
--- eval.c    (revision 15753)
+++ eval.c    (working copy)
@@ -5891,7 +5891,7 @@
     }
     result = proc_invoke(body->nd_cval, rb_ary_new4(argc, argv), recv, klass);
     if (event_hooks) {
-        EXEC_EVENT_HOOK(RUBY_EVENT_RETURN, body, recv, id, klass);
+        EXEC_EVENT_HOOK(RUBY_EVENT_RETURN, ruby_current_node, recv, id, klass);
     }
     break;
 
@@ -6014,7 +6014,7 @@
         }
         POP_TAG();
         if (event_hooks) {
-        EXEC_EVENT_HOOK(RUBY_EVENT_RETURN, body, recv, id, klass);
+               EXEC_EVENT_HOOK(RUBY_EVENT_RETURN, ruby_current_node, recv, id, klass);
         }
         POP_VARS();
         POP_CLASS();


On Tue, Mar 11, 2008 at 10:46 PM, Nobuyoshi Nakada <nobu@ruby-lang.org> wrote:
Hi,

At Tue, 11 Mar 2008 18:30:28 +0900,
Rocky Bernstein wrote in [ruby-core:15855]:
> Notice that we give a *line* trace for line 3 but the *return *line number
> which follows that goes back to line 2.

It yielded the first line of the method.  Although it's
difficult to yield the exact line number at `end', but easy for
the last executed line.  Considering the case using return,
this might be better.


Index: eval.c
===================================================================
--- eval.c      (revision 15746)
+++ eval.c      (working copy)
@@ -6015,5 +6015,5 @@ rb_call0(klass, recv, id, oid, argc, arg
           POP_TAG();
           if (event_hooks) {
-               EXEC_EVENT_HOOK(RUBY_EVENT_RETURN, body, recv, id, klass);
+               EXEC_EVENT_HOOK(RUBY_EVENT_RETURN, ruby_current_node, recv, id, klass);
           }
           POP_VARS();


--
Nobu Nakada


------=_Part_8884_6111434.1205320292669--