mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
mruby-fiber (fiber_to_s): omit position info for terminated fibers
Since Fiber#to_s did not include location information before #6105, when location information cannot be retrieved for terminated fibers, instead of meaningless information such as "(unknown):0", we omit positional information altogether for terminated fibers; ref #6111
This commit is contained in:
@@ -391,21 +391,18 @@ fiber_to_s(mrb_state *mrb, mrb_value self)
|
||||
mrb_str_cat_lit(mrb, s, ":");
|
||||
}
|
||||
mrb_str_cat_str(mrb, s, mrb_ptr_to_str(mrb, mrb_ptr(self)));
|
||||
mrb_str_cat_lit(mrb, s, " ");
|
||||
|
||||
const char *file;
|
||||
int32_t line;
|
||||
const struct RProc *p = f->cxt->cibase->proc;
|
||||
if (f->cxt->status != MRB_FIBER_TERMINATED && !MRB_PROC_CFUNC_P(p) && !MRB_PROC_ALIAS_P(p) &&
|
||||
mrb_debug_get_position(mrb, p->body.irep, 0, &line, &file)) {
|
||||
mrb_str_cat_lit(mrb, s, " ");
|
||||
mrb_str_cat_cstr(mrb, s, file);
|
||||
mrb_str_cat_lit(mrb, s, ":");
|
||||
char buf[16];
|
||||
mrb_str_cat_cstr(mrb, s, mrb_int_to_cstr(buf, sizeof(buf), line, 10));
|
||||
}
|
||||
else {
|
||||
mrb_str_cat_lit(mrb, s, "(unknown):0");
|
||||
}
|
||||
|
||||
const char *st;
|
||||
switch (fiber_ptr(self)->cxt->status) {
|
||||
|
||||
Reference in New Issue
Block a user