https://bugs.ruby-lang.org/https://bugs.ruby-lang.org/favicon.ico?17113305112014-11-27T11:07:06ZRuby Issue Tracking SystemRuby master - Bug #10449: [TracePoint API] Duplicated line events when using parenthesishttps://bugs.ruby-lang.org/issues/10449?journal_id=501282014-11-27T11:07:06Zko1 (Koichi Sasada)
<ul><li><strong>Status</strong> changed from <i>Open</i> to <i>Closed</i></li><li><strong>% Done</strong> changed from <i>0</i> to <i>100</i></li></ul><p>Applied in changeset r48609.</p>
<hr>
<ul>
<li>compile.c (iseq_compile_each): remove duplicated line event.<br>
[Bug <a class="issue tracker-1 status-5 priority-4 priority-default closed" title="Bug: [TracePoint API] Duplicated line events when using parenthesis (Closed)" href="https://bugs.ruby-lang.org/issues/10449">#10449</a>]</li>
<li>test/ruby/test_settracefunc.rb: add and fix tests.</li>
</ul> Ruby master - Bug #10449: [TracePoint API] Duplicated line events when using parenthesishttps://bugs.ruby-lang.org/issues/10449?journal_id=501662014-11-28T13:28:47Zdeivid (David Rodríguez)
<ul></ul><p>Hi Koichi, I've looked at the patch and it seems to me that <em>every</em> duplicated event has been removed. So if I do something like</p>
<pre><code>object.method1.method2.method3
</code></pre>
<p>only one line event will be generated. Is this the case?</p>
<p>If that's the case I actually preferred the previous behaviour so it is possible to inspect intermediate results. <code>byebug</code> is aware of this duplication and even provides an option that ignores duplicated events in case the user wants to always change line when stepping through the code.</p>
<p>I just reported this specific case cause I couldn't recognize the "separate line events" but in general I think the behaviour was fine.</p> Ruby master - Bug #10449: [TracePoint API] Duplicated line events when using parenthesishttps://bugs.ruby-lang.org/issues/10449?journal_id=501952014-11-30T02:03:29Zdeivid (David Rodríguez)
<ul></ul><p>Confirmed, this commit breaks some tests in Byebug, I think it should be reverted.</p> Ruby master - Bug #10449: [TracePoint API] Duplicated line events when using parenthesishttps://bugs.ruby-lang.org/issues/10449?journal_id=502052014-11-30T11:15:54Zdeivid (David Rodríguez)
<ul></ul><p>Actually I've given this a second thought and I'm fine with the change. The funcionality loss is minimal (and easy to do it in other ways), the patch corrects issues like this one and the code using the API will be simpler as it will not need to handle the duplication.</p>
<p>So basically, I'm fine with anything. :)</p> Ruby master - Bug #10449: [TracePoint API] Duplicated line events when using parenthesishttps://bugs.ruby-lang.org/issues/10449?journal_id=502252014-12-01T05:45:39Zko1 (Koichi Sasada)
<ul></ul><blockquote>
<p>Hi Koichi, I've looked at the patch and it seems to me that <em>every</em> duplicated event has been removed. So if I do something like</p>
<pre><code>object.method1.method2.method3
</code></pre>
<p>only one line event will be generated. Is this the case?</p>
</blockquote>
<p>Before this fix, only 1 line event (for the method chain line) is generated, isn't?</p>
<pre><code class="ruby syntaxhl" data-language="ruby"> <span class="mi">1</span> <span class="n">obj</span> <span class="o">=</span> <span class="no">Object</span><span class="p">.</span><span class="nf">new</span>
<span class="mi">2</span> <span class="k">def</span> <span class="nc">obj</span><span class="o">.</span><span class="nf">method_missing</span> <span class="o">*</span><span class="n">args</span>
<span class="mi">3</span> <span class="nb">p</span> <span class="n">args</span>
<span class="mi">4</span> <span class="nb">self</span>
<span class="mi">5</span> <span class="k">end</span>
<span class="mi">6</span>
<span class="mi">7</span> <span class="no">TracePoint</span><span class="p">.</span><span class="nf">new</span><span class="p">(</span><span class="ss">:line</span><span class="p">){</span><span class="o">|</span><span class="n">tp</span><span class="o">|</span>
<span class="mi">8</span> <span class="nb">p</span> <span class="p">[</span><span class="n">tp</span><span class="p">.</span><span class="nf">event</span><span class="p">,</span> <span class="n">tp</span><span class="p">.</span><span class="nf">lineno</span><span class="p">]</span>
<span class="mi">9</span> <span class="p">}.</span><span class="nf">enable</span><span class="p">{</span>
<span class="mi">10</span> <span class="n">obj</span><span class="p">.</span><span class="nf">method1</span><span class="p">.</span><span class="nf">method2</span><span class="p">.</span><span class="nf">method3</span> <span class="c1"># method chain line</span>
<span class="mi">11</span> <span class="p">}</span>
<span class="c1">#=></span>
<span class="n">ruby</span> <span class="mf">2.1</span><span class="o">.</span><span class="mi">4</span><span class="n">p261</span> <span class="p">(</span><span class="mi">2014</span><span class="o">-</span><span class="mi">10</span><span class="o">-</span><span class="mi">19</span> <span class="n">revision</span> <span class="mi">48004</span><span class="p">)</span> <span class="p">[</span><span class="n">x86_64</span><span class="o">-</span><span class="n">linux</span><span class="p">]</span>
<span class="p">[</span><span class="ss">:line</span><span class="p">,</span> <span class="mi">10</span><span class="p">]</span> <span class="c1">#<-- this line</span>
<span class="p">[</span><span class="ss">:line</span><span class="p">,</span> <span class="mi">3</span><span class="p">]</span>
<span class="p">[</span><span class="ss">:method1</span><span class="p">]</span>
<span class="p">[</span><span class="ss">:line</span><span class="p">,</span> <span class="mi">4</span><span class="p">]</span>
<span class="p">[</span><span class="ss">:line</span><span class="p">,</span> <span class="mi">3</span><span class="p">]</span>
<span class="p">[</span><span class="ss">:method2</span><span class="p">]</span>
<span class="p">[</span><span class="ss">:line</span><span class="p">,</span> <span class="mi">4</span><span class="p">]</span>
<span class="p">[</span><span class="ss">:line</span><span class="p">,</span> <span class="mi">3</span><span class="p">]</span>
<span class="p">[</span><span class="ss">:method3</span><span class="p">]</span>
<span class="p">[</span><span class="ss">:line</span><span class="p">,</span> <span class="mi">4</span><span class="p">]</span>
</code></pre> Ruby master - Bug #10449: [TracePoint API] Duplicated line events when using parenthesishttps://bugs.ruby-lang.org/issues/10449?journal_id=502332014-12-01T13:35:22Zdeivid (David Rodríguez)
<ul></ul><p>Oops, I need to start thinking before talking... :) The change in the behaviour actually happened in <a href="https://github.com/deivid-rodriguez/byebug/blob/master/test/commands/stepping_test.rb#L61-76" class="external">this example</a> so something like the following used to generate 2 line events before the change.</p>
<pre><code>TracePoint.new(:line){|tp|
p [tp.event, tp.lineno]
}.enable{
num = 1 ; num += 1
}
</code></pre>
<p>Using semicolon is the only case I found when this happened (other that this issue), and it's not a very popular style anyways.</p>
<p>So definitely up for keeping this fix. Could we get this backported to 2.0 and 2.1?</p>
<p>THANKS!</p> Ruby master - Bug #10449: [TracePoint API] Duplicated line events when using parenthesishttps://bugs.ruby-lang.org/issues/10449?journal_id=546882015-11-03T13:16:39Zusa (Usaku NAKAMURA)usa@garbagecollect.jp
<ul><li><strong>Backport</strong> changed from <i>2.0.0: UNKNOWN, 2.1: UNKNOWN</i> to <i>2.0.0: UNKNOWN, 2.1: REQUIRED, 2.2: DONTNEED</i></li></ul> Ruby master - Bug #10449: [TracePoint API] Duplicated line events when using parenthesishttps://bugs.ruby-lang.org/issues/10449?journal_id=546892015-11-03T13:17:01Zusa (Usaku NAKAMURA)usa@garbagecollect.jp
<ul><li><strong>Related to</strong> <i><a class="issue tracker-4 status-5 priority-4 priority-default closed" href="/issues/11651">Backport #11651</a>: Please backport r48609</i> added</li></ul> Ruby master - Bug #10449: [TracePoint API] Duplicated line events when using parenthesishttps://bugs.ruby-lang.org/issues/10449?journal_id=549252015-11-18T11:24:41Zusa (Usaku NAKAMURA)usa@garbagecollect.jp
<ul><li><strong>Backport</strong> changed from <i>2.0.0: UNKNOWN, 2.1: REQUIRED, 2.2: DONTNEED</i> to <i>2.0.0: UNKNOWN, 2.1: DONE, 2.2: DONTNEED</i></li></ul><p>ruby_2_1 r52640 merged revision(s) 48609.</p>