Fixes#4051. Wrong line numbers in Kernel#caller inside set_trace_func (with code to reproduce)
#4051 was largely already fixed but the backtrace elements themselves had the
wrong line (which was why #4060 was opened).
The problem was mri changes their position of class/module/sclass from start
line to end line. We just store start line. They will also look at first
instr/node within the class/module for start line. That solution is memory
efficient but then makes those nodes report wrong lines with -S ast.
Our solution was to just add an endLine field to those nodes. The memory
increase from that is very small so I think it is ok.
The second part of this was that we build backtrace from setting line number
via a line number instr. We had no end line so we couldn't emit one. Now that
we have one we do....but only if --debug is supplied since the only instr after
this point is return and that cannot raise (so we cannot generate a backtrace).
Somewhat as a continuation of #4051 there are still some wrong line numbers passed to
set_trace_funcand in backtraces generated inside of it.
jruby 184.108.40.206-SNAPSHOT (2.3.0) 2016-08-06 3ba469b OpenJDK 64-Bit Server VM 25.91-b14 on 1.8.0_91-8u91-b14-3ubuntu1~15.10.1-b14 [linux-x86_64](latest master, 3ba469b) on
Output in MRI 2.3.1:
Output in JRuby:
You'll notice that neither the lines supplied to caller nor the ones to
set_trace_funcare correct in this case.
The text was updated successfully, but these errors were encountered: