summaryrefslogtreecommitdiff
path: root/vm_backtrace.c
diff options
context:
space:
mode:
authorko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-11-09 05:22:51 (GMT)
committerko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-11-09 05:22:51 (GMT)
commit3b7373fd00a0ba456498a7b7d6de2a47c96434a2 (patch)
tree6e1f16aabe8a9f0176d9fb7140caf113c76de626 /vm_backtrace.c
parent976b6df9596a2077f09f6bed1796a02a229498d1 (diff)
fix backtrace on argment error.
* vm_backtrace.c (rb_backtrace_use_iseq_first_lineno_for_last_location): added. It modifies last location's line as corresponding iseq's first line number. * vm_args.c (raise_argument_error): use added function. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60725 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'vm_backtrace.c')
-rw-r--r--vm_backtrace.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/vm_backtrace.c b/vm_backtrace.c
index 6977218..f22e3f2 100644
--- a/vm_backtrace.c
+++ b/vm_backtrace.c
@@ -585,6 +585,25 @@ rb_backtrace_to_str_ary(VALUE self)
return bt->strary;
}
+void
+rb_backtrace_use_iseq_first_lineno_for_last_location(VALUE self)
+{
+ const rb_backtrace_t *bt;
+ const rb_iseq_t *iseq;
+ rb_backtrace_location_t *loc;
+
+ GetCoreDataFromValue(self, rb_backtrace_t, bt);
+ VM_ASSERT(bt->backtrace_size > 0);
+
+ loc = &bt->backtrace[bt->backtrace_size - 1];
+ iseq = loc->body.iseq.iseq;
+
+ VM_ASSERT(loc->type == LOCATION_TYPE_ISEQ);
+
+ loc->body.iseq.lineno.lineno = FIX2INT(iseq->body->location.first_lineno);
+ loc->type = LOCATION_TYPE_ISEQ_CALCED;
+}
+
static VALUE
location_create(rb_backtrace_location_t *srcloc, void *btobj)
{