3 * Copyright (C) 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
4 * 2000, 2001, 2002, 2003, 2004, 2005, 2006, by Larry Wall and others
6 * You may distribute under the terms of either the GNU General Public
7 * License or the Artistic License, as specified in the README file.
12 * "'You have talked long in your sleep, Frodo,' said Gandalf gently, 'and
13 * it has not been hard for me to read your mind and memory.'"
16 /* This file contains utility routines to dump the contents of SV and OP
17 * structures, as used by command-line options like -Dt and -Dx, and
20 * It also holds the debugging version of the runops function.
24 #define PERL_IN_DUMP_C
30 #define Sequence PL_op_sequence
33 Perl_dump_indent(pTHX_ I32 level, PerlIO *file, const char* pat, ...)
37 dump_vindent(level, file, pat, &args);
42 Perl_dump_vindent(pTHX_ I32 level, PerlIO *file, const char* pat, va_list *args)
45 PerlIO_printf(file, "%*s", (int)(level*PL_dumpindent), "");
46 PerlIO_vprintf(file, pat, *args);
53 PerlIO_setlinebuf(Perl_debug_log);
55 op_dump(PL_main_root);
56 dump_packsubs(PL_defstash);
60 Perl_dump_packsubs(pTHX_ const HV *stash)
67 for (i = 0; i <= (I32) HvMAX(stash); i++) {
69 for (entry = HvARRAY(stash)[i]; entry; entry = HeNEXT(entry)) {
70 const GV *gv = (GV*)HeVAL(entry);
72 if (SvTYPE(gv) != SVt_PVGV || !GvGP(gv))
78 if (HeKEY(entry)[HeKLEN(entry)-1] == ':'
79 && (hv = GvHV(gv)) && hv != PL_defstash)
80 dump_packsubs(hv); /* nested package */
86 Perl_dump_sub(pTHX_ const GV *gv)
88 SV * const sv = sv_newmortal();
90 gv_fullname3(sv, gv, NULL);
91 Perl_dump_indent(aTHX_ 0, Perl_debug_log, "\nSUB %s = ", SvPVX_const(sv));
92 if (CvISXSUB(GvCV(gv)))
93 Perl_dump_indent(aTHX_ 0, Perl_debug_log, "(xsub 0x%"UVxf" %d)\n",
94 PTR2UV(CvXSUB(GvCV(gv))),
95 (int)CvXSUBANY(GvCV(gv)).any_i32);
96 else if (CvROOT(GvCV(gv)))
97 op_dump(CvROOT(GvCV(gv)));
99 Perl_dump_indent(aTHX_ 0, Perl_debug_log, "<undef>\n");
103 Perl_dump_form(pTHX_ const GV *gv)
105 SV * const sv = sv_newmortal();
107 gv_fullname3(sv, gv, NULL);
108 Perl_dump_indent(aTHX_ 0, Perl_debug_log, "\nFORMAT %s = ", SvPVX_const(sv));
109 if (CvROOT(GvFORM(gv)))
110 op_dump(CvROOT(GvFORM(gv)));
112 Perl_dump_indent(aTHX_ 0, Perl_debug_log, "<undef>\n");
119 op_dump(PL_eval_root);
124 =for apidoc Apd|char*|pv_escape|NN SV *dsv|NN const char *pv|const STRLEN count|const STRLEN max|const U32 flags
126 Escapes at most the first "count" chars of pv and puts the results into
127 buf such that the size of the escaped string will not exceed "max" chars
128 and will not contain any incomplete escape sequences.
130 If flags contains PERL_PV_ESCAPE_QUOTE then the string will have quotes
131 placed around it; moreover, if the number of chars converted was less than
132 "count" then a trailing elipses (...) will be added after the closing
135 If PERL_PV_ESCAPE_QUOTE is not set, but PERL_PV_ESCAPE_PADR is, then the
136 returned string will be right padded with spaces such that it is max chars
139 Normally the SV will be cleared before the escaped string is prepared,
140 but when PERL_PV_ESCAPE_CAT is set this will not occur.
142 Returns a pointer to the string contained by SV.
148 Perl_pv_escape( pTHX_ SV *dsv, const char *pv, const STRLEN count, const STRLEN max, const U32 flags ) {
149 char dq = (flags & PERL_PV_ESCAPE_QUOTE) ? '"' : '\\';
150 char octbuf[8] = "\\0123456";
153 const char *end = pv + count;
155 if (flags & PERL_PV_ESCAPE_CAT) {
157 sv_catpvn(dsv, "\"", 1);
160 sv_setpvn(dsv, "\"", 1);
162 sv_setpvn(dsv, "", 0);
164 for ( ; (pv < end && (!max || (wrote < max))) ; pv++ ) {
165 if ( (*pv == dq) || (*pv == '\\') || isCNTRL(*pv) ) {
168 case '\\' : octbuf[1] = '\\'; break;
169 case '\v' : octbuf[1] = 'v'; break;
170 case '\t' : octbuf[1] = 't'; break;
171 case '\r' : octbuf[1] = 'r'; break;
172 case '\n' : octbuf[1] = 'n'; break;
173 case '\f' : octbuf[1] = 'f'; break;
174 case '"' : if ( dq == *pv ) {
179 /* note the (U8*) casts here are important.
180 * if they are omitted we can produce the octal
181 * for a negative number which could produce a
182 * buffer overrun in octbuf, with it on we are
183 * guaranteed that the longest the string could be
184 * is 5, (we reserve 8 just because its the first
185 * power of 2 larger than 5.)*/
186 if ( (pv < end) && isDIGIT(*(pv+1)) )
187 chsize = sprintf( octbuf, "\\%03o", (U8)*pv);
189 chsize = sprintf( octbuf, "\\%o", (U8)*pv);
191 if ( max && (wrote + chsize > max) ) {
194 sv_catpvn(dsv, octbuf, chsize);
198 sv_catpvn(dsv, pv, 1);
203 sv_catpvn( dsv, "\"", 1 );
205 sv_catpvn( dsv, "...", 3 );
206 } else if ( max && (flags & PERL_PV_ESCAPE_PADR) ) {
207 for ( ; wrote < max ; wrote++ )
208 sv_catpvn( dsv, " ", 1 );
214 =for apidoc pv_display
216 char *pv_display(SV *dsv, const char *pv, STRLEN cur, STRLEN len,
217 STRLEN pvlim, U32 flags)
221 pv_escape(dsv,pv,cur,pvlim,PERL_PV_ESCAPE_QUOTE);
223 except that an additional "\0" will be appended to the string when
224 len > cur and pv[cur] is "\0".
226 Note that the final string may be up to 7 chars longer than pvlim.
232 Perl_pv_display(pTHX_ SV *dsv, const char *pv, STRLEN cur, STRLEN len, STRLEN pvlim)
234 pv_escape( dsv, pv, cur, pvlim, PERL_PV_ESCAPE_QUOTE);
235 if (len > cur && pv[cur] == '\0')
236 sv_catpvn( dsv, "\\0", 2 );
241 Perl_sv_peek(pTHX_ SV *sv)
244 SV * const t = sv_newmortal();
253 else if (sv == (SV*)0x55555555 || SvTYPE(sv) == 'U') {
257 else if (sv == &PL_sv_undef || sv == &PL_sv_no || sv == &PL_sv_yes || sv == &PL_sv_placeholder) {
258 if (sv == &PL_sv_undef) {
259 sv_catpv(t, "SV_UNDEF");
260 if (!(SvFLAGS(sv) & (SVf_OK|SVf_OOK|SVs_OBJECT|
261 SVs_GMG|SVs_SMG|SVs_RMG)) &&
265 else if (sv == &PL_sv_no) {
266 sv_catpv(t, "SV_NO");
267 if (!(SvFLAGS(sv) & (SVf_ROK|SVf_OOK|SVs_OBJECT|
268 SVs_GMG|SVs_SMG|SVs_RMG)) &&
269 !(~SvFLAGS(sv) & (SVf_POK|SVf_NOK|SVf_READONLY|
275 else if (sv == &PL_sv_yes) {
276 sv_catpv(t, "SV_YES");
277 if (!(SvFLAGS(sv) & (SVf_ROK|SVf_OOK|SVs_OBJECT|
278 SVs_GMG|SVs_SMG|SVs_RMG)) &&
279 !(~SvFLAGS(sv) & (SVf_POK|SVf_NOK|SVf_READONLY|
282 SvPVX_const(sv) && *SvPVX_const(sv) == '1' &&
287 sv_catpv(t, "SV_PLACEHOLDER");
288 if (!(SvFLAGS(sv) & (SVf_OK|SVf_OOK|SVs_OBJECT|
289 SVs_GMG|SVs_SMG|SVs_RMG)) &&
295 else if (SvREFCNT(sv) == 0) {
299 else if (DEBUG_R_TEST_) {
302 /* is this SV on the tmps stack? */
303 for (ix=PL_tmps_ix; ix>=0; ix--) {
304 if (PL_tmps_stack[ix] == sv) {
309 if (SvREFCNT(sv) > 1)
310 Perl_sv_catpvf(aTHX_ t, "<%"UVuf"%s>", (UV)SvREFCNT(sv),
318 if (SvCUR(t) + unref > 10) {
319 SvCUR_set(t, unref + 3);
327 switch (SvTYPE(sv)) {
329 sv_catpv(t, "FREED");
333 sv_catpv(t, "UNDEF");
367 Perl_sv_catpvf(aTHX_ t, "CV(%s)", GvNAME(CvGV(sv)));
386 if (!SvPVX_const(sv))
387 sv_catpv(t, "(null)");
389 SV * const tmp = newSVpvs("");
392 Perl_sv_catpvf(aTHX_ t, "[%s]", pv_display(tmp, SvPVX_const(sv)-SvIVX(sv), SvIVX(sv), 0, 127));
393 Perl_sv_catpvf(aTHX_ t, "%s)", pv_display(tmp, SvPVX_const(sv), SvCUR(sv), SvLEN(sv), 127));
395 Perl_sv_catpvf(aTHX_ t, " [UTF8 \"%s\"]",
396 sv_uni_display(tmp, sv, 8 * sv_len_utf8(sv),
401 else if (SvNOKp(sv)) {
402 STORE_NUMERIC_LOCAL_SET_STANDARD();
403 Perl_sv_catpvf(aTHX_ t, "(%"NVgf")",SvNVX(sv));
404 RESTORE_NUMERIC_LOCAL();
406 else if (SvIOKp(sv)) {
408 Perl_sv_catpvf(aTHX_ t, "(%"UVuf")", (UV)SvUVX(sv));
410 Perl_sv_catpvf(aTHX_ t, "(%"IVdf")", (IV)SvIVX(sv));
420 return SvPV_nolen(t);
424 Perl_do_pmop_dump(pTHX_ I32 level, PerlIO *file, const PMOP *pm)
429 Perl_dump_indent(aTHX_ level, file, "{}\n");
432 Perl_dump_indent(aTHX_ level, file, "{\n");
434 if (pm->op_pmflags & PMf_ONCE)
439 Perl_dump_indent(aTHX_ level, file, "PMf_PRE %c%s%c%s\n",
440 ch, PM_GETRE(pm)->precomp, ch,
441 (pm->op_private & OPpRUNTIME) ? " (RUNTIME)" : "");
443 Perl_dump_indent(aTHX_ level, file, "PMf_PRE (RUNTIME)\n");
444 if (pm->op_type != OP_PUSHRE && pm->op_pmreplroot) {
445 Perl_dump_indent(aTHX_ level, file, "PMf_REPL = ");
446 op_dump(pm->op_pmreplroot);
448 if (pm->op_pmflags || (PM_GETRE(pm) && PM_GETRE(pm)->check_substr)) {
449 SV * const tmpsv = pm_description(pm);
450 Perl_dump_indent(aTHX_ level, file, "PMFLAGS = (%s)\n", SvCUR(tmpsv) ? SvPVX_const(tmpsv) + 1 : "");
454 Perl_dump_indent(aTHX_ level-1, file, "}\n");
458 S_pm_description(pTHX_ const PMOP *pm)
460 SV * const desc = newSVpvs("");
461 const REGEXP * regex = PM_GETRE(pm);
462 const U32 pmflags = pm->op_pmflags;
464 if (pm->op_pmdynflags & PMdf_USED)
465 sv_catpv(desc, ",USED");
466 if (pm->op_pmdynflags & PMdf_TAINTED)
467 sv_catpv(desc, ",TAINTED");
469 if (pmflags & PMf_ONCE)
470 sv_catpv(desc, ",ONCE");
471 if (regex && regex->check_substr) {
472 if (!(regex->reganch & ROPT_NOSCAN))
473 sv_catpv(desc, ",SCANFIRST");
474 if (regex->reganch & ROPT_CHECK_ALL)
475 sv_catpv(desc, ",ALL");
477 if (pmflags & PMf_SKIPWHITE)
478 sv_catpv(desc, ",SKIPWHITE");
479 if (pmflags & PMf_CONST)
480 sv_catpv(desc, ",CONST");
481 if (pmflags & PMf_KEEP)
482 sv_catpv(desc, ",KEEP");
483 if (pmflags & PMf_GLOBAL)
484 sv_catpv(desc, ",GLOBAL");
485 if (pmflags & PMf_CONTINUE)
486 sv_catpv(desc, ",CONTINUE");
487 if (pmflags & PMf_RETAINT)
488 sv_catpv(desc, ",RETAINT");
489 if (pmflags & PMf_EVAL)
490 sv_catpv(desc, ",EVAL");
495 Perl_pmop_dump(pTHX_ PMOP *pm)
497 do_pmop_dump(0, Perl_debug_log, pm);
500 /* An op sequencer. We visit the ops in the order they're to execute. */
503 S_sequence(pTHX_ register const OP *o)
506 const OP *oldop = NULL;
519 for (; o; o = o->op_next) {
521 SV * const op = newSVuv(PTR2UV(o));
522 const char * const key = SvPV_const(op, len);
524 if (hv_exists(Sequence, key, len))
527 switch (o->op_type) {
529 if ((o->op_flags & OPf_WANT) != OPf_WANT_LIST) {
530 hv_store(Sequence, key, len, newSVuv(++PL_op_seq), 0);
539 if (oldop && o->op_next)
546 if (oldop && o->op_next)
548 hv_store(Sequence, key, len, newSVuv(++PL_op_seq), 0);
561 hv_store(Sequence, key, len, newSVuv(++PL_op_seq), 0);
562 sequence_tail(cLOGOPo->op_other);
567 hv_store(Sequence, key, len, newSVuv(++PL_op_seq), 0);
568 sequence_tail(cLOOPo->op_redoop);
569 sequence_tail(cLOOPo->op_nextop);
570 sequence_tail(cLOOPo->op_lastop);
576 hv_store(Sequence, key, len, newSVuv(++PL_op_seq), 0);
577 sequence_tail(cPMOPo->op_pmreplstart);
584 hv_store(Sequence, key, len, newSVuv(++PL_op_seq), 0);
592 S_sequence_tail(pTHX_ const OP *o)
594 while (o && (o->op_type == OP_NULL))
600 S_sequence_num(pTHX_ const OP *o)
608 op = newSVuv(PTR2UV(o));
609 key = SvPV_const(op, len);
610 seq = hv_fetch(Sequence, key, len, 0);
611 return seq ? SvUV(*seq): 0;
615 Perl_do_op_dump(pTHX_ I32 level, PerlIO *file, const OP *o)
619 const OPCODE optype = o->op_type;
622 Perl_dump_indent(aTHX_ level, file, "{\n");
624 seq = sequence_num(o);
626 PerlIO_printf(file, "%-4"UVf, seq);
628 PerlIO_printf(file, " ");
630 "%*sTYPE = %s ===> ",
631 (int)(PL_dumpindent*level-4), "", OP_NAME(o));
633 PerlIO_printf(file, seq ? "%"UVf"\n" : "(%"UVf")\n",
634 sequence_num(o->op_next));
636 PerlIO_printf(file, "DONE\n");
638 if (optype == OP_NULL) {
639 Perl_dump_indent(aTHX_ level, file, " (was %s)\n", PL_op_name[o->op_targ]);
640 if (o->op_targ == OP_NEXTSTATE) {
642 Perl_dump_indent(aTHX_ level, file, "LINE = %"UVf"\n",
644 if (CopSTASHPV(cCOPo))
645 Perl_dump_indent(aTHX_ level, file, "PACKAGE = \"%s\"\n",
647 if (cCOPo->cop_label)
648 Perl_dump_indent(aTHX_ level, file, "LABEL = \"%s\"\n",
653 Perl_dump_indent(aTHX_ level, file, "TARG = %ld\n", (long)o->op_targ);
656 Perl_dump_indent(aTHX_ level, file, "ADDR = 0x%"UVxf" => 0x%"UVxf"\n", (UV)o, (UV)o->op_next);
659 SV * const tmpsv = newSVpvs("");
660 switch (o->op_flags & OPf_WANT) {
662 sv_catpv(tmpsv, ",VOID");
664 case OPf_WANT_SCALAR:
665 sv_catpv(tmpsv, ",SCALAR");
668 sv_catpv(tmpsv, ",LIST");
671 sv_catpv(tmpsv, ",UNKNOWN");
674 if (o->op_flags & OPf_KIDS)
675 sv_catpv(tmpsv, ",KIDS");
676 if (o->op_flags & OPf_PARENS)
677 sv_catpv(tmpsv, ",PARENS");
678 if (o->op_flags & OPf_STACKED)
679 sv_catpv(tmpsv, ",STACKED");
680 if (o->op_flags & OPf_REF)
681 sv_catpv(tmpsv, ",REF");
682 if (o->op_flags & OPf_MOD)
683 sv_catpv(tmpsv, ",MOD");
684 if (o->op_flags & OPf_SPECIAL)
685 sv_catpv(tmpsv, ",SPECIAL");
686 Perl_dump_indent(aTHX_ level, file, "FLAGS = (%s)\n", SvCUR(tmpsv) ? SvPVX_const(tmpsv) + 1 : "");
690 SV * const tmpsv = newSVpvs("");
691 if (PL_opargs[optype] & OA_TARGLEX) {
692 if (o->op_private & OPpTARGET_MY)
693 sv_catpv(tmpsv, ",TARGET_MY");
695 else if (optype == OP_LEAVESUB ||
696 optype == OP_LEAVE ||
697 optype == OP_LEAVESUBLV ||
698 optype == OP_LEAVEWRITE) {
699 if (o->op_private & OPpREFCOUNTED)
700 sv_catpv(tmpsv, ",REFCOUNTED");
702 else if (optype == OP_AASSIGN) {
703 if (o->op_private & OPpASSIGN_COMMON)
704 sv_catpv(tmpsv, ",COMMON");
706 else if (optype == OP_SASSIGN) {
707 if (o->op_private & OPpASSIGN_BACKWARDS)
708 sv_catpv(tmpsv, ",BACKWARDS");
710 else if (optype == OP_TRANS) {
711 if (o->op_private & OPpTRANS_SQUASH)
712 sv_catpv(tmpsv, ",SQUASH");
713 if (o->op_private & OPpTRANS_DELETE)
714 sv_catpv(tmpsv, ",DELETE");
715 if (o->op_private & OPpTRANS_COMPLEMENT)
716 sv_catpv(tmpsv, ",COMPLEMENT");
717 if (o->op_private & OPpTRANS_IDENTICAL)
718 sv_catpv(tmpsv, ",IDENTICAL");
719 if (o->op_private & OPpTRANS_GROWS)
720 sv_catpv(tmpsv, ",GROWS");
722 else if (optype == OP_REPEAT) {
723 if (o->op_private & OPpREPEAT_DOLIST)
724 sv_catpv(tmpsv, ",DOLIST");
726 else if (optype == OP_ENTERSUB ||
727 optype == OP_RV2SV ||
729 optype == OP_RV2AV ||
730 optype == OP_RV2HV ||
731 optype == OP_RV2GV ||
732 optype == OP_AELEM ||
735 if (optype == OP_ENTERSUB) {
736 if (o->op_private & OPpENTERSUB_AMPER)
737 sv_catpv(tmpsv, ",AMPER");
738 if (o->op_private & OPpENTERSUB_DB)
739 sv_catpv(tmpsv, ",DB");
740 if (o->op_private & OPpENTERSUB_HASTARG)
741 sv_catpv(tmpsv, ",HASTARG");
742 if (o->op_private & OPpENTERSUB_NOPAREN)
743 sv_catpv(tmpsv, ",NOPAREN");
744 if (o->op_private & OPpENTERSUB_INARGS)
745 sv_catpv(tmpsv, ",INARGS");
746 if (o->op_private & OPpENTERSUB_NOMOD)
747 sv_catpv(tmpsv, ",NOMOD");
750 switch (o->op_private & OPpDEREF) {
752 sv_catpv(tmpsv, ",SV");
755 sv_catpv(tmpsv, ",AV");
758 sv_catpv(tmpsv, ",HV");
761 if (o->op_private & OPpMAYBE_LVSUB)
762 sv_catpv(tmpsv, ",MAYBE_LVSUB");
764 if (optype == OP_AELEM || optype == OP_HELEM) {
765 if (o->op_private & OPpLVAL_DEFER)
766 sv_catpv(tmpsv, ",LVAL_DEFER");
769 if (o->op_private & HINT_STRICT_REFS)
770 sv_catpv(tmpsv, ",STRICT_REFS");
771 if (o->op_private & OPpOUR_INTRO)
772 sv_catpv(tmpsv, ",OUR_INTRO");
775 else if (optype == OP_CONST) {
776 if (o->op_private & OPpCONST_BARE)
777 sv_catpv(tmpsv, ",BARE");
778 if (o->op_private & OPpCONST_STRICT)
779 sv_catpv(tmpsv, ",STRICT");
780 if (o->op_private & OPpCONST_ARYBASE)
781 sv_catpv(tmpsv, ",ARYBASE");
782 if (o->op_private & OPpCONST_WARNING)
783 sv_catpv(tmpsv, ",WARNING");
784 if (o->op_private & OPpCONST_ENTERED)
785 sv_catpv(tmpsv, ",ENTERED");
787 else if (optype == OP_FLIP) {
788 if (o->op_private & OPpFLIP_LINENUM)
789 sv_catpv(tmpsv, ",LINENUM");
791 else if (optype == OP_FLOP) {
792 if (o->op_private & OPpFLIP_LINENUM)
793 sv_catpv(tmpsv, ",LINENUM");
795 else if (optype == OP_RV2CV) {
796 if (o->op_private & OPpLVAL_INTRO)
797 sv_catpv(tmpsv, ",INTRO");
799 else if (optype == OP_GV) {
800 if (o->op_private & OPpEARLY_CV)
801 sv_catpv(tmpsv, ",EARLY_CV");
803 else if (optype == OP_LIST) {
804 if (o->op_private & OPpLIST_GUESSED)
805 sv_catpv(tmpsv, ",GUESSED");
807 else if (optype == OP_DELETE) {
808 if (o->op_private & OPpSLICE)
809 sv_catpv(tmpsv, ",SLICE");
811 else if (optype == OP_EXISTS) {
812 if (o->op_private & OPpEXISTS_SUB)
813 sv_catpv(tmpsv, ",EXISTS_SUB");
815 else if (optype == OP_SORT) {
816 if (o->op_private & OPpSORT_NUMERIC)
817 sv_catpv(tmpsv, ",NUMERIC");
818 if (o->op_private & OPpSORT_INTEGER)
819 sv_catpv(tmpsv, ",INTEGER");
820 if (o->op_private & OPpSORT_REVERSE)
821 sv_catpv(tmpsv, ",REVERSE");
823 else if (optype == OP_THREADSV) {
824 if (o->op_private & OPpDONE_SVREF)
825 sv_catpv(tmpsv, ",SVREF");
827 else if (optype == OP_OPEN || optype == OP_BACKTICK) {
828 if (o->op_private & OPpOPEN_IN_RAW)
829 sv_catpv(tmpsv, ",IN_RAW");
830 if (o->op_private & OPpOPEN_IN_CRLF)
831 sv_catpv(tmpsv, ",IN_CRLF");
832 if (o->op_private & OPpOPEN_OUT_RAW)
833 sv_catpv(tmpsv, ",OUT_RAW");
834 if (o->op_private & OPpOPEN_OUT_CRLF)
835 sv_catpv(tmpsv, ",OUT_CRLF");
837 else if (optype == OP_EXIT) {
838 if (o->op_private & OPpEXIT_VMSISH)
839 sv_catpv(tmpsv, ",EXIT_VMSISH");
840 if (o->op_private & OPpHUSH_VMSISH)
841 sv_catpv(tmpsv, ",HUSH_VMSISH");
843 else if (optype == OP_DIE) {
844 if (o->op_private & OPpHUSH_VMSISH)
845 sv_catpv(tmpsv, ",HUSH_VMSISH");
847 else if (PL_check[optype] != MEMBER_TO_FPTR(Perl_ck_ftst)) {
848 if (OP_IS_FILETEST_ACCESS(o) && o->op_private & OPpFT_ACCESS)
849 sv_catpv(tmpsv, ",FT_ACCESS");
850 if (o->op_private & OPpFT_STACKED)
851 sv_catpv(tmpsv, ",FT_STACKED");
853 if (o->op_flags & OPf_MOD && o->op_private & OPpLVAL_INTRO)
854 sv_catpv(tmpsv, ",INTRO");
856 Perl_dump_indent(aTHX_ level, file, "PRIVATE = (%s)\n", SvPVX_const(tmpsv) + 1);
861 if (PL_madskills && o->op_madprop) {
862 SV * const tmpsv = newSVpvn("", 0);
863 MADPROP* mp = o->op_madprop;
864 Perl_dump_indent(aTHX_ level, file, "MADPROPS = {\n");
867 char tmp = mp->mad_key;
868 sv_setpvn(tmpsv,"'",1);
870 sv_catpvn(tmpsv, &tmp, 1);
871 sv_catpv(tmpsv, "'=");
872 switch (mp->mad_type) {
874 sv_catpv(tmpsv, "NULL");
875 Perl_dump_indent(aTHX_ level, file, "%s\n", SvPVX(tmpsv));
878 sv_catpv(tmpsv, "<");
879 sv_catpvn(tmpsv, (char*)mp->mad_val, mp->mad_vlen);
880 sv_catpv(tmpsv, ">");
881 Perl_dump_indent(aTHX_ level, file, "%s\n", SvPVX(tmpsv));
884 if ((OP*)mp->mad_val) {
885 Perl_dump_indent(aTHX_ level, file, "%s\n", SvPVX(tmpsv));
886 do_op_dump(level, file, (OP*)mp->mad_val);
890 sv_catpv(tmpsv, "(UNK)");
891 Perl_dump_indent(aTHX_ level, file, "%s\n", SvPVX(tmpsv));
897 Perl_dump_indent(aTHX_ level, file, "}\n");
908 Perl_dump_indent(aTHX_ level, file, "PADIX = %" IVdf "\n", (IV)cPADOPo->op_padix);
910 if ( ! PL_op->op_flags & OPf_SPECIAL) { /* not lexical */
912 SV * const tmpsv = newSV(0);
916 /* FIXME - it this making unwarranted assumptions about the
917 UTF-8 cleanliness of the dump file handle? */
920 gv_fullname3(tmpsv, (GV*)cSVOPo->op_sv, NULL);
921 Perl_dump_indent(aTHX_ level, file, "GV = %s\n",
922 SvPV_nolen_const(tmpsv));
926 Perl_dump_indent(aTHX_ level, file, "GV = NULL\n");
931 case OP_METHOD_NAMED:
933 /* with ITHREADS, consts are stored in the pad, and the right pad
934 * may not be active here, so skip */
935 Perl_dump_indent(aTHX_ level, file, "SV = %s\n", SvPEEK(cSVOPo_sv));
942 Perl_dump_indent(aTHX_ level, file, "LINE = %"UVf"\n",
944 if (CopSTASHPV(cCOPo))
945 Perl_dump_indent(aTHX_ level, file, "PACKAGE = \"%s\"\n",
947 if (cCOPo->cop_label)
948 Perl_dump_indent(aTHX_ level, file, "LABEL = \"%s\"\n",
952 Perl_dump_indent(aTHX_ level, file, "REDO ===> ");
953 if (cLOOPo->op_redoop)
954 PerlIO_printf(file, "%"UVf"\n", sequence_num(cLOOPo->op_redoop));
956 PerlIO_printf(file, "DONE\n");
957 Perl_dump_indent(aTHX_ level, file, "NEXT ===> ");
958 if (cLOOPo->op_nextop)
959 PerlIO_printf(file, "%"UVf"\n", sequence_num(cLOOPo->op_nextop));
961 PerlIO_printf(file, "DONE\n");
962 Perl_dump_indent(aTHX_ level, file, "LAST ===> ");
963 if (cLOOPo->op_lastop)
964 PerlIO_printf(file, "%"UVf"\n", sequence_num(cLOOPo->op_lastop));
966 PerlIO_printf(file, "DONE\n");
974 Perl_dump_indent(aTHX_ level, file, "OTHER ===> ");
975 if (cLOGOPo->op_other)
976 PerlIO_printf(file, "%"UVf"\n", sequence_num(cLOGOPo->op_other));
978 PerlIO_printf(file, "DONE\n");
984 do_pmop_dump(level, file, cPMOPo);
992 if (o->op_private & OPpREFCOUNTED)
993 Perl_dump_indent(aTHX_ level, file, "REFCNT = %"UVuf"\n", (UV)o->op_targ);
998 if (o->op_flags & OPf_KIDS) {
1000 for (kid = cUNOPo->op_first; kid; kid = kid->op_sibling)
1001 do_op_dump(level, file, kid);
1003 Perl_dump_indent(aTHX_ level-1, file, "}\n");
1007 Perl_op_dump(pTHX_ const OP *o)
1009 do_op_dump(0, Perl_debug_log, o);
1013 Perl_gv_dump(pTHX_ GV *gv)
1018 PerlIO_printf(Perl_debug_log, "{}\n");
1021 sv = sv_newmortal();
1022 PerlIO_printf(Perl_debug_log, "{\n");
1023 gv_fullname3(sv, gv, NULL);
1024 Perl_dump_indent(aTHX_ 1, Perl_debug_log, "GV_NAME = %s", SvPVX_const(sv));
1025 if (gv != GvEGV(gv)) {
1026 gv_efullname3(sv, GvEGV(gv), NULL);
1027 Perl_dump_indent(aTHX_ 1, Perl_debug_log, "-> %s", SvPVX_const(sv));
1029 PerlIO_putc(Perl_debug_log, '\n');
1030 Perl_dump_indent(aTHX_ 0, Perl_debug_log, "}\n");
1034 /* map magic types to the symbolic names
1035 * (with the PERL_MAGIC_ prefixed stripped)
1038 static const struct { const char type; const char *name; } magic_names[] = {
1039 { PERL_MAGIC_sv, "sv(\\0)" },
1040 { PERL_MAGIC_arylen, "arylen(#)" },
1041 { PERL_MAGIC_rhash, "rhash(%)" },
1042 { PERL_MAGIC_pos, "pos(.)" },
1043 { PERL_MAGIC_symtab, "symtab(:)" },
1044 { PERL_MAGIC_backref, "backref(<)" },
1045 { PERL_MAGIC_arylen_p, "arylen_p(@)" },
1046 { PERL_MAGIC_overload, "overload(A)" },
1047 { PERL_MAGIC_bm, "bm(B)" },
1048 { PERL_MAGIC_regdata, "regdata(D)" },
1049 { PERL_MAGIC_env, "env(E)" },
1050 { PERL_MAGIC_hints, "hints(H)" },
1051 { PERL_MAGIC_isa, "isa(I)" },
1052 { PERL_MAGIC_dbfile, "dbfile(L)" },
1053 { PERL_MAGIC_shared, "shared(N)" },
1054 { PERL_MAGIC_tied, "tied(P)" },
1055 { PERL_MAGIC_sig, "sig(S)" },
1056 { PERL_MAGIC_uvar, "uvar(U)" },
1057 { PERL_MAGIC_overload_elem, "overload_elem(a)" },
1058 { PERL_MAGIC_overload_table, "overload_table(c)" },
1059 { PERL_MAGIC_regdatum, "regdatum(d)" },
1060 { PERL_MAGIC_envelem, "envelem(e)" },
1061 { PERL_MAGIC_fm, "fm(f)" },
1062 { PERL_MAGIC_regex_global, "regex_global(g)" },
1063 { PERL_MAGIC_hintselem, "hintselem(h)" },
1064 { PERL_MAGIC_isaelem, "isaelem(i)" },
1065 { PERL_MAGIC_nkeys, "nkeys(k)" },
1066 { PERL_MAGIC_dbline, "dbline(l)" },
1067 { PERL_MAGIC_mutex, "mutex(m)" },
1068 { PERL_MAGIC_shared_scalar, "shared_scalar(n)" },
1069 { PERL_MAGIC_collxfrm, "collxfrm(o)" },
1070 { PERL_MAGIC_tiedelem, "tiedelem(p)" },
1071 { PERL_MAGIC_tiedscalar, "tiedscalar(q)" },
1072 { PERL_MAGIC_qr, "qr(r)" },
1073 { PERL_MAGIC_sigelem, "sigelem(s)" },
1074 { PERL_MAGIC_taint, "taint(t)" },
1075 { PERL_MAGIC_uvar_elem, "uvar_elem(v)" },
1076 { PERL_MAGIC_vec, "vec(v)" },
1077 { PERL_MAGIC_vstring, "vstring(V)" },
1078 { PERL_MAGIC_utf8, "utf8(w)" },
1079 { PERL_MAGIC_substr, "substr(x)" },
1080 { PERL_MAGIC_defelem, "defelem(y)" },
1081 { PERL_MAGIC_ext, "ext(~)" },
1082 /* this null string terminates the list */
1087 Perl_do_magic_dump(pTHX_ I32 level, PerlIO *file, const MAGIC *mg, I32 nest, I32 maxnest, bool dumpops, STRLEN pvlim)
1089 for (; mg; mg = mg->mg_moremagic) {
1090 Perl_dump_indent(aTHX_ level, file,
1091 " MAGIC = 0x%"UVxf"\n", PTR2UV(mg));
1092 if (mg->mg_virtual) {
1093 const MGVTBL * const v = mg->mg_virtual;
1095 if (v == &PL_vtbl_sv) s = "sv";
1096 else if (v == &PL_vtbl_env) s = "env";
1097 else if (v == &PL_vtbl_envelem) s = "envelem";
1098 else if (v == &PL_vtbl_sig) s = "sig";
1099 else if (v == &PL_vtbl_sigelem) s = "sigelem";
1100 else if (v == &PL_vtbl_pack) s = "pack";
1101 else if (v == &PL_vtbl_packelem) s = "packelem";
1102 else if (v == &PL_vtbl_dbline) s = "dbline";
1103 else if (v == &PL_vtbl_isa) s = "isa";
1104 else if (v == &PL_vtbl_arylen) s = "arylen";
1105 else if (v == &PL_vtbl_mglob) s = "mglob";
1106 else if (v == &PL_vtbl_nkeys) s = "nkeys";
1107 else if (v == &PL_vtbl_taint) s = "taint";
1108 else if (v == &PL_vtbl_substr) s = "substr";
1109 else if (v == &PL_vtbl_vec) s = "vec";
1110 else if (v == &PL_vtbl_pos) s = "pos";
1111 else if (v == &PL_vtbl_bm) s = "bm";
1112 else if (v == &PL_vtbl_fm) s = "fm";
1113 else if (v == &PL_vtbl_uvar) s = "uvar";
1114 else if (v == &PL_vtbl_defelem) s = "defelem";
1115 #ifdef USE_LOCALE_COLLATE
1116 else if (v == &PL_vtbl_collxfrm) s = "collxfrm";
1118 else if (v == &PL_vtbl_amagic) s = "amagic";
1119 else if (v == &PL_vtbl_amagicelem) s = "amagicelem";
1120 else if (v == &PL_vtbl_backref) s = "backref";
1121 else if (v == &PL_vtbl_utf8) s = "utf8";
1122 else if (v == &PL_vtbl_arylen_p) s = "arylen_p";
1123 else if (v == &PL_vtbl_hintselem) s = "hintselem";
1126 Perl_dump_indent(aTHX_ level, file, " MG_VIRTUAL = &PL_vtbl_%s\n", s);
1128 Perl_dump_indent(aTHX_ level, file, " MG_VIRTUAL = 0x%"UVxf"\n", PTR2UV(v));
1131 Perl_dump_indent(aTHX_ level, file, " MG_VIRTUAL = 0\n");
1134 Perl_dump_indent(aTHX_ level, file, " MG_PRIVATE = %d\n", mg->mg_private);
1138 const char *name = NULL;
1139 for (n = 0; magic_names[n].name; n++) {
1140 if (mg->mg_type == magic_names[n].type) {
1141 name = magic_names[n].name;
1146 Perl_dump_indent(aTHX_ level, file,
1147 " MG_TYPE = PERL_MAGIC_%s\n", name);
1149 Perl_dump_indent(aTHX_ level, file,
1150 " MG_TYPE = UNKNOWN(\\%o)\n", mg->mg_type);
1154 Perl_dump_indent(aTHX_ level, file, " MG_FLAGS = 0x%02X\n", mg->mg_flags);
1155 if (mg->mg_type == PERL_MAGIC_envelem &&
1156 mg->mg_flags & MGf_TAINTEDDIR)
1157 Perl_dump_indent(aTHX_ level, file, " TAINTEDDIR\n");
1158 if (mg->mg_flags & MGf_REFCOUNTED)
1159 Perl_dump_indent(aTHX_ level, file, " REFCOUNTED\n");
1160 if (mg->mg_flags & MGf_GSKIP)
1161 Perl_dump_indent(aTHX_ level, file, " GSKIP\n");
1162 if (mg->mg_type == PERL_MAGIC_regex_global &&
1163 mg->mg_flags & MGf_MINMATCH)
1164 Perl_dump_indent(aTHX_ level, file, " MINMATCH\n");
1167 Perl_dump_indent(aTHX_ level, file, " MG_OBJ = 0x%"UVxf"\n", PTR2UV(mg->mg_obj));
1168 if (mg->mg_flags & MGf_REFCOUNTED)
1169 do_sv_dump(level+2, file, mg->mg_obj, nest+1, maxnest, dumpops, pvlim); /* MG is already +1 */
1172 Perl_dump_indent(aTHX_ level, file, " MG_LEN = %ld\n", (long)mg->mg_len);
1174 Perl_dump_indent(aTHX_ level, file, " MG_PTR = 0x%"UVxf, PTR2UV(mg->mg_ptr));
1175 if (mg->mg_len >= 0) {
1176 if (mg->mg_type != PERL_MAGIC_utf8) {
1177 SV *sv = newSVpvs("");
1178 PerlIO_printf(file, " %s", pv_display(sv, mg->mg_ptr, mg->mg_len, 0, pvlim));
1182 else if (mg->mg_len == HEf_SVKEY) {
1183 PerlIO_puts(file, " => HEf_SVKEY\n");
1184 do_sv_dump(level+2, file, (SV*)((mg)->mg_ptr), nest+1, maxnest, dumpops, pvlim); /* MG is already +1 */
1188 PerlIO_puts(file, " ???? - please notify IZ");
1189 PerlIO_putc(file, '\n');
1191 if (mg->mg_type == PERL_MAGIC_utf8) {
1192 STRLEN *cache = (STRLEN *) mg->mg_ptr;
1195 for (i = 0; i < PERL_MAGIC_UTF8_CACHESIZE; i++)
1196 Perl_dump_indent(aTHX_ level, file,
1197 " %2"IVdf": %"UVuf" -> %"UVuf"\n",
1200 (UV)cache[i * 2 + 1]);
1207 Perl_magic_dump(pTHX_ const MAGIC *mg)
1209 do_magic_dump(0, Perl_debug_log, mg, 0, 0, FALSE, 0);
1213 Perl_do_hv_dump(pTHX_ I32 level, PerlIO *file, const char *name, HV *sv)
1216 Perl_dump_indent(aTHX_ level, file, "%s = 0x%"UVxf, name, PTR2UV(sv));
1217 if (sv && (hvname = HvNAME_get(sv)))
1218 PerlIO_printf(file, "\t\"%s\"\n", hvname);
1220 PerlIO_putc(file, '\n');
1224 Perl_do_gv_dump(pTHX_ I32 level, PerlIO *file, const char *name, GV *sv)
1226 Perl_dump_indent(aTHX_ level, file, "%s = 0x%"UVxf, name, PTR2UV(sv));
1227 if (sv && GvNAME(sv))
1228 PerlIO_printf(file, "\t\"%s\"\n", GvNAME(sv));
1230 PerlIO_putc(file, '\n');
1234 Perl_do_gvgv_dump(pTHX_ I32 level, PerlIO *file, const char *name, GV *sv)
1236 Perl_dump_indent(aTHX_ level, file, "%s = 0x%"UVxf, name, PTR2UV(sv));
1237 if (sv && GvNAME(sv)) {
1239 PerlIO_printf(file, "\t\"");
1240 if (GvSTASH(sv) && (hvname = HvNAME_get(GvSTASH(sv))))
1241 PerlIO_printf(file, "%s\" :: \"", hvname);
1242 PerlIO_printf(file, "%s\"\n", GvNAME(sv));
1245 PerlIO_putc(file, '\n');
1249 Perl_do_sv_dump(pTHX_ I32 level, PerlIO *file, SV *sv, I32 nest, I32 maxnest, bool dumpops, STRLEN pvlim)
1258 Perl_dump_indent(aTHX_ level, file, "SV = 0\n");
1262 flags = SvFLAGS(sv);
1265 d = Perl_newSVpvf(aTHX_
1266 "(0x%"UVxf") at 0x%"UVxf"\n%*s REFCNT = %"IVdf"\n%*s FLAGS = (",
1267 PTR2UV(SvANY(sv)), PTR2UV(sv),
1268 (int)(PL_dumpindent*level), "", (IV)SvREFCNT(sv),
1269 (int)(PL_dumpindent*level), "");
1271 if (flags & SVs_PADSTALE) sv_catpv(d, "PADSTALE,");
1272 if (flags & SVs_PADTMP) sv_catpv(d, "PADTMP,");
1273 if (flags & SVs_PADMY) sv_catpv(d, "PADMY,");
1274 if (flags & SVs_TEMP) sv_catpv(d, "TEMP,");
1275 if (flags & SVs_OBJECT) sv_catpv(d, "OBJECT,");
1276 if (flags & SVs_GMG) sv_catpv(d, "GMG,");
1277 if (flags & SVs_SMG) sv_catpv(d, "SMG,");
1278 if (flags & SVs_RMG) sv_catpv(d, "RMG,");
1280 if (flags & SVf_IOK) sv_catpv(d, "IOK,");
1281 if (flags & SVf_NOK) sv_catpv(d, "NOK,");
1282 if (flags & SVf_POK) sv_catpv(d, "POK,");
1283 if (flags & SVf_ROK) {
1284 sv_catpv(d, "ROK,");
1285 if (SvWEAKREF(sv)) sv_catpv(d, "WEAKREF,");
1287 if (flags & SVf_OOK) sv_catpv(d, "OOK,");
1288 if (flags & SVf_FAKE) sv_catpv(d, "FAKE,");
1289 if (flags & SVf_READONLY) sv_catpv(d, "READONLY,");
1291 if (flags & SVf_AMAGIC) sv_catpv(d, "OVERLOAD,");
1292 if (flags & SVp_IOK) sv_catpv(d, "pIOK,");
1293 if (flags & SVp_NOK) sv_catpv(d, "pNOK,");
1294 if (flags & SVp_POK) sv_catpv(d, "pPOK,");
1295 if (flags & SVp_SCREAM && type != SVt_PVHV)
1296 sv_catpv(d, "SCREAM,");
1301 if (CvANON(sv)) sv_catpv(d, "ANON,");
1302 if (CvUNIQUE(sv)) sv_catpv(d, "UNIQUE,");
1303 if (CvCLONE(sv)) sv_catpv(d, "CLONE,");
1304 if (CvCLONED(sv)) sv_catpv(d, "CLONED,");
1305 if (CvCONST(sv)) sv_catpv(d, "CONST,");
1306 if (CvNODEBUG(sv)) sv_catpv(d, "NODEBUG,");
1307 if (SvCOMPILED(sv)) sv_catpv(d, "COMPILED,");
1308 if (CvLVALUE(sv)) sv_catpv(d, "LVALUE,");
1309 if (CvMETHOD(sv)) sv_catpv(d, "METHOD,");
1310 if (CvLOCKED(sv)) sv_catpv(d, "LOCKED,");
1311 if (CvWEAKOUTSIDE(sv)) sv_catpv(d, "WEAKOUTSIDE,");
1312 if (CvASSERTION(sv)) sv_catpv(d, "ASSERTION,");
1315 if (HvSHAREKEYS(sv)) sv_catpv(d, "SHAREKEYS,");
1316 if (HvLAZYDEL(sv)) sv_catpv(d, "LAZYDEL,");
1317 if (HvHASKFLAGS(sv)) sv_catpv(d, "HASKFLAGS,");
1318 if (HvREHASH(sv)) sv_catpv(d, "REHASH,");
1319 if (flags & SVphv_CLONEABLE) sv_catpv(d, "CLONEABLE,");
1323 if (isGV_with_GP(sv)) {
1324 if (GvINTRO(sv)) sv_catpv(d, "INTRO,");
1325 if (GvMULTI(sv)) sv_catpv(d, "MULTI,");
1326 if (GvUNIQUE(sv)) sv_catpv(d, "UNIQUE,");
1327 if (GvASSUMECV(sv)) sv_catpv(d, "ASSUMECV,");
1328 if (GvIN_PAD(sv)) sv_catpv(d, "IN_PAD,");
1330 if (SvPAD_OUR(sv)) sv_catpv(d, "OUR,");
1331 if (SvPAD_STATE(sv)) sv_catpv(d, "STATE,");
1332 if (SvPAD_TYPED(sv)) sv_catpv(d, "TYPED,");
1333 if (isGV_with_GP(sv) && GvIMPORTED(sv)) {
1334 sv_catpv(d, "IMPORT");
1335 if (GvIMPORTED(sv) == GVf_IMPORTED)
1336 sv_catpv(d, "ALL,");
1339 if (GvIMPORTED_SV(sv)) sv_catpv(d, " SV");
1340 if (GvIMPORTED_AV(sv)) sv_catpv(d, " AV");
1341 if (GvIMPORTED_HV(sv)) sv_catpv(d, " HV");
1342 if (GvIMPORTED_CV(sv)) sv_catpv(d, " CV");
1348 if (SvEVALED(sv)) sv_catpv(d, "EVALED,");
1349 if (SvIsUV(sv) && !(flags & SVf_ROK)) sv_catpv(d, "IsUV,");
1352 if (SvTAIL(sv)) sv_catpv(d, "TAIL,");
1353 if (SvVALID(sv)) sv_catpv(d, "VALID,");
1356 if (SvPAD_TYPED(sv)) sv_catpv(d, "TYPED,");
1361 /* SVphv_SHAREKEYS is also 0x20000000 */
1362 if ((type != SVt_PVHV) && SvUTF8(sv))
1363 sv_catpv(d, "UTF8");
1365 if (*(SvEND(d) - 1) == ',') {
1366 SvCUR_set(d, SvCUR(d) - 1);
1367 SvPVX(d)[SvCUR(d)] = '\0';
1372 #ifdef DEBUG_LEAKING_SCALARS
1373 Perl_dump_indent(aTHX_ level, file, "ALLOCATED at %s:%d %s %s%s\n",
1374 sv->sv_debug_file ? sv->sv_debug_file : "(unknown)",
1376 sv->sv_debug_inpad ? "for" : "by",
1377 sv->sv_debug_optype ? PL_op_name[sv->sv_debug_optype]: "(none)",
1378 sv->sv_debug_cloned ? " (cloned)" : "");
1380 Perl_dump_indent(aTHX_ level, file, "SV = ");
1383 PerlIO_printf(file, "NULL%s\n", s);
1387 PerlIO_printf(file, "IV%s\n", s);
1390 PerlIO_printf(file, "NV%s\n", s);
1393 PerlIO_printf(file, "RV%s\n", s);
1396 PerlIO_printf(file, "PV%s\n", s);
1399 PerlIO_printf(file, "PVIV%s\n", s);
1402 PerlIO_printf(file, "PVNV%s\n", s);
1405 PerlIO_printf(file, "PVBM%s\n", s);
1408 PerlIO_printf(file, "PVMG%s\n", s);
1411 PerlIO_printf(file, "PVLV%s\n", s);
1414 PerlIO_printf(file, "PVAV%s\n", s);
1417 PerlIO_printf(file, "PVHV%s\n", s);
1420 PerlIO_printf(file, "PVCV%s\n", s);
1423 PerlIO_printf(file, "PVGV%s\n", s);
1426 PerlIO_printf(file, "PVFM%s\n", s);
1429 PerlIO_printf(file, "PVIO%s\n", s);
1432 PerlIO_printf(file, "UNKNOWN(0x%"UVxf") %s\n", (UV)type, s);
1436 if ((type >= SVt_PVIV && type != SVt_PVAV && type != SVt_PVHV
1437 && type != SVt_PVCV && !isGV_with_GP(sv))
1438 || type == SVt_IV) {
1440 #ifdef PERL_OLD_COPY_ON_WRITE
1444 Perl_dump_indent(aTHX_ level, file, " UV = %"UVuf, (UV)SvUVX(sv));
1446 Perl_dump_indent(aTHX_ level, file, " IV = %"IVdf, (IV)SvIVX(sv));
1448 PerlIO_printf(file, " (OFFSET)");
1449 #ifdef PERL_OLD_COPY_ON_WRITE
1450 if (SvIsCOW_shared_hash(sv))
1451 PerlIO_printf(file, " (HASH)");
1452 else if (SvIsCOW_normal(sv))
1453 PerlIO_printf(file, " (COW from 0x%"UVxf")", (UV)SvUVX(sv));
1455 PerlIO_putc(file, '\n');
1457 if ((type >= SVt_PVNV && type != SVt_PVAV && type != SVt_PVHV
1458 && type != SVt_PVCV && type != SVt_PVFM && !isGV_with_GP(sv))
1459 || type == SVt_NV) {
1460 STORE_NUMERIC_LOCAL_SET_STANDARD();
1461 /* %Vg doesn't work? --jhi */
1462 #ifdef USE_LONG_DOUBLE
1463 Perl_dump_indent(aTHX_ level, file, " NV = %.*" PERL_PRIgldbl "\n", LDBL_DIG, SvNVX(sv));
1465 Perl_dump_indent(aTHX_ level, file, " NV = %.*g\n", DBL_DIG, SvNVX(sv));
1467 RESTORE_NUMERIC_LOCAL();
1470 Perl_dump_indent(aTHX_ level, file, " RV = 0x%"UVxf"\n", PTR2UV(SvRV(sv)));
1472 do_sv_dump(level+1, file, SvRV(sv), nest+1, maxnest, dumpops, pvlim);
1474 if (type < SVt_PV) {
1478 if (type <= SVt_PVLV && !isGV_with_GP(sv)) {
1479 if (SvPVX_const(sv)) {
1480 Perl_dump_indent(aTHX_ level, file," PV = 0x%"UVxf" ", PTR2UV(SvPVX_const(sv)));
1482 PerlIO_printf(file, "( %s . ) ", pv_display(d, SvPVX_const(sv)-SvIVX(sv), SvIVX(sv), 0, pvlim));
1483 PerlIO_printf(file, "%s", pv_display(d, SvPVX_const(sv), SvCUR(sv), SvLEN(sv), pvlim));
1484 if (SvUTF8(sv)) /* the 8? \x{....} */
1485 PerlIO_printf(file, " [UTF8 \"%s\"]", sv_uni_display(d, sv, 8 * sv_len_utf8(sv), UNI_DISPLAY_QQ));
1486 PerlIO_printf(file, "\n");
1487 Perl_dump_indent(aTHX_ level, file, " CUR = %"IVdf"\n", (IV)SvCUR(sv));
1488 Perl_dump_indent(aTHX_ level, file, " LEN = %"IVdf"\n", (IV)SvLEN(sv));
1491 Perl_dump_indent(aTHX_ level, file, " PV = 0\n");
1493 if (type >= SVt_PVMG) {
1495 do_magic_dump(level, file, SvMAGIC(sv), nest, maxnest, dumpops, pvlim);
1497 do_hv_dump(level, file, " STASH", SvSTASH(sv));
1501 Perl_dump_indent(aTHX_ level, file, " ARRAY = 0x%"UVxf, PTR2UV(AvARRAY(sv)));
1502 if (AvARRAY(sv) != AvALLOC(sv)) {
1503 PerlIO_printf(file, " (offset=%"IVdf")\n", (IV)(AvARRAY(sv) - AvALLOC(sv)));
1504 Perl_dump_indent(aTHX_ level, file, " ALLOC = 0x%"UVxf"\n", PTR2UV(AvALLOC(sv)));
1507 PerlIO_putc(file, '\n');
1508 Perl_dump_indent(aTHX_ level, file, " FILL = %"IVdf"\n", (IV)AvFILLp(sv));
1509 Perl_dump_indent(aTHX_ level, file, " MAX = %"IVdf"\n", (IV)AvMAX(sv));
1510 Perl_dump_indent(aTHX_ level, file, " ARYLEN = 0x%"UVxf"\n", SvMAGIC(sv) ? PTR2UV(AvARYLEN(sv)) : 0);
1511 sv_setpvn(d, "", 0);
1512 if (AvREAL(sv)) sv_catpv(d, ",REAL");
1513 if (AvREIFY(sv)) sv_catpv(d, ",REIFY");
1514 Perl_dump_indent(aTHX_ level, file, " FLAGS = (%s)\n",
1515 SvCUR(d) ? SvPVX_const(d) + 1 : "");
1516 if (nest < maxnest && av_len((AV*)sv) >= 0) {
1518 for (count = 0; count <= av_len((AV*)sv) && count < maxnest; count++) {
1519 SV** elt = av_fetch((AV*)sv,count,0);
1521 Perl_dump_indent(aTHX_ level + 1, file, "Elt No. %"IVdf"\n", (IV)count);
1523 do_sv_dump(level+1, file, *elt, nest+1, maxnest, dumpops, pvlim);
1528 Perl_dump_indent(aTHX_ level, file, " ARRAY = 0x%"UVxf, PTR2UV(HvARRAY(sv)));
1529 if (HvARRAY(sv) && HvKEYS(sv)) {
1530 /* Show distribution of HEs in the ARRAY */
1532 #define FREQ_MAX ((int)(sizeof freq / sizeof freq[0] - 1))
1535 U32 pow2 = 2, keys = HvKEYS(sv);
1536 NV theoret, sum = 0;
1538 PerlIO_printf(file, " (");
1539 Zero(freq, FREQ_MAX + 1, int);
1540 for (i = 0; (STRLEN)i <= HvMAX(sv); i++) {
1543 for (h = HvARRAY(sv)[i]; h; h = HeNEXT(h))
1545 if (count > FREQ_MAX)
1551 for (i = 0; i <= max; i++) {
1553 PerlIO_printf(file, "%d%s:%d", i,
1554 (i == FREQ_MAX) ? "+" : "",
1557 PerlIO_printf(file, ", ");
1560 PerlIO_putc(file, ')');
1561 /* The "quality" of a hash is defined as the total number of
1562 comparisons needed to access every element once, relative
1563 to the expected number needed for a random hash.
1565 The total number of comparisons is equal to the sum of
1566 the squares of the number of entries in each bucket.
1567 For a random hash of n keys into k buckets, the expected
1572 for (i = max; i > 0; i--) { /* Precision: count down. */
1573 sum += freq[i] * i * i;
1575 while ((keys = keys >> 1))
1577 theoret = HvKEYS(sv);
1578 theoret += theoret * (theoret-1)/pow2;
1579 PerlIO_putc(file, '\n');
1580 Perl_dump_indent(aTHX_ level, file, " hash quality = %.1"NVff"%%", theoret/sum*100);
1582 PerlIO_putc(file, '\n');
1583 Perl_dump_indent(aTHX_ level, file, " KEYS = %"IVdf"\n", (IV)HvKEYS(sv));
1584 Perl_dump_indent(aTHX_ level, file, " FILL = %"IVdf"\n", (IV)HvFILL(sv));
1585 Perl_dump_indent(aTHX_ level, file, " MAX = %"IVdf"\n", (IV)HvMAX(sv));
1586 Perl_dump_indent(aTHX_ level, file, " RITER = %"IVdf"\n", (IV)HvRITER_get(sv));
1587 Perl_dump_indent(aTHX_ level, file, " EITER = 0x%"UVxf"\n", PTR2UV(HvEITER_get(sv)));
1589 MAGIC * const mg = mg_find(sv, PERL_MAGIC_symtab);
1590 if (mg && mg->mg_obj) {
1591 Perl_dump_indent(aTHX_ level, file, " PMROOT = 0x%"UVxf"\n", PTR2UV(mg->mg_obj));
1595 const char * const hvname = HvNAME_get(sv);
1597 Perl_dump_indent(aTHX_ level, file, " NAME = \"%s\"\n", hvname);
1600 const AV * const backrefs = *Perl_hv_backreferences_p(aTHX_ (HV*)sv);
1602 Perl_dump_indent(aTHX_ level, file, " BACKREFS = 0x%"UVxf"\n",
1604 do_sv_dump(level+1, file, (SV*)backrefs, nest+1, maxnest,
1608 if (nest < maxnest && !HvEITER_get(sv)) { /* Try to preserve iterator */
1610 HV * const hv = (HV*)sv;
1611 int count = maxnest - nest;
1614 while ((he = hv_iternext_flags(hv, HV_ITERNEXT_WANTPLACEHOLDERS))
1619 const U32 hash = HeHASH(he);
1621 keysv = hv_iterkeysv(he);
1622 keypv = SvPV_const(keysv, len);
1623 elt = hv_iterval(hv, he);
1624 Perl_dump_indent(aTHX_ level+1, file, "Elt %s ", pv_display(d, keypv, len, 0, pvlim));
1626 PerlIO_printf(file, "[UTF8 \"%s\"] ", sv_uni_display(d, keysv, 8 * sv_len_utf8(keysv), UNI_DISPLAY_QQ));
1628 PerlIO_printf(file, "[REHASH] ");
1629 PerlIO_printf(file, "HASH = 0x%"UVxf"\n", (UV)hash);
1630 do_sv_dump(level+1, file, elt, nest+1, maxnest, dumpops, pvlim);
1632 hv_iterinit(hv); /* Return to status quo */
1638 const char *const proto = SvPV_const(sv, len);
1639 Perl_dump_indent(aTHX_ level, file, " PROTOTYPE = \"%.*s\"\n",
1644 do_hv_dump(level, file, " COMP_STASH", CvSTASH(sv));
1645 if (!CvISXSUB(sv)) {
1647 Perl_dump_indent(aTHX_ level, file,
1648 " START = 0x%"UVxf" ===> %"IVdf"\n",
1649 PTR2UV(CvSTART(sv)),
1650 (IV)sequence_num(CvSTART(sv)));
1652 Perl_dump_indent(aTHX_ level, file, " ROOT = 0x%"UVxf"\n",
1653 PTR2UV(CvROOT(sv)));
1654 if (CvROOT(sv) && dumpops) {
1655 do_op_dump(level+1, file, CvROOT(sv));
1658 SV *constant = cv_const_sv((CV *)sv);
1660 Perl_dump_indent(aTHX_ level, file, " XSUB = 0x%"UVxf"\n", PTR2UV(CvXSUB(sv)));
1663 Perl_dump_indent(aTHX_ level, file, " XSUBANY = 0x%"UVxf
1665 PTR2UV(CvXSUBANY(sv).any_ptr));
1666 do_sv_dump(level+1, file, constant, nest+1, maxnest, dumpops,
1669 Perl_dump_indent(aTHX_ level, file, " XSUBANY = %"IVdf"\n",
1670 (IV)CvXSUBANY(sv).any_i32);
1673 do_gvgv_dump(level, file, " GVGV::GV", CvGV(sv));
1674 Perl_dump_indent(aTHX_ level, file, " FILE = \"%s\"\n", CvFILE(sv));
1675 Perl_dump_indent(aTHX_ level, file, " DEPTH = %"IVdf"\n", (IV)CvDEPTH(sv));
1676 Perl_dump_indent(aTHX_ level, file, " FLAGS = 0x%"UVxf"\n", (UV)CvFLAGS(sv));
1677 Perl_dump_indent(aTHX_ level, file, " OUTSIDE_SEQ = %"UVuf"\n", (UV)CvOUTSIDE_SEQ(sv));
1678 if (type == SVt_PVFM)
1679 Perl_dump_indent(aTHX_ level, file, " LINES = %"IVdf"\n", (IV)FmLINES(sv));
1680 Perl_dump_indent(aTHX_ level, file, " PADLIST = 0x%"UVxf"\n", PTR2UV(CvPADLIST(sv)));
1681 if (nest < maxnest) {
1682 do_dump_pad(level+1, file, CvPADLIST(sv), 0);
1685 const CV * const outside = CvOUTSIDE(sv);
1686 Perl_dump_indent(aTHX_ level, file, " OUTSIDE = 0x%"UVxf" (%s)\n",
1689 : CvANON(outside) ? "ANON"
1690 : (outside == PL_main_cv) ? "MAIN"
1691 : CvUNIQUE(outside) ? "UNIQUE"
1692 : CvGV(outside) ? GvNAME(CvGV(outside)) : "UNDEFINED"));
1694 if (nest < maxnest && (CvCLONE(sv) || CvCLONED(sv)))
1695 do_sv_dump(level+1, file, (SV*)CvOUTSIDE(sv), nest+1, maxnest, dumpops, pvlim);
1699 if (type == SVt_PVLV) {
1700 Perl_dump_indent(aTHX_ level, file, " TYPE = %c\n", LvTYPE(sv));
1701 Perl_dump_indent(aTHX_ level, file, " TARGOFF = %"IVdf"\n", (IV)LvTARGOFF(sv));
1702 Perl_dump_indent(aTHX_ level, file, " TARGLEN = %"IVdf"\n", (IV)LvTARGLEN(sv));
1703 Perl_dump_indent(aTHX_ level, file, " TARG = 0x%"UVxf"\n", PTR2UV(LvTARG(sv)));
1704 if (LvTYPE(sv) != 't' && LvTYPE(sv) != 'T')
1705 do_sv_dump(level+1, file, LvTARG(sv), nest+1, maxnest,
1708 if (!isGV_with_GP(sv))
1710 Perl_dump_indent(aTHX_ level, file, " NAME = \"%s\"\n", GvNAME(sv));
1711 Perl_dump_indent(aTHX_ level, file, " NAMELEN = %"IVdf"\n", (IV)GvNAMELEN(sv));
1712 do_hv_dump (level, file, " GvSTASH", GvSTASH(sv));
1713 Perl_dump_indent(aTHX_ level, file, " GP = 0x%"UVxf"\n", PTR2UV(GvGP(sv)));
1716 Perl_dump_indent(aTHX_ level, file, " SV = 0x%"UVxf"\n", PTR2UV(GvSV(sv)));
1717 Perl_dump_indent(aTHX_ level, file, " REFCNT = %"IVdf"\n", (IV)GvREFCNT(sv));
1718 Perl_dump_indent(aTHX_ level, file, " IO = 0x%"UVxf"\n", PTR2UV(GvIOp(sv)));
1719 Perl_dump_indent(aTHX_ level, file, " FORM = 0x%"UVxf" \n", PTR2UV(GvFORM(sv)));
1720 Perl_dump_indent(aTHX_ level, file, " AV = 0x%"UVxf"\n", PTR2UV(GvAV(sv)));
1721 Perl_dump_indent(aTHX_ level, file, " HV = 0x%"UVxf"\n", PTR2UV(GvHV(sv)));
1722 Perl_dump_indent(aTHX_ level, file, " CV = 0x%"UVxf"\n", PTR2UV(GvCV(sv)));
1723 Perl_dump_indent(aTHX_ level, file, " CVGEN = 0x%"UVxf"\n", (UV)GvCVGEN(sv));
1724 Perl_dump_indent(aTHX_ level, file, " LINE = %"IVdf"\n", (IV)GvLINE(sv));
1725 Perl_dump_indent(aTHX_ level, file, " FILE = \"%s\"\n", GvFILE(sv));
1726 Perl_dump_indent(aTHX_ level, file, " FLAGS = 0x%"UVxf"\n", (UV)GvFLAGS(sv));
1727 do_gv_dump (level, file, " EGV", GvEGV(sv));
1730 Perl_dump_indent(aTHX_ level, file, " IFP = 0x%"UVxf"\n", PTR2UV(IoIFP(sv)));
1731 Perl_dump_indent(aTHX_ level, file, " OFP = 0x%"UVxf"\n", PTR2UV(IoOFP(sv)));
1732 Perl_dump_indent(aTHX_ level, file, " DIRP = 0x%"UVxf"\n", PTR2UV(IoDIRP(sv)));
1733 Perl_dump_indent(aTHX_ level, file, " LINES = %"IVdf"\n", (IV)IoLINES(sv));
1734 Perl_dump_indent(aTHX_ level, file, " PAGE = %"IVdf"\n", (IV)IoPAGE(sv));
1735 Perl_dump_indent(aTHX_ level, file, " PAGE_LEN = %"IVdf"\n", (IV)IoPAGE_LEN(sv));
1736 Perl_dump_indent(aTHX_ level, file, " LINES_LEFT = %"IVdf"\n", (IV)IoLINES_LEFT(sv));
1738 Perl_dump_indent(aTHX_ level, file, " TOP_NAME = \"%s\"\n", IoTOP_NAME(sv));
1739 if (!IoTOP_GV(sv) || SvTYPE(IoTOP_GV(sv)) == SVt_PVGV)
1740 do_gv_dump (level, file, " TOP_GV", IoTOP_GV(sv));
1742 Perl_dump_indent(aTHX_ level, file, " TOP_GV = 0x%"UVxf"\n",
1743 PTR2UV(IoTOP_GV(sv)));
1744 do_sv_dump (level+1, file, (SV *) IoTOP_GV(sv), nest+1, maxnest,
1747 /* Source filters hide things that are not GVs in these three, so let's
1748 be careful out there. */
1750 Perl_dump_indent(aTHX_ level, file, " FMT_NAME = \"%s\"\n", IoFMT_NAME(sv));
1751 if (!IoFMT_GV(sv) || SvTYPE(IoFMT_GV(sv)) == SVt_PVGV)
1752 do_gv_dump (level, file, " FMT_GV", IoFMT_GV(sv));
1754 Perl_dump_indent(aTHX_ level, file, " FMT_GV = 0x%"UVxf"\n",
1755 PTR2UV(IoFMT_GV(sv)));
1756 do_sv_dump (level+1, file, (SV *) IoFMT_GV(sv), nest+1, maxnest,
1759 if (IoBOTTOM_NAME(sv))
1760 Perl_dump_indent(aTHX_ level, file, " BOTTOM_NAME = \"%s\"\n", IoBOTTOM_NAME(sv));
1761 if (!IoBOTTOM_GV(sv) || SvTYPE(IoBOTTOM_GV(sv)) == SVt_PVGV)
1762 do_gv_dump (level, file, " BOTTOM_GV", IoBOTTOM_GV(sv));
1764 Perl_dump_indent(aTHX_ level, file, " BOTTOM_GV = 0x%"UVxf"\n",
1765 PTR2UV(IoBOTTOM_GV(sv)));
1766 do_sv_dump (level+1, file, (SV *) IoBOTTOM_GV(sv), nest+1, maxnest,
1769 Perl_dump_indent(aTHX_ level, file, " SUBPROCESS = %"IVdf"\n", (IV)IoSUBPROCESS(sv));
1770 if (isPRINT(IoTYPE(sv)))
1771 Perl_dump_indent(aTHX_ level, file, " TYPE = '%c'\n", IoTYPE(sv));
1773 Perl_dump_indent(aTHX_ level, file, " TYPE = '\\%o'\n", IoTYPE(sv));
1774 Perl_dump_indent(aTHX_ level, file, " FLAGS = 0x%"UVxf"\n", (UV)IoFLAGS(sv));
1781 Perl_sv_dump(pTHX_ SV *sv)
1784 do_sv_dump(0, Perl_debug_log, sv, 0, 0, 0, 0);
1788 Perl_runops_debug(pTHX)
1792 if (ckWARN_d(WARN_DEBUGGING))
1793 Perl_warner(aTHX_ packWARN(WARN_DEBUGGING), "NULL OP IN RUN");
1797 DEBUG_l(Perl_deb(aTHX_ "Entering new RUNOPS level\n"));
1801 if (PL_watchaddr && (*PL_watchaddr != PL_watchok))
1802 PerlIO_printf(Perl_debug_log,
1803 "WARNING: %"UVxf" changed from %"UVxf" to %"UVxf"\n",
1804 PTR2UV(PL_watchaddr), PTR2UV(PL_watchok),
1805 PTR2UV(*PL_watchaddr));
1806 if (DEBUG_s_TEST_) {
1807 if (DEBUG_v_TEST_) {
1808 PerlIO_printf(Perl_debug_log, "\n");
1816 if (DEBUG_t_TEST_) debop(PL_op);
1817 if (DEBUG_P_TEST_) debprof(PL_op);
1819 } while ((PL_op = CALL_FPTR(PL_op->op_ppaddr)(aTHX)));
1820 DEBUG_l(Perl_deb(aTHX_ "leaving RUNOPS level\n"));
1827 Perl_debop(pTHX_ const OP *o)
1830 if (CopSTASH_eq(PL_curcop, PL_debstash) && !DEBUG_J_TEST_)
1833 Perl_deb(aTHX_ "%s", OP_NAME(o));
1834 switch (o->op_type) {
1836 PerlIO_printf(Perl_debug_log, "(%s)", SvPEEK(cSVOPo_sv));
1841 SV * const sv = newSV(0);
1843 /* FIXME - it this making unwarranted assumptions about the
1844 UTF-8 cleanliness of the dump file handle? */
1847 gv_fullname3(sv, cGVOPo_gv, NULL);
1848 PerlIO_printf(Perl_debug_log, "(%s)", SvPV_nolen_const(sv));
1852 PerlIO_printf(Perl_debug_log, "(NULL)");
1858 /* print the lexical's name */
1859 CV * const cv = deb_curcv(cxstack_ix);
1862 AV * const padlist = CvPADLIST(cv);
1863 AV * const comppad = (AV*)(*av_fetch(padlist, 0, FALSE));
1864 sv = *av_fetch(comppad, o->op_targ, FALSE);
1868 PerlIO_printf(Perl_debug_log, "(%s)", SvPV_nolen_const(sv));
1870 PerlIO_printf(Perl_debug_log, "[%"UVuf"]", (UV)o->op_targ);
1876 PerlIO_printf(Perl_debug_log, "\n");
1881 S_deb_curcv(pTHX_ I32 ix)
1884 const PERL_CONTEXT * const cx = &cxstack[ix];
1885 if (CxTYPE(cx) == CXt_SUB || CxTYPE(cx) == CXt_FORMAT)
1886 return cx->blk_sub.cv;
1887 else if (CxTYPE(cx) == CXt_EVAL && !CxTRYBLOCK(cx))
1889 else if (ix == 0 && PL_curstackinfo->si_type == PERLSI_MAIN)
1894 return deb_curcv(ix - 1);
1898 Perl_watch(pTHX_ char **addr)
1901 PL_watchaddr = addr;
1903 PerlIO_printf(Perl_debug_log, "WATCHING, %"UVxf" is currently %"UVxf"\n",
1904 PTR2UV(PL_watchaddr), PTR2UV(PL_watchok));
1908 S_debprof(pTHX_ const OP *o)
1911 if (CopSTASH_eq(PL_curcop, PL_debstash) && !DEBUG_J_TEST_)
1913 if (!PL_profiledata)
1914 Newxz(PL_profiledata, MAXO, U32);
1915 ++PL_profiledata[o->op_type];
1919 Perl_debprofdump(pTHX)
1923 if (!PL_profiledata)
1925 for (i = 0; i < MAXO; i++) {
1926 if (PL_profiledata[i])
1927 PerlIO_printf(Perl_debug_log,
1928 "%5lu %s\n", (unsigned long)PL_profiledata[i],
1935 * XML variants of most of the above routines
1940 S_xmldump_attr(pTHX_ I32 level, PerlIO *file, const char* pat, ...)
1943 PerlIO_printf(file, "\n ");
1944 va_start(args, pat);
1945 xmldump_vindent(level, file, pat, &args);
1951 Perl_xmldump_indent(pTHX_ I32 level, PerlIO *file, const char* pat, ...)
1954 va_start(args, pat);
1955 xmldump_vindent(level, file, pat, &args);
1960 Perl_xmldump_vindent(pTHX_ I32 level, PerlIO *file, const char* pat, va_list *args)
1962 PerlIO_printf(file, "%*s", (int)(level*PL_dumpindent), "");
1963 PerlIO_vprintf(file, pat, *args);
1967 Perl_xmldump_all(pTHX)
1969 PerlIO_setlinebuf(PL_xmlfp);
1971 op_xmldump(PL_main_root);
1972 if (PL_xmlfp != (PerlIO*)PerlIO_stdout())
1973 PerlIO_close(PL_xmlfp);
1978 Perl_xmldump_packsubs(pTHX_ const HV *stash)
1983 if (!HvARRAY(stash))
1985 for (i = 0; i <= (I32) HvMAX(stash); i++) {
1986 for (entry = HvARRAY(stash)[i]; entry; entry = HeNEXT(entry)) {
1987 GV *gv = (GV*)HeVAL(entry);
1989 if (SvTYPE(gv) != SVt_PVGV || !GvGP(gv))
1995 if (HeKEY(entry)[HeKLEN(entry)-1] == ':'
1996 && (hv = GvHV(gv)) && hv != PL_defstash)
1997 xmldump_packsubs(hv); /* nested package */
2003 Perl_xmldump_sub(pTHX_ const GV *gv)
2005 SV *sv = sv_newmortal();
2007 gv_fullname3(sv, gv, Nullch);
2008 Perl_xmldump_indent(aTHX_ 0, PL_xmlfp, "\nSUB %s = ", SvPVX(sv));
2009 if (CvXSUB(GvCV(gv)))
2010 Perl_xmldump_indent(aTHX_ 0, PL_xmlfp, "(xsub 0x%"UVxf" %d)\n",
2011 PTR2UV(CvXSUB(GvCV(gv))),
2012 (int)CvXSUBANY(GvCV(gv)).any_i32);
2013 else if (CvROOT(GvCV(gv)))
2014 op_xmldump(CvROOT(GvCV(gv)));
2016 Perl_xmldump_indent(aTHX_ 0, PL_xmlfp, "<undef>\n");
2020 Perl_xmldump_form(pTHX_ const GV *gv)
2022 SV *sv = sv_newmortal();
2024 gv_fullname3(sv, gv, Nullch);
2025 Perl_xmldump_indent(aTHX_ 0, PL_xmlfp, "\nFORMAT %s = ", SvPVX(sv));
2026 if (CvROOT(GvFORM(gv)))
2027 op_xmldump(CvROOT(GvFORM(gv)));
2029 Perl_xmldump_indent(aTHX_ 0, PL_xmlfp, "<undef>\n");
2033 Perl_xmldump_eval(pTHX)
2035 op_xmldump(PL_eval_root);
2039 Perl_sv_catxmlsv(pTHX_ SV *dsv, SV *ssv)
2041 return sv_catxmlpvn(dsv, SvPVX(ssv), SvCUR(ssv), SvUTF8(ssv));
2045 Perl_sv_catxmlpvn(pTHX_ SV *dsv, char* pv, STRLEN len, int utf8)
2053 sv_catpvn(dsv,"",0);
2054 dsvcur = SvCUR(dsv); /* in case we have to restart */
2059 c = utf8_to_uvchr((U8*)pv, &cl);
2061 SvCUR(dsv) = dsvcur;
2126 Perl_sv_catpvf(aTHX_ dsv, "STUPIDXML(#x%X)", c);
2129 Perl_sv_catpvf(aTHX_ dsv, "<");
2132 Perl_sv_catpvf(aTHX_ dsv, ">");
2135 Perl_sv_catpvf(aTHX_ dsv, "&");
2138 Perl_sv_catpvf(aTHX_ dsv, """);
2142 if (c < 32 || c > 127) {
2143 Perl_sv_catpvf(aTHX_ dsv, "&#x%X;", c);
2146 Perl_sv_catpvf(aTHX_ dsv, "%c", c);
2150 if ((c >= 0xD800 && c <= 0xDB7F) ||
2151 (c >= 0xDC00 && c <= 0xDFFF) ||
2152 (c >= 0xFFF0 && c <= 0xFFFF) ||
2154 Perl_sv_catpvf(aTHX_ dsv, "STUPIDXML(#x%X)", c);
2156 Perl_sv_catpvf(aTHX_ dsv, "&#x%X;", c);
2169 Perl_sv_xmlpeek(pTHX_ SV *sv)
2171 SV *t = sv_newmortal();
2176 sv_setpvn(t, "", 0);
2179 sv_catpv(t, "VOID=\"\"");
2182 else if (sv == (SV*)0x55555555 || SvTYPE(sv) == 'U') {
2183 sv_catpv(t, "WILD=\"\"");
2186 else if (sv == &PL_sv_undef || sv == &PL_sv_no || sv == &PL_sv_yes || sv == &PL_sv_placeholder) {
2187 if (sv == &PL_sv_undef) {
2188 sv_catpv(t, "SV_UNDEF=\"1\"");
2189 if (!(SvFLAGS(sv) & (SVf_OK|SVf_OOK|SVs_OBJECT|
2190 SVs_GMG|SVs_SMG|SVs_RMG)) &&
2194 else if (sv == &PL_sv_no) {
2195 sv_catpv(t, "SV_NO=\"1\"");
2196 if (!(SvFLAGS(sv) & (SVf_ROK|SVf_OOK|SVs_OBJECT|
2197 SVs_GMG|SVs_SMG|SVs_RMG)) &&
2198 !(~SvFLAGS(sv) & (SVf_POK|SVf_NOK|SVf_READONLY|
2199 SVp_POK|SVp_NOK)) &&
2204 else if (sv == &PL_sv_yes) {
2205 sv_catpv(t, "SV_YES=\"1\"");
2206 if (!(SvFLAGS(sv) & (SVf_ROK|SVf_OOK|SVs_OBJECT|
2207 SVs_GMG|SVs_SMG|SVs_RMG)) &&
2208 !(~SvFLAGS(sv) & (SVf_POK|SVf_NOK|SVf_READONLY|
2209 SVp_POK|SVp_NOK)) &&
2211 SvPVX(sv) && *SvPVX(sv) == '1' &&
2216 sv_catpv(t, "SV_PLACEHOLDER=\"1\"");
2217 if (!(SvFLAGS(sv) & (SVf_OK|SVf_OOK|SVs_OBJECT|
2218 SVs_GMG|SVs_SMG|SVs_RMG)) &&
2222 sv_catpv(t, " XXX=\"\" ");
2224 else if (SvREFCNT(sv) == 0) {
2225 sv_catpv(t, " refcnt=\"0\"");
2228 else if (DEBUG_R_TEST_) {
2231 /* is this SV on the tmps stack? */
2232 for (ix=PL_tmps_ix; ix>=0; ix--) {
2233 if (PL_tmps_stack[ix] == sv) {
2238 if (SvREFCNT(sv) > 1)
2239 Perl_sv_catpvf(aTHX_ t, " DRT=\"<%"UVuf"%s>\"", (UV)SvREFCNT(sv),
2242 sv_catpv(t, " DRT=\"<T>\"");
2246 sv_catpv(t, " ROK=\"\"");
2248 switch (SvTYPE(sv)) {
2250 sv_catpv(t, " FREED=\"1\"");
2254 sv_catpv(t, " UNDEF=\"1\"");
2257 sv_catpv(t, " IV=\"");
2260 sv_catpv(t, " NV=\"");
2263 sv_catpv(t, " RV=\"");
2266 sv_catpv(t, " PV=\"");
2269 sv_catpv(t, " PVIV=\"");
2272 sv_catpv(t, " PVNV=\"");
2275 sv_catpv(t, " PVMG=\"");
2278 sv_catpv(t, " PVLV=\"");
2281 sv_catpv(t, " AV=\"");
2284 sv_catpv(t, " HV=\"");
2288 Perl_sv_catpvf(aTHX_ t, " CV=\"(%s)\"", GvNAME(CvGV(sv)));
2290 sv_catpv(t, " CV=\"()\"");
2293 sv_catpv(t, " GV=\"");
2296 sv_catpv(t, " BM=\"");
2299 sv_catpv(t, " FM=\"");
2302 sv_catpv(t, " IO=\"");
2311 else if (SvNOKp(sv)) {
2312 STORE_NUMERIC_LOCAL_SET_STANDARD();
2313 Perl_sv_catpvf(aTHX_ t, "%"NVgf"",SvNVX(sv));
2314 RESTORE_NUMERIC_LOCAL();
2316 else if (SvIOKp(sv)) {
2318 Perl_sv_catpvf(aTHX_ t, "%"UVuf"", (UV)SvUVX(sv));
2320 Perl_sv_catpvf(aTHX_ t, "%"IVdf"", (IV)SvIVX(sv));
2331 return SvPV(t, n_a);
2335 Perl_do_pmop_xmldump(pTHX_ I32 level, PerlIO *file, const PMOP *pm)
2338 Perl_xmldump_indent(aTHX_ level, file, "<pmop/>\n");
2341 Perl_xmldump_indent(aTHX_ level, file, "<pmop \n");
2344 char *s = PM_GETRE(pm)->precomp;
2345 SV *tmpsv = newSV(0);
2347 sv_catxmlpvn(tmpsv, s, strlen(s), 1);
2348 Perl_xmldump_indent(aTHX_ level, file, "pre=\"%s\"\n",
2350 SvREFCNT_dec(tmpsv);
2351 Perl_xmldump_indent(aTHX_ level, file, "when=\"%s\"\n",
2352 (pm->op_private & OPpRUNTIME) ? "RUN" : "COMP");
2355 Perl_xmldump_indent(aTHX_ level, file, "pre=\"\" when=\"RUN\"\n");
2356 if (pm->op_pmflags || (PM_GETRE(pm) && PM_GETRE(pm)->check_substr)) {
2357 SV * const tmpsv = pm_description(pm);
2358 Perl_xmldump_indent(aTHX_ level, file, "pmflags=\"%s\"\n", SvCUR(tmpsv) ? SvPVX(tmpsv) + 1 : "");
2359 SvREFCNT_dec(tmpsv);
2363 if (pm->op_type != OP_PUSHRE && pm->op_pmreplroot) {
2364 Perl_xmldump_indent(aTHX_ level, file, ">\n");
2365 Perl_xmldump_indent(aTHX_ level+1, file, "<pm_repl>\n");
2366 do_op_xmldump(level+2, file, pm->op_pmreplroot);
2367 Perl_xmldump_indent(aTHX_ level+1, file, "</pm_repl>\n");
2368 Perl_xmldump_indent(aTHX_ level, file, "</pmop>\n");
2371 Perl_xmldump_indent(aTHX_ level, file, "/>\n");
2375 Perl_pmop_xmldump(pTHX_ const PMOP *pm)
2377 do_pmop_xmldump(0, PL_xmlfp, pm);
2381 Perl_do_op_xmldump(pTHX_ I32 level, PerlIO *file, const OP *o)
2388 seq = sequence_num(o);
2389 Perl_xmldump_indent(aTHX_ level, file,
2390 "<op_%s seq=\"%"UVuf" -> ",
2395 PerlIO_printf(file, seq ? "%"UVuf"\"" : "(%"UVuf")\"",
2396 sequence_num(o->op_next));
2398 PerlIO_printf(file, "DONE\"");
2401 if (o->op_type == OP_NULL)
2403 PerlIO_printf(file, " was=\"%s\"", PL_op_name[o->op_targ]);
2404 if (o->op_targ == OP_NEXTSTATE)
2407 PerlIO_printf(file, " line=\"%"UVf"\"",
2408 (UV)CopLINE(cCOPo));
2409 if (CopSTASHPV(cCOPo))
2410 PerlIO_printf(file, " package=\"%s\"",
2412 if (cCOPo->cop_label)
2413 PerlIO_printf(file, " label=\"%s\"",
2418 PerlIO_printf(file, " targ=\"%ld\"", (long)o->op_targ);
2421 PerlIO_printf(file, " addr=\"0x%"UVxf" => 0x%"UVxf"\"", (UV)o, (UV)o->op_next);
2424 SV *tmpsv = newSVpvn("", 0);
2425 switch (o->op_flags & OPf_WANT) {
2427 sv_catpv(tmpsv, ",VOID");
2429 case OPf_WANT_SCALAR:
2430 sv_catpv(tmpsv, ",SCALAR");
2433 sv_catpv(tmpsv, ",LIST");
2436 sv_catpv(tmpsv, ",UNKNOWN");
2439 if (o->op_flags & OPf_KIDS)
2440 sv_catpv(tmpsv, ",KIDS");
2441 if (o->op_flags & OPf_PARENS)
2442 sv_catpv(tmpsv, ",PARENS");
2443 if (o->op_flags & OPf_STACKED)
2444 sv_catpv(tmpsv, ",STACKED");
2445 if (o->op_flags & OPf_REF)
2446 sv_catpv(tmpsv, ",REF");
2447 if (o->op_flags & OPf_MOD)
2448 sv_catpv(tmpsv, ",MOD");
2449 if (o->op_flags & OPf_SPECIAL)
2450 sv_catpv(tmpsv, ",SPECIAL");
2451 PerlIO_printf(file, " flags=\"%s\"", SvCUR(tmpsv) ? SvPVX(tmpsv) + 1 : "");
2452 SvREFCNT_dec(tmpsv);
2454 if (o->op_private) {
2455 SV *tmpsv = newSVpvn("", 0);
2456 if (PL_opargs[o->op_type] & OA_TARGLEX) {
2457 if (o->op_private & OPpTARGET_MY)
2458 sv_catpv(tmpsv, ",TARGET_MY");
2460 else if (o->op_type == OP_LEAVESUB ||
2461 o->op_type == OP_LEAVE ||
2462 o->op_type == OP_LEAVESUBLV ||
2463 o->op_type == OP_LEAVEWRITE) {
2464 if (o->op_private & OPpREFCOUNTED)
2465 sv_catpv(tmpsv, ",REFCOUNTED");
2467 else if (o->op_type == OP_AASSIGN) {
2468 if (o->op_private & OPpASSIGN_COMMON)
2469 sv_catpv(tmpsv, ",COMMON");
2471 else if (o->op_type == OP_SASSIGN) {
2472 if (o->op_private & OPpASSIGN_BACKWARDS)
2473 sv_catpv(tmpsv, ",BACKWARDS");
2475 else if (o->op_type == OP_TRANS) {
2476 if (o->op_private & OPpTRANS_SQUASH)
2477 sv_catpv(tmpsv, ",SQUASH");
2478 if (o->op_private & OPpTRANS_DELETE)
2479 sv_catpv(tmpsv, ",DELETE");
2480 if (o->op_private & OPpTRANS_COMPLEMENT)
2481 sv_catpv(tmpsv, ",COMPLEMENT");
2482 if (o->op_private & OPpTRANS_IDENTICAL)
2483 sv_catpv(tmpsv, ",IDENTICAL");
2484 if (o->op_private & OPpTRANS_GROWS)
2485 sv_catpv(tmpsv, ",GROWS");
2487 else if (o->op_type == OP_REPEAT) {
2488 if (o->op_private & OPpREPEAT_DOLIST)
2489 sv_catpv(tmpsv, ",DOLIST");
2491 else if (o->op_type == OP_ENTERSUB ||
2492 o->op_type == OP_RV2SV ||
2493 o->op_type == OP_GVSV ||
2494 o->op_type == OP_RV2AV ||
2495 o->op_type == OP_RV2HV ||
2496 o->op_type == OP_RV2GV ||
2497 o->op_type == OP_AELEM ||
2498 o->op_type == OP_HELEM )
2500 if (o->op_type == OP_ENTERSUB) {
2501 if (o->op_private & OPpENTERSUB_AMPER)
2502 sv_catpv(tmpsv, ",AMPER");
2503 if (o->op_private & OPpENTERSUB_DB)
2504 sv_catpv(tmpsv, ",DB");
2505 if (o->op_private & OPpENTERSUB_HASTARG)
2506 sv_catpv(tmpsv, ",HASTARG");
2507 if (o->op_private & OPpENTERSUB_NOPAREN)
2508 sv_catpv(tmpsv, ",NOPAREN");
2509 if (o->op_private & OPpENTERSUB_INARGS)
2510 sv_catpv(tmpsv, ",INARGS");
2511 if (o->op_private & OPpENTERSUB_NOMOD)
2512 sv_catpv(tmpsv, ",NOMOD");
2515 switch (o->op_private & OPpDEREF) {
2517 sv_catpv(tmpsv, ",SV");
2520 sv_catpv(tmpsv, ",AV");
2523 sv_catpv(tmpsv, ",HV");
2526 if (o->op_private & OPpMAYBE_LVSUB)
2527 sv_catpv(tmpsv, ",MAYBE_LVSUB");
2529 if (o->op_type == OP_AELEM || o->op_type == OP_HELEM) {
2530 if (o->op_private & OPpLVAL_DEFER)
2531 sv_catpv(tmpsv, ",LVAL_DEFER");
2534 if (o->op_private & HINT_STRICT_REFS)
2535 sv_catpv(tmpsv, ",STRICT_REFS");
2536 if (o->op_private & OPpOUR_INTRO)
2537 sv_catpv(tmpsv, ",OUR_INTRO");
2540 else if (o->op_type == OP_CONST) {
2541 if (o->op_private & OPpCONST_BARE)
2542 sv_catpv(tmpsv, ",BARE");
2543 if (o->op_private & OPpCONST_STRICT)
2544 sv_catpv(tmpsv, ",STRICT");
2545 if (o->op_private & OPpCONST_ARYBASE)
2546 sv_catpv(tmpsv, ",ARYBASE");
2547 if (o->op_private & OPpCONST_WARNING)
2548 sv_catpv(tmpsv, ",WARNING");
2549 if (o->op_private & OPpCONST_ENTERED)
2550 sv_catpv(tmpsv, ",ENTERED");
2552 else if (o->op_type == OP_FLIP) {
2553 if (o->op_private & OPpFLIP_LINENUM)
2554 sv_catpv(tmpsv, ",LINENUM");
2556 else if (o->op_type == OP_FLOP) {
2557 if (o->op_private & OPpFLIP_LINENUM)
2558 sv_catpv(tmpsv, ",LINENUM");
2560 else if (o->op_type == OP_RV2CV) {
2561 if (o->op_private & OPpLVAL_INTRO)
2562 sv_catpv(tmpsv, ",INTRO");
2564 else if (o->op_type == OP_GV) {
2565 if (o->op_private & OPpEARLY_CV)
2566 sv_catpv(tmpsv, ",EARLY_CV");
2568 else if (o->op_type == OP_LIST) {
2569 if (o->op_private & OPpLIST_GUESSED)
2570 sv_catpv(tmpsv, ",GUESSED");
2572 else if (o->op_type == OP_DELETE) {
2573 if (o->op_private & OPpSLICE)
2574 sv_catpv(tmpsv, ",SLICE");
2576 else if (o->op_type == OP_EXISTS) {
2577 if (o->op_private & OPpEXISTS_SUB)
2578 sv_catpv(tmpsv, ",EXISTS_SUB");
2580 else if (o->op_type == OP_SORT) {
2581 if (o->op_private & OPpSORT_NUMERIC)
2582 sv_catpv(tmpsv, ",NUMERIC");
2583 if (o->op_private & OPpSORT_INTEGER)
2584 sv_catpv(tmpsv, ",INTEGER");
2585 if (o->op_private & OPpSORT_REVERSE)
2586 sv_catpv(tmpsv, ",REVERSE");
2588 else if (o->op_type == OP_THREADSV) {
2589 if (o->op_private & OPpDONE_SVREF)
2590 sv_catpv(tmpsv, ",SVREF");
2592 else if (o->op_type == OP_OPEN || o->op_type == OP_BACKTICK) {
2593 if (o->op_private & OPpOPEN_IN_RAW)
2594 sv_catpv(tmpsv, ",IN_RAW");
2595 if (o->op_private & OPpOPEN_IN_CRLF)
2596 sv_catpv(tmpsv, ",IN_CRLF");
2597 if (o->op_private & OPpOPEN_OUT_RAW)
2598 sv_catpv(tmpsv, ",OUT_RAW");
2599 if (o->op_private & OPpOPEN_OUT_CRLF)
2600 sv_catpv(tmpsv, ",OUT_CRLF");
2602 else if (o->op_type == OP_EXIT) {
2603 if (o->op_private & OPpEXIT_VMSISH)
2604 sv_catpv(tmpsv, ",EXIT_VMSISH");
2605 if (o->op_private & OPpHUSH_VMSISH)
2606 sv_catpv(tmpsv, ",HUSH_VMSISH");
2608 else if (o->op_type == OP_DIE) {
2609 if (o->op_private & OPpHUSH_VMSISH)
2610 sv_catpv(tmpsv, ",HUSH_VMSISH");
2612 else if (PL_check[o->op_type] != MEMBER_TO_FPTR(Perl_ck_ftst)) {
2613 if (OP_IS_FILETEST_ACCESS(o) && o->op_private & OPpFT_ACCESS)
2614 sv_catpv(tmpsv, ",FT_ACCESS");
2615 if (o->op_private & OPpFT_STACKED)
2616 sv_catpv(tmpsv, ",FT_STACKED");
2618 if (o->op_flags & OPf_MOD && o->op_private & OPpLVAL_INTRO)
2619 sv_catpv(tmpsv, ",INTRO");
2621 S_xmldump_attr(aTHX_ level, file, "private=\"%s\"", SvPVX(tmpsv) + 1);
2622 SvREFCNT_dec(tmpsv);
2625 switch (o->op_type) {
2627 if (o->op_flags & OPf_SPECIAL) {
2633 S_xmldump_attr(aTHX_ level, file, "padix=\"%" IVdf "\"", (IV)cPADOPo->op_padix);
2635 if (cSVOPo->op_sv) {
2636 SV *tmpsv1 = newSV(0);
2637 SV *tmpsv2 = newSV(0);
2645 gv_fullname3(tmpsv1, (GV*)cSVOPo->op_sv, Nullch);
2646 s = SvPV(tmpsv1,len);
2647 sv_catxmlpvn(tmpsv2, s, len, 1);
2648 S_xmldump_attr(aTHX_ level, file, "gv=\"%s\"", SvPV(tmpsv2, len));
2652 S_xmldump_attr(aTHX_ level, file, "gv=\"NULL\"");
2656 case OP_METHOD_NAMED:
2657 #ifndef USE_ITHREADS
2658 /* with ITHREADS, consts are stored in the pad, and the right pad
2659 * may not be active here, so skip */
2660 S_xmldump_attr(aTHX_ level, file, "%s", sv_xmlpeek(cSVOPo_sv));
2666 PerlIO_printf(file, ">\n");
2668 do_op_xmldump(level+1, file, CvROOT(cSVOPo_sv));
2674 S_xmldump_attr(aTHX_ level, file, "line=\"%"UVf"\"",
2675 (UV)CopLINE(cCOPo));
2676 if (CopSTASHPV(cCOPo))
2677 S_xmldump_attr(aTHX_ level, file, "package=\"%s\"",
2679 if (cCOPo->cop_label)
2680 S_xmldump_attr(aTHX_ level, file, "label=\"%s\"",
2684 S_xmldump_attr(aTHX_ level, file, "redo=\"");
2685 if (cLOOPo->op_redoop)
2686 PerlIO_printf(file, "%"UVuf"\"", sequence_num(cLOOPo->op_redoop));
2688 PerlIO_printf(file, "DONE\"");
2689 S_xmldump_attr(aTHX_ level, file, "next=\"");
2690 if (cLOOPo->op_nextop)
2691 PerlIO_printf(file, "%"UVuf"\"", sequence_num(cLOOPo->op_nextop));
2693 PerlIO_printf(file, "DONE\"");
2694 S_xmldump_attr(aTHX_ level, file, "last=\"");
2695 if (cLOOPo->op_lastop)
2696 PerlIO_printf(file, "%"UVuf"\"", sequence_num(cLOOPo->op_lastop));
2698 PerlIO_printf(file, "DONE\"");
2706 S_xmldump_attr(aTHX_ level, file, "other=\"");
2707 if (cLOGOPo->op_other)
2708 PerlIO_printf(file, "%"UVuf"\"", sequence_num(cLOGOPo->op_other));
2710 PerlIO_printf(file, "DONE\"");
2718 if (o->op_private & OPpREFCOUNTED)
2719 S_xmldump_attr(aTHX_ level, file, "refcnt=\"%"UVuf"\"", (UV)o->op_targ);
2725 if (PL_madskills && o->op_madprop) {
2726 SV *tmpsv = newSVpvn("", 0);
2727 MADPROP* mp = o->op_madprop;
2728 sv_utf8_upgrade(tmpsv);
2731 PerlIO_printf(file, ">\n");
2733 Perl_xmldump_indent(aTHX_ level, file, "<madprops>\n");
2736 char tmp = mp->mad_key;
2737 sv_setpvn(tmpsv,"\"",1);
2739 sv_catxmlpvn(tmpsv, &tmp, 1, 0);
2740 sv_catpv(tmpsv, "\"");
2741 switch (mp->mad_type) {
2743 sv_catpv(tmpsv, "NULL");
2744 Perl_xmldump_indent(aTHX_ level, file, "<mad_null key=%s/>\n", SvPVX(tmpsv));
2747 sv_catpv(tmpsv, " val=\"");
2748 sv_catxmlpvn(tmpsv, (char*)mp->mad_val, mp->mad_vlen,1);
2749 sv_catpv(tmpsv, "\"");
2750 Perl_xmldump_indent(aTHX_ level, file, "<mad_pv key=%s/>\n", SvPVX(tmpsv));
2753 sv_catpv(tmpsv, " val=\"");
2754 sv_catxmlsv(tmpsv, (SV*)mp->mad_val);
2755 sv_catpv(tmpsv, "\"");
2756 Perl_xmldump_indent(aTHX_ level, file, "<mad_sv key=%s/>\n", SvPVX(tmpsv));
2759 if ((OP*)mp->mad_val) {
2760 Perl_xmldump_indent(aTHX_ level, file, "<mad_op key=%s>\n", SvPVX(tmpsv));
2761 do_op_xmldump(level+1, file, (OP*)mp->mad_val);
2762 Perl_xmldump_indent(aTHX_ level, file, "</mad_op>\n");
2766 Perl_xmldump_indent(aTHX_ level, file, "<mad_unk key=%s/>\n", SvPVX(tmpsv));
2772 Perl_xmldump_indent(aTHX_ level, file, "</madprops>\n");
2774 SvREFCNT_dec(tmpsv);
2777 switch (o->op_type) {
2784 PerlIO_printf(file, ">\n");
2786 do_pmop_xmldump(level, file, cPMOPo);
2792 if (o->op_flags & OPf_KIDS) {
2796 PerlIO_printf(file, ">\n");
2798 for (kid = cUNOPo->op_first; kid; kid = kid->op_sibling)
2799 do_op_xmldump(level, file, kid);
2803 Perl_xmldump_indent(aTHX_ level-1, file, "</op_%s>\n", OP_NAME(o));
2805 PerlIO_printf(file, " />\n");
2809 Perl_op_xmldump(pTHX_ const OP *o)
2811 do_op_xmldump(0, PL_xmlfp, o);
2817 * c-indentation-style: bsd
2819 * indent-tabs-mode: t
2822 * ex: set ts=8 sts=4 sw=4 noet: