Project

General

Profile

Bug #18053 » 0001-Add-assertions-for-bad-backtrace-locations.patch

Patch with additional assertions - jhawthorn (John Hawthorn), 07/29/2021 11:08 PM

View differences:

vm_backtrace.c
return calc_lineno(loc->body.iseq.iseq, loc->body.iseq.pc);
case LOCATION_TYPE_CFUNC:
if (loc->body.cfunc.prev_loc) {
return location_lineno(loc->body.cfunc.prev_loc);
}
return 0;
VM_ASSERT(loc->body.cfunc.prev_loc != loc);
return location_lineno(loc->body.cfunc.prev_loc);
}
return 0;
default:
rb_bug("location_lineno: unreachable");
UNREACHABLE;
rb_bug("location_lineno: unreachable");
UNREACHABLE;
}
}
......
return rb_iseq_path(loc->body.iseq.iseq);
case LOCATION_TYPE_CFUNC:
if (loc->body.cfunc.prev_loc) {
VM_ASSERT(loc->body.cfunc.prev_loc != loc);
return location_path(loc->body.cfunc.prev_loc);
}
return Qnil;
......
return rb_iseq_realpath(loc->body.iseq.iseq);
case LOCATION_TYPE_CFUNC:
if (loc->body.cfunc.prev_loc) {
VM_ASSERT(loc->body.cfunc.prev_loc != loc);
return location_realpath(loc->body.cfunc.prev_loc);
}
return Qnil;
......
break;
case LOCATION_TYPE_CFUNC:
if (loc->body.cfunc.prev_loc) {
VM_ASSERT(loc->body.cfunc.prev_loc != loc);
file = rb_iseq_path(loc->body.cfunc.prev_loc->body.iseq.iseq);
lineno = location_lineno(loc->body.cfunc.prev_loc);
}
......
loc->type = LOCATION_TYPE_CFUNC;
loc->body.cfunc.mid = mid;
if (arg->prev_loc) {
VM_ASSERT(loc != arg->prev_loc);
loc->body.cfunc.prev_loc = arg->prev_loc;
}
else if (arg->prev_cfp) {
......
arg->init_loc->type = LOCATION_TYPE_ISEQ;
arg->init_loc->body.iseq.iseq = iseq;
arg->init_loc->body.iseq.pc = pc;
VM_ASSERT(loc != arg->init_loc);
loc->body.cfunc.prev_loc = arg->prev_loc = arg->init_loc;
}
else {
(2-2/2)