From: viuginov.nickolay@gmail.com
To: ruby-core@ruby-lang.org
Subject: [ruby-core:95759] [Ruby master Bug#16334] Wrong line numbers for multiline method chains
Date: Fri, 08 Nov 2019 15:15:45 +0000 (UTC) [thread overview]
Message-ID: <redmine.issue-16334.20191108151545.aff0cfdda62778ad@ruby-lang.org> (raw)
In-Reply-To: redmine.issue-16334.20191108151545@ruby-lang.org
Issue #16334 has been reported by ViugiNick (Nickolay Viuginov).
----------------------------------------
Bug #16334: Wrong line numbers for multiline method chains
https://bugs.ruby-lang.org/issues/16334
* Author: ViugiNick (Nickolay Viuginov)
* Status: Open
* Priority: Normal
* Assignee:
* Target version:
* ruby -v:
* Backport: 2.5: UNKNOWN, 2.6: UNKNOWN
----------------------------------------
I faced a strange distribution of line numbers in bytecode for multiline expressions like this:
class Test
def method1
self
end
def method2
self
end
def method3
true
end
end
def hello
Test.new #bp here
.method1 #bp here
.method2 #bp here
.method3 #bp here
end
2.3.7 bytecode:
```
== disasm: #<ISeq:hello@/home/viuignick/.RubyMine2019.2/config/scratches/scratch.rb>
0000 trace 8 ( 14)
0002 trace 1 ( 18)
0004 getinlinecache 11, <is:0> ( 15)
0007 getconstant :Test
0009 setinlinecache <is:0>
0011 opt_send_without_block <callinfo!mid:new, argc:0, ARGS_SIMPLE>, <callcache>( 16)
0014 opt_send_without_block <callinfo!mid:method1, argc:0, ARGS_SIMPLE>, <callcache>( 17)
0017 opt_send_without_block <callinfo!mid:method2, argc:0, ARGS_SIMPLE>, <callcache>( 18)
0020 opt_send_without_block <callinfo!mid:method3, argc:0, ARGS_SIMPLE>, <callcache>
0023 trace 16 ( 19)
0025 leave ( 18)
```
As you can see there is no trace line-event instuction for line №15, because of that debuggers will not stop there. Furthermore call of the method `new` is on the line #16(actually 15), method method1 is on the line 17(actually 16), method2 is on the line 18 (actually 19)
2.5.4 bytecode
0000 getinlinecache 7, <is:0> ( 15)[LiCa]
0003 getconstant :Test
0005 setinlinecache <is:0>
0007 opt_send_without_block <callinfo!mid:new, argc:0, ARGS_SIMPLE>, <callcache>( 16)
0010 opt_send_without_block <callinfo!mid:method1, argc:0, ARGS_SIMPLE>, <callcache>( 17)
0013 opt_send_without_block <callinfo!mid:method2, argc:0, ARGS_SIMPLE>, <callcache>( 18)
0016 opt_send_without_block <callinfo!mid:method3, argc:0, ARGS_SIMPLE>, <callcache>
0019 leave ( 19)[Re]
The same situation to 2.5.*
for ruby versions > 2.5.0 work fine:
== disasm: #<ISeq:hello@/home/viuignick/.RubyMine2019.2/config/scratches/scratch.rb:14 (14,0)-(19,3)> (catch: FALSE)
0000 opt_getinlinecache 7, <is:0> ( 15)[LiCa]
0003 getconstant :Test
0005 opt_setinlinecache <is:0>
0007 opt_send_without_block <callinfo!mid:new, argc:0, ARGS_SIMPLE>, <callcache>
0010 opt_send_without_block <callinfo!mid:method1, argc:0, ARGS_SIMPLE>, <callcache>( 16)
0013 opt_send_without_block <callinfo!mid:method2, argc:0, ARGS_SIMPLE>, <callcache>( 17)
0016 opt_send_without_block <callinfo!mid:method3, argc:0, ARGS_SIMPLE>, <callcache>( 18)
0019 leave ( 19)[Re]
--
https://bugs.ruby-lang.org/
next parent reply other threads:[~2019-11-08 15:15 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <redmine.issue-16334.20191108151545@ruby-lang.org>
2019-11-08 15:15 ` viuginov.nickolay [this message]
2019-11-08 15:40 ` [ruby-core:95760] [Ruby master Bug#16334] Wrong line numbers for multiline method chains mame
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.ruby-lang.org/en/community/mailing-lists/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=redmine.issue-16334.20191108151545.aff0cfdda62778ad@ruby-lang.org \
--to=ruby-core@ruby-lang.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).