diff options
Diffstat (limited to 'Mwrap.xs')
-rw-r--r-- | Mwrap.xs | 23 |
1 files changed, 14 insertions, 9 deletions
@@ -12,24 +12,29 @@ */ typedef struct src_loc * Devel__Mwrap__SrcLoc; +/* keep this consistent with mwrap_httpd.h write_loc_name */ static SV *location_string(struct src_loc *l) { - SV *ret; + SV *ret = newSV(0); if (l->f) { - ret = newSV(0); + sv_catpv(ret, l->f->fn); if (l->lineno == UINT_MAX) - sv_setpvf(ret, "%s:-", l->f->fn); + sv_catpvs(ret, ":-"); else - sv_setpvf(ret, "%s:%zu", l->f->fn, l->lineno); - } else { + sv_catpvf(ret, ":%zu", l->lineno); + } + if (l->bt_len) { char **s = bt_syms(l->bt, l->bt_len); - - if (!s) return &PL_sv_undef; - ret = newSVpvn(s[0], strlen(s[0])); + if (s) { + if (l->f) + sv_catpvs(ret, "\n"); + sv_catpv(ret, s[0]); + for (uint32_t i = 1; i < l->bt_len; ++i) + sv_catpvf(ret, "\n%s", s[i]); + } free(s); } - return ret; } |