summaryrefslogtreecommitdiff
path: root/vm_backtrace.c
diff options
context:
space:
mode:
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 bdc996d..cbde640 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 {