mruby-fiber (fiber_to_s): retrieve position from terminated fibers; #6105

Since `cxt->ci` points to the last active callinfo, `cxt->ci == cxt->cibase`
does not mean it does not have correct `proc` information, so we have
removed the `f->cxt->ci > f->cxt->cibase` check. Instead, just in case
`proc` does not have `irep` information, we try to confirm `proc` does not
point to `CFUNC` nor is not an alias.
This commit is contained in:
Yukihiro "Matz" Matsumoto
2023-12-08 09:33:05 +09:00
parent fdea7924fe
commit 645a464b2d
+3 -2
View File
@@ -381,8 +381,9 @@ fiber_to_s(mrb_state *mrb, mrb_value self)
const char *file;
int32_t line;
if (f->cxt->ci > f->cxt->cibase &&
mrb_debug_get_position(mrb, f->cxt->cibase->proc->body.irep, 0, &line, &file)) {
const struct RProc *p = f->cxt->cibase->proc;
if (!MRB_PROC_CFUNC_P(p) && !MRB_PROC_ALIAS_P(p) &&
mrb_debug_get_position(mrb, p->body.irep, 0, &line, &file)) {
mrb_str_cat_cstr(mrb, s, file);
mrb_str_cat_lit(mrb, s, ":");
char buf[16];