From: mame@... Date: 2019-11-08T15:40:30+00:00 Subject: [ruby-core:95760] [Ruby master Bug#16334] Wrong line numbers for multiline method chains Issue #16334 has been updated by mame (Yusuke Endoh). A new line number counting mechanism was introduced at 2.6. The patch would be too big to backport to 2.5. @usa, what do you think? ---------------------------------------- Bug #16334: Wrong line numbers for multiline method chains https://bugs.ruby-lang.org/issues/16334#change-82578 * 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: # 0000 trace 8 ( 14) 0002 trace 1 ( 18) 0004 getinlinecache 11, ( 15) 0007 getconstant :Test 0009 setinlinecache 0011 opt_send_without_block , ( 16) 0014 opt_send_without_block , ( 17) 0017 opt_send_without_block , ( 18) 0020 opt_send_without_block , 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, ( 15)[LiCa] 0003 getconstant :Test 0005 setinlinecache 0007 opt_send_without_block , ( 16) 0010 opt_send_without_block , ( 17) 0013 opt_send_without_block , ( 18) 0016 opt_send_without_block , 0019 leave ( 19)[Re] ``` The same situation to 2.5.* for ruby versions > 2.5.0 work fine: ``` == disasm: # (catch: FALSE) 0000 opt_getinlinecache 7, ( 15)[LiCa] 0003 getconstant :Test 0005 opt_setinlinecache 0007 opt_send_without_block , 0010 opt_send_without_block , ( 16) 0013 opt_send_without_block , ( 17) 0016 opt_send_without_block , ( 18) 0019 leave ( 19)[Re] ``` -- https://bugs.ruby-lang.org/ Unsubscribe: