summaryrefslogtreecommitdiff
path: root/vm_backtrace.c
diff options
context:
space:
mode:
authorko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-08-03 01:50:50 +0000
committerko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-08-03 01:50:50 +0000
commit03cad835932205e9ca9e11bed1e6394272ca3f5c (patch)
treee99a0dbd528aa38d6b384eaa2518a9f0510e5838 /vm_backtrace.c
parent0cd7f5fe87fb2d047a5423cd24c24f9fea530502 (diff)
downloadruby-03cad835932205e9ca9e11bed1e6394272ca3f5c.tar.gz
* vm_core.h: introduce VM_FRAME_RUBYFRAME_P()
and VM_FRAME_CFRAME_P(). Most of case, RUBY_VM_NORMAL_ISEQ_P() is no longer needed. * vm_core.h: introduce rb_obj_is_iseq(). * cont.c, vm.c: VM_FRAME_MAGIC_DUMMY with VM_FRAME_FLAG_CFRAME. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55804 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'vm_backtrace.c')
-rw-r--r--vm_backtrace.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/vm_backtrace.c b/vm_backtrace.c
index bdc996d7ce..cbde6409a5 100644
--- a/vm_backtrace.c
+++ b/vm_backtrace.c
@@ -37,13 +37,12 @@ calc_lineno(const rb_iseq_t *iseq, const VALUE *pc)
int
rb_vm_get_sourceline(const rb_control_frame_t *cfp)
{
- int lineno = 0;
- const rb_iseq_t *iseq = cfp->iseq;
-
- if (RUBY_VM_NORMAL_ISEQ_P(iseq)) {
- lineno = calc_lineno(cfp->iseq, cfp->pc);
+ if (VM_FRAME_RUBYFRAME_P(cfp) && cfp->iseq) {
+ return calc_lineno(cfp->iseq, cfp->pc);
+ }
+ else {
+ return 0;
}
- return lineno;
}
typedef struct rb_backtrace_location_struct {