/* dump.c
*
- * Copyright (c) 1991-1997, Larry Wall
+ * Copyright (c) 1991-2000, Larry Wall
*
* You may distribute under the terms of either the GNU General Public
* License or the Artistic License, as specified in the README file.
*/
#include "EXTERN.h"
+#define PERL_IN_DUMP_C
#include "perl.h"
-
-#ifndef DBL_DIG
-#define DBL_DIG 15 /* A guess that works lots of places */
-#endif
+#include "regcomp.h"
void
-dump_indent(I32 level, PerlIO *file, const char* pat, ...)
+Perl_dump_indent(pTHX_ I32 level, PerlIO *file, const char* pat, ...)
{
- dTHR;
va_list args;
-
va_start(args, pat);
- PerlIO_printf(file, "%*s", level*PL_dumpindent, "");
- PerlIO_vprintf(file, pat, args);
+ dump_vindent(level, file, pat, &args);
va_end(args);
}
void
-dump_all(void)
+Perl_dump_vindent(pTHX_ I32 level, PerlIO *file, const char* pat, va_list *args)
+{
+ dTHR;
+ PerlIO_printf(file, "%*s", (int)(level*PL_dumpindent), "");
+ PerlIO_vprintf(file, pat, *args);
+}
+
+void
+Perl_dump_all(pTHX)
{
dTHR;
PerlIO_setlinebuf(Perl_debug_log);
}
void
-dump_packsubs(HV *stash)
+Perl_dump_packsubs(pTHX_ HV *stash)
{
dTHR;
I32 i;
}
void
-dump_sub(GV *gv)
+Perl_dump_sub(pTHX_ GV *gv)
{
SV *sv = sv_newmortal();
gv_fullname3(sv, gv, Nullch);
- dump_indent(0, Perl_debug_log, "\nSUB %s = ", SvPVX(sv));
+ Perl_dump_indent(aTHX_ 0, Perl_debug_log, "\nSUB %s = ", SvPVX(sv));
if (CvXSUB(GvCV(gv)))
- dump_indent(0, Perl_debug_log, "(xsub 0x%x %d)\n",
+ Perl_dump_indent(aTHX_ 0, Perl_debug_log, "(xsub 0x%lx %d)\n",
(long)CvXSUB(GvCV(gv)),
- CvXSUBANY(GvCV(gv)).any_i32);
+ (int)CvXSUBANY(GvCV(gv)).any_i32);
else if (CvROOT(GvCV(gv)))
op_dump(CvROOT(GvCV(gv)));
else
- dump_indent(0, Perl_debug_log, "<undef>\n");
+ Perl_dump_indent(aTHX_ 0, Perl_debug_log, "<undef>\n");
}
void
-dump_form(GV *gv)
+Perl_dump_form(pTHX_ GV *gv)
{
SV *sv = sv_newmortal();
gv_fullname3(sv, gv, Nullch);
- dump_indent(0, Perl_debug_log, "\nFORMAT %s = ", SvPVX(sv));
+ Perl_dump_indent(aTHX_ 0, Perl_debug_log, "\nFORMAT %s = ", SvPVX(sv));
if (CvROOT(GvFORM(gv)))
op_dump(CvROOT(GvFORM(gv)));
else
- dump_indent(0, Perl_debug_log, "<undef>\n");
+ Perl_dump_indent(aTHX_ 0, Perl_debug_log, "<undef>\n");
}
void
-dump_eval(void)
+Perl_dump_eval(pTHX)
{
op_dump(PL_eval_root);
}
char *
-pv_display(SV *sv, char *pv, STRLEN cur, STRLEN len, STRLEN pvlim)
+Perl_pv_display(pTHX_ SV *sv, char *pv, STRLEN cur, STRLEN len, STRLEN pvlim)
{
int truncated = 0;
int nul_terminated = len > cur && pv[cur] == '\0';
}
else {
if (cur && isDIGIT(*(pv+1)))
- sv_catpvf(sv, "\\%03o", *pv);
+ Perl_sv_catpvf(aTHX_ sv, "\\%03o", (U8)*pv);
else
- sv_catpvf(sv, "\\%o", *pv);
+ Perl_sv_catpvf(aTHX_ sv, "\\%o", (U8)*pv);
}
}
sv_catpvn(sv, "\"", 1);
}
char *
-sv_peek(SV *sv)
+Perl_sv_peek(pTHX_ SV *sv)
{
SV *t = sv_newmortal();
STRLEN n_a;
break;
case SVt_PVCV:
if (CvGV(sv))
- sv_catpvf(t, "CV(%s)", GvNAME(CvGV(sv)));
+ Perl_sv_catpvf(aTHX_ t, "CV(%s)", GvNAME(CvGV(sv)));
else
sv_catpv(t, "CV()");
goto finish;
if (!SvPVX(sv))
sv_catpv(t, "(null)");
else {
- SV *tmp = newSVpv("", 0);
+ SV *tmp = newSVpvn("", 0);
sv_catpv(t, "(");
if (SvOOK(sv))
- sv_catpvf(t, "[%s]", pv_display(tmp, SvPVX(sv)-SvIVX(sv), SvIVX(sv), 0, 127));
- sv_catpvf(t, "%s)", pv_display(tmp, SvPVX(sv), SvCUR(sv), SvLEN(sv), 127));
+ Perl_sv_catpvf(aTHX_ t, "[%s]", pv_display(tmp, SvPVX(sv)-SvIVX(sv), SvIVX(sv), 0, 127));
+ Perl_sv_catpvf(aTHX_ t, "%s)", pv_display(tmp, SvPVX(sv), SvCUR(sv), SvLEN(sv), 127));
SvREFCNT_dec(tmp);
}
}
else if (SvNOKp(sv)) {
- SET_NUMERIC_STANDARD();
- sv_catpvf(t, "(%g)",SvNVX(sv));
+ bool was_local = PL_numeric_local;
+ if (!was_local)
+ SET_NUMERIC_STANDARD();
+ Perl_sv_catpvf(aTHX_ t, "(%g)",SvNVX(sv));
+ if (was_local)
+ SET_NUMERIC_LOCAL();
+ }
+ else if (SvIOKp(sv)) {
+ if (SvIsUV(sv))
+ Perl_sv_catpvf(aTHX_ t, "(%"UVuf")", (UV)SvUVX(sv));
+ else
+ Perl_sv_catpvf(aTHX_ t, "(%"IVdf")", (IV)SvIVX(sv));
}
- else if (SvIOKp(sv))
- sv_catpvf(t, "(%ld)",(long)SvIVX(sv));
else
sv_catpv(t, "()");
}
void
-do_pmop_dump(I32 level, PerlIO *file, PMOP *pm)
+Perl_do_pmop_dump(pTHX_ I32 level, PerlIO *file, PMOP *pm)
{
char ch;
if (!pm) {
- dump_indent(level, file, "{}\n");
+ Perl_dump_indent(aTHX_ level, file, "{}\n");
return;
}
- dump_indent(level, file, "{\n");
+ Perl_dump_indent(aTHX_ level, file, "{\n");
level++;
if (pm->op_pmflags & PMf_ONCE)
ch = '?';
else
ch = '/';
if (pm->op_pmregexp)
- dump_indent(level, file, "PMf_PRE %c%s%c%s\n",
+ Perl_dump_indent(aTHX_ level, file, "PMf_PRE %c%s%c%s\n",
ch, pm->op_pmregexp->precomp, ch,
(pm->op_private & OPpRUNTIME) ? " (RUNTIME)" : "");
else
- dump_indent(level, file, "PMf_PRE (RUNTIME)\n");
+ Perl_dump_indent(aTHX_ level, file, "PMf_PRE (RUNTIME)\n");
if (pm->op_type != OP_PUSHRE && pm->op_pmreplroot) {
- dump_indent(level, file, "PMf_REPL = ");
+ Perl_dump_indent(aTHX_ level, file, "PMf_REPL = ");
op_dump(pm->op_pmreplroot);
}
if (pm->op_pmflags || (pm->op_pmregexp && pm->op_pmregexp->check_substr)) {
- SV *tmpsv = newSVpv("", 0);
+ SV *tmpsv = newSVpvn("", 0);
if (pm->op_pmdynflags & PMdf_USED)
sv_catpv(tmpsv, ",USED");
if (pm->op_pmdynflags & PMdf_TAINTED)
sv_catpv(tmpsv, ",RETAINT");
if (pm->op_pmflags & PMf_EVAL)
sv_catpv(tmpsv, ",EVAL");
- dump_indent(level, file, "PMFLAGS = (%s)\n", SvCUR(tmpsv) ? SvPVX(tmpsv) + 1 : "");
+ Perl_dump_indent(aTHX_ level, file, "PMFLAGS = (%s)\n", SvCUR(tmpsv) ? SvPVX(tmpsv) + 1 : "");
SvREFCNT_dec(tmpsv);
}
- dump_indent(level-1, file, "}\n");
+ Perl_dump_indent(aTHX_ level-1, file, "}\n");
}
void
-pmop_dump(PMOP *pm)
+Perl_pmop_dump(pTHX_ PMOP *pm)
{
do_pmop_dump(0, Perl_debug_log, pm);
}
void
-do_op_dump(I32 level, PerlIO *file, OP *o)
+Perl_do_op_dump(pTHX_ I32 level, PerlIO *file, OP *o)
{
dTHR;
- STRLEN n_a;
- dump_indent(level, file, "{\n");
+ Perl_dump_indent(aTHX_ level, file, "{\n");
level++;
if (o->op_seq)
PerlIO_printf(file, "%-4d", o->op_seq);
else
PerlIO_printf(file, " ");
- PerlIO_printf(file, "%*sTYPE = %s ===> ", PL_dumpindent*level-4, "", PL_op_name[o->op_type]);
+ PerlIO_printf(file,
+ "%*sTYPE = %s ===> ",
+ (int)(PL_dumpindent*level-4), "", PL_op_name[o->op_type]);
if (o->op_next) {
if (o->op_seq)
PerlIO_printf(file, "%d\n", o->op_next->op_seq);
PerlIO_printf(file, "DONE\n");
if (o->op_targ) {
if (o->op_type == OP_NULL)
- dump_indent(level, file, " (was %s)\n", PL_op_name[o->op_targ]);
+ Perl_dump_indent(aTHX_ level, file, " (was %s)\n", PL_op_name[o->op_targ]);
else
- dump_indent(level, file, "TARG = %d\n", o->op_targ);
+ Perl_dump_indent(aTHX_ level, file, "TARG = %ld\n", (long)o->op_targ);
}
#ifdef DUMPADDR
- dump_indent(level, file, "ADDR = 0x%lx => 0x%lx\n",o, o->op_next);
+ Perl_dump_indent(aTHX_ level, file, "ADDR = 0x%"UVxf" => 0x%"UVxf"\n", (UV)o, (UV)o->op_next);
#endif
if (o->op_flags) {
- SV *tmpsv = newSVpv("", 0);
+ SV *tmpsv = newSVpvn("", 0);
switch (o->op_flags & OPf_WANT) {
case OPf_WANT_VOID:
sv_catpv(tmpsv, ",VOID");
sv_catpv(tmpsv, ",MOD");
if (o->op_flags & OPf_SPECIAL)
sv_catpv(tmpsv, ",SPECIAL");
- dump_indent(level, file, "FLAGS = (%s)\n", SvCUR(tmpsv) ? SvPVX(tmpsv) + 1 : "");
+ Perl_dump_indent(aTHX_ level, file, "FLAGS = (%s)\n", SvCUR(tmpsv) ? SvPVX(tmpsv) + 1 : "");
SvREFCNT_dec(tmpsv);
}
if (o->op_private) {
- SV *tmpsv = newSVpv("", 0);
+ SV *tmpsv = newSVpvn("", 0);
+ if (PL_opargs[o->op_type] & OA_TARGLEX) {
+ if (o->op_private & OPpTARGET_MY)
+ sv_catpv(tmpsv, ",TARGET_MY");
+ }
if (o->op_type == OP_AASSIGN) {
if (o->op_private & OPpASSIGN_COMMON)
sv_catpv(tmpsv, ",COMMON");
+ if (o->op_private & OPpASSIGN_HASH)
+ sv_catpv(tmpsv, ",HASH");
}
else if (o->op_type == OP_SASSIGN) {
if (o->op_private & OPpASSIGN_BACKWARDS)
sv_catpv(tmpsv, ",AMPER");
if (o->op_private & OPpENTERSUB_DB)
sv_catpv(tmpsv, ",DB");
+ if (o->op_private & OPpENTERSUB_HASTARG)
+ sv_catpv(tmpsv, ",HASTARG");
}
- switch (o->op_private & OPpDEREF) {
+ else
+ switch (o->op_private & OPpDEREF) {
case OPpDEREF_SV:
sv_catpv(tmpsv, ",SV");
break;
else {
if (o->op_private & HINT_STRICT_REFS)
sv_catpv(tmpsv, ",STRICT_REFS");
+ if (o->op_private & OPpOUR_INTRO)
+ sv_catpv(tmpsv, ",OUR_INTRO");
}
}
else if (o->op_type == OP_CONST) {
if (o->op_private & OPpCONST_BARE)
sv_catpv(tmpsv, ",BARE");
+ if (o->op_private & OPpCONST_STRICT)
+ sv_catpv(tmpsv, ",STRICT");
}
else if (o->op_type == OP_FLIP) {
if (o->op_private & OPpFLIP_LINENUM)
else if (o->op_type == OP_FLOP) {
if (o->op_private & OPpFLIP_LINENUM)
sv_catpv(tmpsv, ",LINENUM");
+ } else if (o->op_type == OP_RV2CV) {
+ if (o->op_private & OPpLVAL_INTRO)
+ sv_catpv(tmpsv, ",INTRO");
}
if (o->op_flags & OPf_MOD && o->op_private & OPpLVAL_INTRO)
sv_catpv(tmpsv, ",INTRO");
if (SvCUR(tmpsv))
- dump_indent(level, file, "PRIVATE = (%s)\n", SvPVX(tmpsv) + 1);
+ Perl_dump_indent(aTHX_ level, file, "PRIVATE = (%s)\n", SvPVX(tmpsv) + 1);
SvREFCNT_dec(tmpsv);
}
switch (o->op_type) {
+ case OP_AELEMFAST:
case OP_GVSV:
case OP_GV:
- if (cGVOPo->op_gv) {
+#ifdef USE_ITHREADS
+ Perl_dump_indent(aTHX_ level, file, "PADIX = %d\n", cPADOPo->op_padix);
+#else
+ if (cSVOPo->op_sv) {
SV *tmpsv = NEWSV(0,0);
+ STRLEN n_a;
ENTER;
SAVEFREESV(tmpsv);
- gv_fullname3(tmpsv, cGVOPo->op_gv, Nullch);
- dump_indent(level, file, "GV = %s\n", SvPV(tmpsv, n_a));
+ gv_fullname3(tmpsv, (GV*)cSVOPo->op_sv, Nullch);
+ Perl_dump_indent(aTHX_ level, file, "GV = %s\n", SvPV(tmpsv, n_a));
LEAVE;
}
else
- dump_indent(level, file, "GV = NULL\n");
+ Perl_dump_indent(aTHX_ level, file, "GV = NULL\n");
+#endif
break;
case OP_CONST:
- dump_indent(level, file, "SV = %s\n", SvPEEK(cSVOPo->op_sv));
+ case OP_METHOD_NAMED:
+ Perl_dump_indent(aTHX_ level, file, "SV = %s\n", SvPEEK(cSVOPo->op_sv));
break;
+ case OP_SETSTATE:
case OP_NEXTSTATE:
case OP_DBSTATE:
- if (cCOPo->cop_line)
- dump_indent(level, file, "LINE = %d\n",cCOPo->cop_line);
+ if (CopLINE(cCOPo))
+ Perl_dump_indent(aTHX_ level, file, "LINE = %d\n",CopLINE(cCOPo));
+ if (CopSTASHPV(cCOPo))
+ Perl_dump_indent(aTHX_ level, file, "PACKAGE = \"%s\"\n",
+ CopSTASHPV(cCOPo));
if (cCOPo->cop_label)
- dump_indent(level, file, "LABEL = \"%s\"\n",cCOPo->cop_label);
+ Perl_dump_indent(aTHX_ level, file, "LABEL = \"%s\"\n",
+ cCOPo->cop_label);
break;
case OP_ENTERLOOP:
- dump_indent(level, file, "REDO ===> ");
+ Perl_dump_indent(aTHX_ level, file, "REDO ===> ");
if (cLOOPo->op_redoop)
PerlIO_printf(file, "%d\n", cLOOPo->op_redoop->op_seq);
else
PerlIO_printf(file, "DONE\n");
- dump_indent(level, file, "NEXT ===> ");
+ Perl_dump_indent(aTHX_ level, file, "NEXT ===> ");
if (cLOOPo->op_nextop)
PerlIO_printf(file, "%d\n", cLOOPo->op_nextop->op_seq);
else
PerlIO_printf(file, "DONE\n");
- dump_indent(level, file, "LAST ===> ");
+ Perl_dump_indent(aTHX_ level, file, "LAST ===> ");
if (cLOOPo->op_lastop)
PerlIO_printf(file, "%d\n", cLOOPo->op_lastop->op_seq);
else
PerlIO_printf(file, "DONE\n");
break;
case OP_COND_EXPR:
- dump_indent(level, file, "TRUE ===> ");
- if (cCONDOPo->op_true)
- PerlIO_printf(file, "%d\n", cCONDOPo->op_true->op_seq);
- else
- PerlIO_printf(file, "DONE\n");
- dump_indent(level, file, "FALSE ===> ");
- if (cCONDOPo->op_false)
- PerlIO_printf(file, "%d\n", cCONDOPo->op_false->op_seq);
- else
- PerlIO_printf(file, "DONE\n");
- break;
+ case OP_RANGE:
case OP_MAPWHILE:
case OP_GREPWHILE:
case OP_OR:
case OP_AND:
- dump_indent(level, file, "OTHER ===> ");
+ Perl_dump_indent(aTHX_ level, file, "OTHER ===> ");
if (cLOGOPo->op_other)
PerlIO_printf(file, "%d\n", cLOGOPo->op_other->op_seq);
else
case OP_SUBST:
do_pmop_dump(level, file, cPMOPo);
break;
+ case OP_LEAVE:
+ case OP_LEAVEEVAL:
+ case OP_LEAVESUB:
+ case OP_LEAVESUBLV:
+ case OP_LEAVEWRITE:
+ case OP_SCOPE:
+ if (o->op_private & OPpREFCOUNTED)
+ Perl_dump_indent(aTHX_ level, file, "REFCNT = %"UVuf"\n", (UV)o->op_targ);
+ break;
default:
break;
}
for (kid = cUNOPo->op_first; kid; kid = kid->op_sibling)
do_op_dump(level, file, kid);
}
- dump_indent(level-1, file, "}\n");
+ Perl_dump_indent(aTHX_ level-1, file, "}\n");
}
void
-op_dump(OP *o)
+Perl_op_dump(pTHX_ OP *o)
{
do_op_dump(0, Perl_debug_log, o);
}
void
-gv_dump(GV *gv)
+Perl_gv_dump(pTHX_ GV *gv)
{
SV *sv;
sv = sv_newmortal();
PerlIO_printf(Perl_debug_log, "{\n");
gv_fullname3(sv, gv, Nullch);
- dump_indent(1, Perl_debug_log, "GV_NAME = %s", SvPVX(sv));
+ Perl_dump_indent(aTHX_ 1, Perl_debug_log, "GV_NAME = %s", SvPVX(sv));
if (gv != GvEGV(gv)) {
gv_efullname3(sv, GvEGV(gv), Nullch);
- dump_indent(1, Perl_debug_log, "-> %s", SvPVX(sv));
+ Perl_dump_indent(aTHX_ 1, Perl_debug_log, "-> %s", SvPVX(sv));
}
PerlIO_putc(Perl_debug_log, '\n');
- dump_indent(0, Perl_debug_log, "}\n");
+ Perl_dump_indent(aTHX_ 0, Perl_debug_log, "}\n");
}
void
-do_magic_dump(I32 level, PerlIO *file, MAGIC *mg, I32 nest, I32 maxnest, bool dumpops, STRLEN pvlim)
+Perl_do_magic_dump(pTHX_ I32 level, PerlIO *file, MAGIC *mg, I32 nest, I32 maxnest, bool dumpops, STRLEN pvlim)
{
for (; mg; mg = mg->mg_moremagic) {
- dump_indent(level, file, " MAGIC = 0x%lx\n", (long)mg);
+ Perl_dump_indent(aTHX_ level, file,
+ " MAGIC = 0x%"UVxf"\n", PTR2UV(mg));
if (mg->mg_virtual) {
MGVTBL *v = mg->mg_virtual;
char *s = 0;
#ifdef USE_LOCALE_COLLATE
else if (v == &PL_vtbl_collxfrm) s = "collxfrm";
#endif
-#ifdef OVERLOAD
else if (v == &PL_vtbl_amagic) s = "amagic";
else if (v == &PL_vtbl_amagicelem) s = "amagicelem";
-#endif
+ else if (v == &PL_vtbl_backref) s = "backref";
if (s)
- dump_indent(level, file, " MG_VIRTUAL = &PL_vtbl_%s\n", s);
+ Perl_dump_indent(aTHX_ level, file, " MG_VIRTUAL = &PL_vtbl_%s\n", s);
else
- dump_indent(level, file, " MG_VIRTUAL = 0x%lx\n", (long)v);
+ Perl_dump_indent(aTHX_ level, file, " MG_VIRTUAL = 0x%"UVxf"\n", PTR2UV(v));
}
else
- dump_indent(level, file, " MG_VIRTUAL = 0\n");
+ Perl_dump_indent(aTHX_ level, file, " MG_VIRTUAL = 0\n");
if (mg->mg_private)
- dump_indent(level, file, " MG_PRIVATE = %d\n", mg->mg_private);
+ Perl_dump_indent(aTHX_ level, file, " MG_PRIVATE = %d\n", mg->mg_private);
if (isPRINT(mg->mg_type))
- dump_indent(level, file, " MG_TYPE = '%c'\n", mg->mg_type);
+ Perl_dump_indent(aTHX_ level, file, " MG_TYPE = '%c'\n", mg->mg_type);
else
- dump_indent(level, file, " MG_TYPE = '\\%o'\n", mg->mg_type);
+ Perl_dump_indent(aTHX_ level, file, " MG_TYPE = '\\%o'\n", mg->mg_type);
if (mg->mg_flags) {
- dump_indent(level, file, " MG_FLAGS = 0x%02X\n", mg->mg_flags);
+ Perl_dump_indent(aTHX_ level, file, " MG_FLAGS = 0x%02X\n", mg->mg_flags);
if (mg->mg_flags & MGf_TAINTEDDIR)
- dump_indent(level, file, " TAINTEDDIR\n");
+ Perl_dump_indent(aTHX_ level, file, " TAINTEDDIR\n");
if (mg->mg_flags & MGf_REFCOUNTED)
- dump_indent(level, file, " REFCOUNTED\n");
+ Perl_dump_indent(aTHX_ level, file, " REFCOUNTED\n");
if (mg->mg_flags & MGf_GSKIP)
- dump_indent(level, file, " GSKIP\n");
+ Perl_dump_indent(aTHX_ level, file, " GSKIP\n");
if (mg->mg_flags & MGf_MINMATCH)
- dump_indent(level, file, " MINMATCH\n");
+ Perl_dump_indent(aTHX_ level, file, " MINMATCH\n");
}
if (mg->mg_obj) {
- dump_indent(level, file, " MG_OBJ = 0x%lx\n", (long)mg->mg_obj);
+ Perl_dump_indent(aTHX_ level, file, " MG_OBJ = 0x%"UVxf"\n", PTR2UV(mg->mg_obj));
if (mg->mg_flags & MGf_REFCOUNTED)
do_sv_dump(level+2, file, mg->mg_obj, nest+1, maxnest, dumpops, pvlim); /* MG is already +1 */
}
if (mg->mg_len)
- dump_indent(level, file, " MG_LEN = %d\n", mg->mg_len);
+ Perl_dump_indent(aTHX_ level, file, " MG_LEN = %ld\n", (long)mg->mg_len);
if (mg->mg_ptr) {
- dump_indent(level, file, " MG_PTR = 0x%lx", (long)mg->mg_ptr);
+ Perl_dump_indent(aTHX_ level, file, " MG_PTR = 0x%"UVxf, PTR2UV(mg->mg_ptr));
if (mg->mg_len >= 0) {
- SV *sv = newSVpv("", 0);
+ SV *sv = newSVpvn("", 0);
PerlIO_printf(file, " %s", pv_display(sv, mg->mg_ptr, mg->mg_len, 0, pvlim));
SvREFCNT_dec(sv);
}
}
void
-magic_dump(MAGIC *mg)
+Perl_magic_dump(pTHX_ MAGIC *mg)
{
do_magic_dump(0, Perl_debug_log, mg, 0, 0, 0, 0);
}
void
-do_hv_dump(I32 level, PerlIO *file, char *name, HV *sv)
+Perl_do_hv_dump(pTHX_ I32 level, PerlIO *file, char *name, HV *sv)
{
- dump_indent(level, file, "%s = 0x%lx", name, (long)sv);
+ Perl_dump_indent(aTHX_ level, file, "%s = 0x%"UVxf, name, PTR2UV(sv));
if (sv && HvNAME(sv))
PerlIO_printf(file, "\t\"%s\"\n", HvNAME(sv));
else
}
void
-do_gv_dump(I32 level, PerlIO *file, char *name, GV *sv)
+Perl_do_gv_dump(pTHX_ I32 level, PerlIO *file, char *name, GV *sv)
{
- dump_indent(level, file, "%s = 0x%lx", name, (long)sv);
+ Perl_dump_indent(aTHX_ level, file, "%s = 0x%"UVxf, name, PTR2UV(sv));
if (sv && GvNAME(sv))
PerlIO_printf(file, "\t\"%s\"\n", GvNAME(sv));
else
}
void
-do_gvgv_dump(I32 level, PerlIO *file, char *name, GV *sv)
+Perl_do_gvgv_dump(pTHX_ I32 level, PerlIO *file, char *name, GV *sv)
{
- dump_indent(level, file, "%s = 0x%lx", name, (long)sv);
+ Perl_dump_indent(aTHX_ level, file, "%s = 0x%"UVxf, name, PTR2UV(sv));
if (sv && GvNAME(sv)) {
PerlIO_printf(file, "\t\"");
if (GvSTASH(sv) && HvNAME(GvSTASH(sv)))
}
void
-do_sv_dump(I32 level, PerlIO *file, SV *sv, I32 nest, I32 maxnest, bool dumpops, STRLEN pvlim)
+Perl_do_sv_dump(pTHX_ I32 level, PerlIO *file, SV *sv, I32 nest, I32 maxnest, bool dumpops, STRLEN pvlim)
{
dTHR;
- SV *d = sv_newmortal();
+ SV *d;
char *s;
U32 flags;
U32 type;
STRLEN n_a;
if (!sv) {
- dump_indent(level, file, "SV = 0\n");
+ Perl_dump_indent(aTHX_ level, file, "SV = 0\n");
return;
}
flags = SvFLAGS(sv);
type = SvTYPE(sv);
- sv_setpvf(d, "(0x%lx) at 0x%lx\n%*s REFCNT = %ld\n%*s FLAGS = (",
- (unsigned long)SvANY(sv), (unsigned long)sv,
- PL_dumpindent*level, "", (long)SvREFCNT(sv),
- PL_dumpindent*level, "");
+ d = Perl_newSVpvf(aTHX_
+ "(0x%"UVxf") at 0x%"UVxf"\n%*s REFCNT = %"IVdf"\n%*s FLAGS = (",
+ PTR2UV(SvANY(sv)), PTR2UV(sv),
+ (int)(PL_dumpindent*level), "", (IV)SvREFCNT(sv),
+ (int)(PL_dumpindent*level), "");
if (flags & SVs_PADBUSY) sv_catpv(d, "PADBUSY,");
if (flags & SVs_PADTMP) sv_catpv(d, "PADTMP,");
if (flags & SVf_IOK) sv_catpv(d, "IOK,");
if (flags & SVf_NOK) sv_catpv(d, "NOK,");
if (flags & SVf_POK) sv_catpv(d, "POK,");
- if (flags & SVf_ROK) sv_catpv(d, "ROK,");
+ if (flags & SVf_ROK) {
+ sv_catpv(d, "ROK,");
+ if (SvWEAKREF(sv)) sv_catpv(d, "WEAKREF,");
+ }
if (flags & SVf_OOK) sv_catpv(d, "OOK,");
if (flags & SVf_FAKE) sv_catpv(d, "FAKE,");
if (flags & SVf_READONLY) sv_catpv(d, "READONLY,");
-#ifdef OVERLOAD
if (flags & SVf_AMAGIC) sv_catpv(d, "OVERLOAD,");
-#endif /* OVERLOAD */
if (flags & SVp_IOK) sv_catpv(d, "pIOK,");
if (flags & SVp_NOK) sv_catpv(d, "pNOK,");
if (flags & SVp_POK) sv_catpv(d, "pPOK,");
if (CvCLONE(sv)) sv_catpv(d, "CLONE,");
if (CvCLONED(sv)) sv_catpv(d, "CLONED,");
if (CvNODEBUG(sv)) sv_catpv(d, "NODEBUG,");
+ if (SvCOMPILED(sv)) sv_catpv(d, "COMPILED,");
break;
case SVt_PVHV:
if (HvSHAREKEYS(sv)) sv_catpv(d, "SHAREKEYS,");
sv_catpv(d, " ),");
}
}
+ /* FALL THROGH */
+ default:
+ if (SvEVALED(sv)) sv_catpv(d, "EVALED,");
+ if (SvIsUV(sv)) sv_catpv(d, "IsUV,");
+ if (SvUTF8(sv)) sv_catpv(d, "UTF8");
+ break;
case SVt_PVBM:
if (SvTAIL(sv)) sv_catpv(d, "TAIL,");
- if (SvCOMPILED(sv)) sv_catpv(d, "COMPILED,");
+ if (SvVALID(sv)) sv_catpv(d, "VALID,");
break;
}
sv_catpv(d, ")");
s = SvPVX(d);
- dump_indent(level, file, "SV = ");
+ Perl_dump_indent(aTHX_ level, file, "SV = ");
switch (type) {
case SVt_NULL:
PerlIO_printf(file, "NULL%s\n", s);
+ SvREFCNT_dec(d);
return;
case SVt_IV:
PerlIO_printf(file, "IV%s\n", s);
PerlIO_printf(file, "PVIO%s\n", s);
break;
default:
- PerlIO_printf(file, "UNKNOWN(0x%x) %s\n", type, s);
+ PerlIO_printf(file, "UNKNOWN(0x%"UVxf") %s\n", (UV)type, s);
+ SvREFCNT_dec(d);
return;
}
if (type >= SVt_PVIV || type == SVt_IV) {
- dump_indent(level, file, " IV = %ld", (long)SvIVX(sv));
+ if (SvIsUV(sv))
+ Perl_dump_indent(aTHX_ level, file, " UV = %"UVuf, (UV)SvUVX(sv));
+ else
+ Perl_dump_indent(aTHX_ level, file, " IV = %"IVdf, (IV)SvIVX(sv));
if (SvOOK(sv))
PerlIO_printf(file, " (OFFSET)");
PerlIO_putc(file, '\n');
}
if (type >= SVt_PVNV || type == SVt_NV) {
- SET_NUMERIC_STANDARD();
- dump_indent(level, file, " NV = %.*g\n", DBL_DIG, SvNVX(sv));
+ bool was_local = PL_numeric_local;
+ if (!was_local)
+ SET_NUMERIC_STANDARD();
+ /* %Vg doesn't work? --jhi */
+#ifdef USE_LONG_DOUBLE
+ Perl_dump_indent(aTHX_ level, file, " NV = %.*" PERL_PRIgldbl "\n", LDBL_DIG, SvNVX(sv));
+#else
+ Perl_dump_indent(aTHX_ level, file, " NV = %.*g\n", DBL_DIG, SvNVX(sv));
+#endif
+ if (was_local)
+ SET_NUMERIC_LOCAL();
}
if (SvROK(sv)) {
- dump_indent(level, file, " RV = 0x%lx\n", (long)SvRV(sv));
+ Perl_dump_indent(aTHX_ level, file, " RV = 0x%"UVxf"\n", PTR2UV(SvRV(sv)));
if (nest < maxnest)
do_sv_dump(level+1, file, SvRV(sv), nest+1, maxnest, dumpops, pvlim);
+ SvREFCNT_dec(d);
return;
}
- if (type < SVt_PV)
+ if (type < SVt_PV) {
+ SvREFCNT_dec(d);
return;
+ }
if (type <= SVt_PVLV) {
if (SvPVX(sv)) {
- dump_indent(level, file," PV = 0x%lx ", (long)SvPVX(sv));
+ Perl_dump_indent(aTHX_ level, file," PV = 0x%"UVxf" ", PTR2UV(SvPVX(sv)));
if (SvOOK(sv))
PerlIO_printf(file, "( %s . ) ", pv_display(d, SvPVX(sv)-SvIVX(sv), SvIVX(sv), 0, pvlim));
PerlIO_printf(file, "%s\n", pv_display(d, SvPVX(sv), SvCUR(sv), SvLEN(sv), pvlim));
- dump_indent(level, file, " CUR = 0\n", (long)SvCUR(sv));
- dump_indent(level, file, " LEN = 0\n", (long)SvLEN(sv));
+ Perl_dump_indent(aTHX_ level, file, " CUR = %"IVdf"\n", (IV)SvCUR(sv));
+ Perl_dump_indent(aTHX_ level, file, " LEN = %"IVdf"\n", (IV)SvLEN(sv));
}
else
- dump_indent(level, file, " PV = 0\n");
+ Perl_dump_indent(aTHX_ level, file, " PV = 0\n");
}
if (type >= SVt_PVMG) {
if (SvMAGIC(sv))
}
switch (type) {
case SVt_PVLV:
- dump_indent(level, file, " TYPE = %c\n", LvTYPE(sv));
- dump_indent(level, file, " TARGOFF = %ld\n", (long)LvTARGOFF(sv));
- dump_indent(level, file, " TARGLEN = %ld\n", (long)LvTARGLEN(sv));
- dump_indent(level, file, " TARG = 0x%lx\n", (long)LvTARG(sv));
+ Perl_dump_indent(aTHX_ level, file, " TYPE = %c\n", LvTYPE(sv));
+ Perl_dump_indent(aTHX_ level, file, " TARGOFF = %"IVdf"\n", (IV)LvTARGOFF(sv));
+ Perl_dump_indent(aTHX_ level, file, " TARGLEN = %"IVdf"\n", (IV)LvTARGLEN(sv));
+ Perl_dump_indent(aTHX_ level, file, " TARG = 0x%"UVxf"\n", PTR2UV(LvTARG(sv)));
/* XXX level+1 ??? */
do_sv_dump(level, file, LvTARG(sv), nest+1, maxnest, dumpops, pvlim);
break;
case SVt_PVAV:
- dump_indent(level, file, " ARRAY = 0x%lx", (long)AvARRAY(sv));
+ Perl_dump_indent(aTHX_ level, file, " ARRAY = 0x%"UVxf, PTR2UV(AvARRAY(sv)));
if (AvARRAY(sv) != AvALLOC(sv)) {
- PerlIO_printf(file, " (offset=%d)\n", (AvARRAY(sv) - AvALLOC(sv)));
- dump_indent(level, file, " ALLOC = 0x%lx\n", (long)AvALLOC(sv));
+ PerlIO_printf(file, " (offset=%"IVdf")\n", (IV)(AvARRAY(sv) - AvALLOC(sv)));
+ Perl_dump_indent(aTHX_ level, file, " ALLOC = 0x%"UVxf"\n", PTR2UV(AvALLOC(sv)));
}
else
PerlIO_putc(file, '\n');
- dump_indent(level, file, " FILL = %ld\n", (long)AvFILLp(sv));
- dump_indent(level, file, " MAX = %ld\n", (long)AvMAX(sv));
- dump_indent(level, file, " ARYLEN = 0x%lx\n", (long)AvARYLEN(sv));
+ Perl_dump_indent(aTHX_ level, file, " FILL = %"IVdf"\n", (IV)AvFILLp(sv));
+ Perl_dump_indent(aTHX_ level, file, " MAX = %"IVdf"\n", (IV)AvMAX(sv));
+ Perl_dump_indent(aTHX_ level, file, " ARYLEN = 0x%"UVxf"\n", PTR2UV(AvARYLEN(sv)));
flags = AvFLAGS(sv);
sv_setpv(d, "");
if (flags & AVf_REAL) sv_catpv(d, ",REAL");
if (flags & AVf_REIFY) sv_catpv(d, ",REIFY");
if (flags & AVf_REUSED) sv_catpv(d, ",REUSED");
- dump_indent(level, file, " FLAGS = (%s)\n", SvCUR(d) ? SvPVX(d) + 1 : "");
+ Perl_dump_indent(aTHX_ level, file, " FLAGS = (%s)\n", SvCUR(d) ? SvPVX(d) + 1 : "");
if (nest < maxnest && av_len((AV*)sv) >= 0) {
int count;
for (count = 0; count <= av_len((AV*)sv) && count < maxnest; count++) {
SV** elt = av_fetch((AV*)sv,count,0);
- dump_indent(level + 1, file, "Elt No. %ld\n", (long)count);
+ Perl_dump_indent(aTHX_ level + 1, file, "Elt No. %"IVdf"\n", (IV)count);
if (elt)
do_sv_dump(level+1, file, *elt, nest+1, maxnest, dumpops, pvlim);
}
}
break;
case SVt_PVHV:
- dump_indent(level, file, " ARRAY = 0x%lx",(long)HvARRAY(sv));
+ Perl_dump_indent(aTHX_ level, file, " ARRAY = 0x%"UVxf, PTR2UV(HvARRAY(sv)));
if (HvARRAY(sv) && HvKEYS(sv)) {
/* Show distribution of HEs in the ARRAY */
int freq[200];
int i;
int max = 0;
U32 pow2 = 2, keys = HvKEYS(sv);
- double theoret, sum = 0;
+ NV theoret, sum = 0;
PerlIO_printf(file, " (");
Zero(freq, FREQ_MAX + 1, int);
for (i = max; i > 0; i--) { /* Precision: count down. */
sum += freq[i] * i * i;
}
- while (keys = keys >> 1)
+ while ((keys = keys >> 1))
pow2 = pow2 << 1;
/* Approximate by Poisson distribution */
theoret = HvKEYS(sv);
theoret += theoret * theoret/pow2;
PerlIO_putc(file, '\n');
- dump_indent(level, file, " hash quality = %.1f%%", theoret/sum*100);
+ Perl_dump_indent(aTHX_ level, file, " hash quality = %.1f%%", theoret/sum*100);
}
PerlIO_putc(file, '\n');
- dump_indent(level, file, " KEYS = %ld\n", (long)HvKEYS(sv));
- dump_indent(level, file, " FILL = %ld\n", (long)HvFILL(sv));
- dump_indent(level, file, " MAX = %ld\n", (long)HvMAX(sv));
- dump_indent(level, file, " RITER = %ld\n", (long)HvRITER(sv));
- dump_indent(level, file, " EITER = 0x%lx\n",(long) HvEITER(sv));
+ Perl_dump_indent(aTHX_ level, file, " KEYS = %"IVdf"\n", (IV)HvKEYS(sv));
+ Perl_dump_indent(aTHX_ level, file, " FILL = %"IVdf"\n", (IV)HvFILL(sv));
+ Perl_dump_indent(aTHX_ level, file, " MAX = %"IVdf"\n", (IV)HvMAX(sv));
+ Perl_dump_indent(aTHX_ level, file, " RITER = %"IVdf"\n", (IV)HvRITER(sv));
+ Perl_dump_indent(aTHX_ level, file, " EITER = 0x%"UVxf"\n", PTR2UV(HvEITER(sv)));
if (HvPMROOT(sv))
- dump_indent(level, file, " PMROOT = 0x%lx\n",(long)HvPMROOT(sv));
+ Perl_dump_indent(aTHX_ level, file, " PMROOT = 0x%"UVxf"\n", PTR2UV(HvPMROOT(sv)));
if (HvNAME(sv))
- dump_indent(level, file, " NAME = \"%s\"\n", HvNAME(sv));
+ Perl_dump_indent(aTHX_ level, file, " NAME = \"%s\"\n", HvNAME(sv));
if (nest < maxnest && !HvEITER(sv)) { /* Try to preserve iterator */
HE *he;
HV *hv = (HV*)sv;
key = hv_iterkey(he, &len);
elt = hv_iterval(hv, he);
- dump_indent(level+1, file, "Elt %s HASH = 0x%lx\n", pv_display(d, key, len, 0, pvlim), hash);
+ Perl_dump_indent(aTHX_ level+1, file, "Elt %s HASH = 0x%"UVxf"\n", pv_display(d, key, len, 0, pvlim), (UV)hash);
do_sv_dump(level+1, file, elt, nest+1, maxnest, dumpops, pvlim);
}
hv_iterinit(hv); /* Return to status quo */
break;
case SVt_PVCV:
if (SvPOK(sv))
- dump_indent(level, file, " PROTOTYPE = \"%s\"\n", SvPV(sv,n_a));
+ Perl_dump_indent(aTHX_ level, file, " PROTOTYPE = \"%s\"\n", SvPV(sv,n_a));
/* FALL THROUGH */
case SVt_PVFM:
do_hv_dump(level, file, " COMP_STASH", CvSTASH(sv));
if (CvSTART(sv))
- dump_indent(level, file, " START = 0x%lx ===> %d\n", (long)CvSTART(sv), CvSTART(sv)->op_seq);
- dump_indent(level, file, " ROOT = 0x%lx\n", (long)CvROOT(sv));
+ Perl_dump_indent(aTHX_ level, file, " START = 0x%"UVxf" ===> %"IVdf"\n", PTR2UV(CvSTART(sv)), (IV)CvSTART(sv)->op_seq);
+ Perl_dump_indent(aTHX_ level, file, " ROOT = 0x%"UVxf"\n", PTR2UV(CvROOT(sv)));
if (CvROOT(sv) && dumpops)
do_op_dump(level+1, file, CvROOT(sv));
- dump_indent (level, file, " XSUB = 0x%lx\n", (long)CvXSUB(sv));
- dump_indent (level, file, " XSUBANY = %ld\n", (long)CvXSUBANY(sv).any_i32);
+ Perl_dump_indent(aTHX_ level, file, " XSUB = 0x%"UVxf"\n", PTR2UV(CvXSUB(sv)));
+ Perl_dump_indent(aTHX_ level, file, " XSUBANY = %"IVdf"\n", (IV)CvXSUBANY(sv).any_i32);
do_gvgv_dump(level, file, " GVGV::GV", CvGV(sv));
- do_gv_dump (level, file, " FILEGV", CvFILEGV(sv));
- dump_indent (level, file, " DEPTH = %ld\n", (long)CvDEPTH(sv));
+ Perl_dump_indent(aTHX_ level, file, " FILE = \"%s\"\n", CvFILE(sv));
+ Perl_dump_indent(aTHX_ level, file, " DEPTH = %"IVdf"\n", (IV)CvDEPTH(sv));
#ifdef USE_THREADS
- dump_indent (level, file, " MUTEXP = 0x%lx\n", (long)CvMUTEXP(sv));
- dump_indent (level, file, " OWNER = 0x%lx\n", (long)CvOWNER(sv));
+ Perl_dump_indent(aTHX_ level, file, " MUTEXP = 0x%"UVxf"\n", PTR2UV(CvMUTEXP(sv)));
+ Perl_dump_indent(aTHX_ level, file, " OWNER = 0x%"UVxf"\n", PTR2UV(CvOWNER(sv)));
#endif /* USE_THREADS */
- dump_indent (level, file, " FLAGS = 0x%lx\n", (unsigned long)CvFLAGS(sv));
+ Perl_dump_indent(aTHX_ level, file, " FLAGS = 0x%"UVxf"\n", (UV)CvFLAGS(sv));
if (type == SVt_PVFM)
- dump_indent(level, file, " LINES = %ld\n", (long)FmLINES(sv));
- dump_indent(level, file, " PADLIST = 0x%lx\n", (long)CvPADLIST(sv));
+ Perl_dump_indent(aTHX_ level, file, " LINES = %"IVdf"\n", (IV)FmLINES(sv));
+ Perl_dump_indent(aTHX_ level, file, " PADLIST = 0x%"UVxf"\n", PTR2UV(CvPADLIST(sv)));
if (nest < maxnest && CvPADLIST(sv)) {
AV* padlist = CvPADLIST(sv);
AV* pad_name = (AV*)*av_fetch(padlist, 0, FALSE);
for (ix = 1; ix <= AvFILL(pad_name); ix++) {
if (SvPOK(pname[ix]))
- dump_indent(level, /* %5d below is enough whitespace. */
+ Perl_dump_indent(aTHX_ level,
+ /* %5d below is enough whitespace. */
file,
- "%5d. 0x%lx (%s\"%s\" %ld-%ld)\n",
- ix, ppad[ix],
+ "%5d. 0x%"UVxf" (%s\"%s\" %"IVdf"-%"IVdf")\n",
+ (int)ix, PTR2UV(ppad[ix]),
SvFAKE(pname[ix]) ? "FAKE " : "",
SvPVX(pname[ix]),
- (long)I_32(SvNVX(pname[ix])),
- (long)SvIVX(pname[ix]));
+ (IV)SvNVX(pname[ix]),
+ (IV)SvIVX(pname[ix]));
}
}
{
CV *outside = CvOUTSIDE(sv);
- dump_indent(level, file, " OUTSIDE = 0x%lx (%s)\n",
- (long)outside,
+ Perl_dump_indent(aTHX_ level, file, " OUTSIDE = 0x%"UVxf" (%s)\n",
+ PTR2UV(outside),
(!outside ? "null"
: CvANON(outside) ? "ANON"
: (outside == PL_main_cv) ? "MAIN"
do_sv_dump(level+1, file, (SV*)CvOUTSIDE(sv), nest+1, maxnest, dumpops, pvlim);
break;
case SVt_PVGV:
- dump_indent(level, file, " NAME = \"%s\"\n", GvNAME(sv));
- dump_indent(level, file, " NAMELEN = %ld\n", (long)GvNAMELEN(sv));
+ Perl_dump_indent(aTHX_ level, file, " NAME = \"%s\"\n", GvNAME(sv));
+ Perl_dump_indent(aTHX_ level, file, " NAMELEN = %"IVdf"\n", (IV)GvNAMELEN(sv));
do_hv_dump (level, file, " GvSTASH", GvSTASH(sv));
- dump_indent(level, file, " GP = 0x%lx\n", (long)GvGP(sv));
- dump_indent(level, file, " SV = 0x%lx\n", (long)GvSV(sv));
- dump_indent(level, file, " REFCNT = %ld\n", (long)GvREFCNT(sv));
- dump_indent(level, file, " IO = 0x%lx\n", (long)GvIOp(sv));
- dump_indent(level, file, " FORM = 0x%lx\n", (long)GvFORM(sv));
- dump_indent(level, file, " AV = 0x%lx\n", (long)GvAV(sv));
- dump_indent(level, file, " HV = 0x%lx\n", (long)GvHV(sv));
- dump_indent(level, file, " CV = 0x%lx\n", (long)GvCV(sv));
- dump_indent(level, file, " CVGEN = 0x%lx\n", (long)GvCVGEN(sv));
- dump_indent(level, file, " LASTEXPR = %ld\n", (long)GvLASTEXPR(sv));
- dump_indent(level, file, " LINE = %ld\n", (long)GvLINE(sv));
- dump_indent(level, file, " FLAGS = 0x%x\n", (int)GvFLAGS(sv));
- do_gv_dump (level, file, " FILEGV", GvFILEGV(sv));
+ Perl_dump_indent(aTHX_ level, file, " GP = 0x%"UVxf"\n", PTR2UV(GvGP(sv)));
+ if (!GvGP(sv))
+ break;
+ Perl_dump_indent(aTHX_ level, file, " SV = 0x%"UVxf"\n", PTR2UV(GvSV(sv)));
+ Perl_dump_indent(aTHX_ level, file, " REFCNT = %"IVdf"\n", (IV)GvREFCNT(sv));
+ Perl_dump_indent(aTHX_ level, file, " IO = 0x%"UVxf"\n", PTR2UV(GvIOp(sv)));
+ Perl_dump_indent(aTHX_ level, file, " FORM = 0x%"UVxf" \n", PTR2UV(GvFORM(sv)));
+ Perl_dump_indent(aTHX_ level, file, " AV = 0x%"UVxf"\n", PTR2UV(GvAV(sv)));
+ Perl_dump_indent(aTHX_ level, file, " HV = 0x%"UVxf"\n", PTR2UV(GvHV(sv)));
+ Perl_dump_indent(aTHX_ level, file, " CV = 0x%"UVxf"\n", PTR2UV(GvCV(sv)));
+ Perl_dump_indent(aTHX_ level, file, " CVGEN = 0x%"UVxf"\n", (UV)GvCVGEN(sv));
+ Perl_dump_indent(aTHX_ level, file, " GPFLAGS = 0x%"UVxf"\n", (UV)GvGPFLAGS(sv));
+ Perl_dump_indent(aTHX_ level, file, " LINE = %"IVdf"\n", (IV)GvLINE(sv));
+ Perl_dump_indent(aTHX_ level, file, " FILE = \"%s\"\n", GvFILE(sv));
+ Perl_dump_indent(aTHX_ level, file, " FLAGS = 0x%"UVxf"\n", (UV)GvFLAGS(sv));
do_gv_dump (level, file, " EGV", GvEGV(sv));
break;
case SVt_PVIO:
- dump_indent(level, file, " IFP = 0x%lx\n", (long)IoIFP(sv));
- dump_indent(level, file, " OFP = 0x%lx\n", (long)IoOFP(sv));
- dump_indent(level, file, " DIRP = 0x%lx\n", (long)IoDIRP(sv));
- dump_indent(level, file, " LINES = %ld\n", (long)IoLINES(sv));
- dump_indent(level, file, " PAGE = %ld\n", (long)IoPAGE(sv));
- dump_indent(level, file, " PAGE_LEN = %ld\n", (long)IoPAGE_LEN(sv));
- dump_indent(level, file, " LINES_LEFT = %ld\n", (long)IoLINES_LEFT(sv));
- dump_indent(level, file, " TOP_NAME = \"%s\"\n", IoTOP_NAME(sv));
+ Perl_dump_indent(aTHX_ level, file, " IFP = 0x%"UVxf"\n", PTR2UV(IoIFP(sv)));
+ Perl_dump_indent(aTHX_ level, file, " OFP = 0x%"UVxf"\n", PTR2UV(IoOFP(sv)));
+ Perl_dump_indent(aTHX_ level, file, " DIRP = 0x%"UVxf"\n", PTR2UV(IoDIRP(sv)));
+ Perl_dump_indent(aTHX_ level, file, " LINES = %"IVdf"\n", (IV)IoLINES(sv));
+ Perl_dump_indent(aTHX_ level, file, " PAGE = %"IVdf"\n", (IV)IoPAGE(sv));
+ Perl_dump_indent(aTHX_ level, file, " PAGE_LEN = %"IVdf"\n", (IV)IoPAGE_LEN(sv));
+ Perl_dump_indent(aTHX_ level, file, " LINES_LEFT = %"IVdf"\n", (IV)IoLINES_LEFT(sv));
+ if (IoTOP_NAME(sv))
+ Perl_dump_indent(aTHX_ level, file, " TOP_NAME = \"%s\"\n", IoTOP_NAME(sv));
do_gv_dump (level, file, " TOP_GV", IoTOP_GV(sv));
- dump_indent(level, file, " FMT_NAME = \"%s\"\n", IoFMT_NAME(sv));
+ if (IoFMT_NAME(sv))
+ Perl_dump_indent(aTHX_ level, file, " FMT_NAME = \"%s\"\n", IoFMT_NAME(sv));
do_gv_dump (level, file, " FMT_GV", IoFMT_GV(sv));
- dump_indent(level, file, " BOTTOM_NAME = \"%s\"\n", IoBOTTOM_NAME(sv));
+ if (IoBOTTOM_NAME(sv))
+ Perl_dump_indent(aTHX_ level, file, " BOTTOM_NAME = \"%s\"\n", IoBOTTOM_NAME(sv));
do_gv_dump (level, file, " BOTTOM_GV", IoBOTTOM_GV(sv));
- dump_indent(level, file, " SUBPROCESS = %ld\n", (long)IoSUBPROCESS(sv));
- dump_indent(level, file, " TYPE = %c\n", IoTYPE(sv));
- dump_indent(level, file, " FLAGS = 0x%lx\n", (long)IoFLAGS(sv));
+ Perl_dump_indent(aTHX_ level, file, " SUBPROCESS = %"IVdf"\n", (IV)IoSUBPROCESS(sv));
+ if (isPRINT(IoTYPE(sv)))
+ Perl_dump_indent(aTHX_ level, file, " TYPE = '%c'\n", IoTYPE(sv));
+ else
+ Perl_dump_indent(aTHX_ level, file, " TYPE = '\\%o'\n", IoTYPE(sv));
+ Perl_dump_indent(aTHX_ level, file, " FLAGS = 0x%"UVxf"\n", (UV)IoFLAGS(sv));
break;
}
+ SvREFCNT_dec(d);
}
void
-sv_dump(SV *sv)
+Perl_sv_dump(pTHX_ SV *sv)
{
do_sv_dump(0, Perl_debug_log, sv, 0, 0, 0, 0);
}