summaryrefslogtreecommitdiff
path: root/vm_backtrace.c
diff options
context:
space:
mode:
authorko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-11-14 12:58:36 +0000
committerko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-11-14 12:58:36 +0000
commit665ba24b446971fdf652a9c57c32b176d0018636 (patch)
tree31357897b60fbef63947d89ad7cd0f0ae95025bc /vm_backtrace.c
parentfe3decb2017af2092d4b2181e27e4cd8f6bbf4fa (diff)
downloadruby-665ba24b446971fdf652a9c57c32b176d0018636.tar.gz
remove `trace` instruction. [Feature #14104]
* tool/instruction.rb: create `trace_` prefix instructions. * compile.c (ADD_TRACE): do not add `trace` instructions but add TRACE link elements. TRACE elements will be unified with a next instruction as instruction information. * vm_trace.c (update_global_event_hook): modify all ISeqs when hooks are enabled. * iseq.c (rb_iseq_trace_set): added to toggle `trace_` instructions. * vm_insnhelper.c (vm_trace): added. This function is a body of `trace_` prefix instructions. * vm_insnhelper.h (JUMP): save PC to a control frame. * insns.def (trace): removed. * vm_exec.h (INSN_ENTRY_SIG): add debug output (disabled). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60763 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'vm_backtrace.c')
-rw-r--r--vm_backtrace.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/vm_backtrace.c b/vm_backtrace.c
index fa9295daab..0418b6c4d0 100644
--- a/vm_backtrace.c
+++ b/vm_backtrace.c
@@ -40,7 +40,14 @@ int
rb_vm_get_sourceline(const rb_control_frame_t *cfp)
{
if (VM_FRAME_RUBYFRAME_P(cfp) && cfp->iseq) {
- return calc_lineno(cfp->iseq, cfp->pc);
+ const rb_iseq_t *iseq = cfp->iseq;
+ int line = calc_lineno(iseq, cfp->pc);
+ if (line != 0) {
+ return line;
+ }
+ else {
+ return FIX2INT(rb_iseq_first_lineno(iseq));
+ }
}
else {
return 0;