Unicode properties: fix L& (the #12319 didn't allow L&,
[p5sagit/p5-mst-13.2.git] / dump.c
CommitLineData
a0d0e21e 1/* dump.c
a687059c 2 *
bc89e66f 3 * Copyright (c) 1991-2001, Larry Wall
a687059c 4 *
6e21c824 5 * You may distribute under the terms of either the GNU General Public
6 * License or the Artistic License, as specified in the README file.
8d063cd8 7 *
a0d0e21e 8 */
9
10/*
11 * "'You have talked long in your sleep, Frodo,' said Gandalf gently, 'and
12 * it has not been hard for me to read your mind and memory.'"
8d063cd8 13 */
14
8d063cd8 15#include "EXTERN.h"
864dbfa3 16#define PERL_IN_DUMP_C
8d063cd8 17#include "perl.h"
f722798b 18#include "regcomp.h"
8d063cd8 19
3967c732 20void
864dbfa3 21Perl_dump_indent(pTHX_ I32 level, PerlIO *file, const char* pat, ...)
3967c732 22{
3967c732 23 va_list args;
3967c732 24 va_start(args, pat);
c5be433b 25 dump_vindent(level, file, pat, &args);
3967c732 26 va_end(args);
27}
8adcabd8 28
29void
c5be433b 30Perl_dump_vindent(pTHX_ I32 level, PerlIO *file, const char* pat, va_list *args)
31{
c8db6e60 32 PerlIO_printf(file, "%*s", (int)(level*PL_dumpindent), "");
c5be433b 33 PerlIO_vprintf(file, pat, *args);
34}
35
36void
864dbfa3 37Perl_dump_all(pTHX)
79072805 38{
760ac839 39 PerlIO_setlinebuf(Perl_debug_log);
3280af22 40 if (PL_main_root)
3967c732 41 op_dump(PL_main_root);
3280af22 42 dump_packsubs(PL_defstash);
463ee0b2 43}
44
45void
864dbfa3 46Perl_dump_packsubs(pTHX_ HV *stash)
463ee0b2 47{
a0d0e21e 48 I32 i;
463ee0b2 49 HE *entry;
50
8990e307 51 if (!HvARRAY(stash))
52 return;
a0d0e21e 53 for (i = 0; i <= (I32) HvMAX(stash); i++) {
4db58590 54 for (entry = HvARRAY(stash)[i]; entry; entry = HeNEXT(entry)) {
55 GV *gv = (GV*)HeVAL(entry);
463ee0b2 56 HV *hv;
e29cdcb3 57 if (SvTYPE(gv) != SVt_PVGV || !GvGP(gv))
58 continue;
8ebc5c01 59 if (GvCVu(gv))
463ee0b2 60 dump_sub(gv);
85e6fe83 61 if (GvFORM(gv))
62 dump_form(gv);
6676db26 63 if (HeKEY(entry)[HeKLEN(entry)-1] == ':'
64 && (hv = GvHV(gv)) && hv != PL_defstash)
463ee0b2 65 dump_packsubs(hv); /* nested package */
66 }
79072805 67 }
68}
69
70void
864dbfa3 71Perl_dump_sub(pTHX_ GV *gv)
a687059c 72{
8990e307 73 SV *sv = sv_newmortal();
85e6fe83 74
f6aff53a 75 gv_fullname3(sv, gv, Nullch);
cea2e8a9 76 Perl_dump_indent(aTHX_ 0, Perl_debug_log, "\nSUB %s = ", SvPVX(sv));
a0d0e21e 77 if (CvXSUB(GvCV(gv)))
894356b3 78 Perl_dump_indent(aTHX_ 0, Perl_debug_log, "(xsub 0x%lx %d)\n",
a0d0e21e 79 (long)CvXSUB(GvCV(gv)),
894356b3 80 (int)CvXSUBANY(GvCV(gv)).any_i32);
85e6fe83 81 else if (CvROOT(GvCV(gv)))
3967c732 82 op_dump(CvROOT(GvCV(gv)));
85e6fe83 83 else
cea2e8a9 84 Perl_dump_indent(aTHX_ 0, Perl_debug_log, "<undef>\n");
85e6fe83 85}
86
87void
864dbfa3 88Perl_dump_form(pTHX_ GV *gv)
85e6fe83 89{
90 SV *sv = sv_newmortal();
91
f6aff53a 92 gv_fullname3(sv, gv, Nullch);
cea2e8a9 93 Perl_dump_indent(aTHX_ 0, Perl_debug_log, "\nFORMAT %s = ", SvPVX(sv));
85e6fe83 94 if (CvROOT(GvFORM(gv)))
3967c732 95 op_dump(CvROOT(GvFORM(gv)));
85e6fe83 96 else
cea2e8a9 97 Perl_dump_indent(aTHX_ 0, Perl_debug_log, "<undef>\n");
a687059c 98}
99
8adcabd8 100void
864dbfa3 101Perl_dump_eval(pTHX)
8d063cd8 102{
3967c732 103 op_dump(PL_eval_root);
104}
105
106char *
e6abe6d8 107Perl_pv_display(pTHX_ SV *dsv, char *pv, STRLEN cur, STRLEN len, STRLEN pvlim)
3967c732 108{
109 int truncated = 0;
110 int nul_terminated = len > cur && pv[cur] == '\0';
111
e6abe6d8 112 sv_setpvn(dsv, "\"", 1);
3967c732 113 for (; cur--; pv++) {
e6abe6d8 114 if (pvlim && SvCUR(dsv) >= pvlim) {
3967c732 115 truncated++;
116 break;
117 }
118 if (isPRINT(*pv)) {
119 switch (*pv) {
e6abe6d8 120 case '\t': sv_catpvn(dsv, "\\t", 2); break;
121 case '\n': sv_catpvn(dsv, "\\n", 2); break;
122 case '\r': sv_catpvn(dsv, "\\r", 2); break;
123 case '\f': sv_catpvn(dsv, "\\f", 2); break;
124 case '"': sv_catpvn(dsv, "\\\"", 2); break;
125 case '\\': sv_catpvn(dsv, "\\\\", 2); break;
126 default: sv_catpvn(dsv, pv, 1); break;
3967c732 127 }
128 }
129 else {
130 if (cur && isDIGIT(*(pv+1)))
e6abe6d8 131 Perl_sv_catpvf(aTHX_ dsv, "\\%03o", (U8)*pv);
3967c732 132 else
e6abe6d8 133 Perl_sv_catpvf(aTHX_ dsv, "\\%o", (U8)*pv);
3967c732 134 }
135 }
e6abe6d8 136 sv_catpvn(dsv, "\"", 1);
3967c732 137 if (truncated)
e6abe6d8 138 sv_catpvn(dsv, "...", 3);
3967c732 139 if (nul_terminated)
e6abe6d8 140 sv_catpvn(dsv, "\\0", 2);
3967c732 141
e6abe6d8 142 return SvPVX(dsv);
143}
144
145char *
146Perl_sv_uni_display(pTHX_ SV *dsv, SV *ssv, STRLEN pvlim)
147{
148 int truncated = 0;
149 char *s, *e;
150
151 sv_setpvn(dsv, "\"", 1);
152 for (s = SvPVX(ssv), e = s + SvCUR(ssv); s < e; s += UTF8SKIP(s)) {
153 UV u;
154 if (pvlim && SvCUR(dsv) >= pvlim) {
155 truncated++;
156 break;
157 }
158 u = utf8_to_uvchr((U8*)s, 0);
159 Perl_sv_catpvf(aTHX_ dsv, "\\x{%x}", u);
160 }
161 sv_catpvn(dsv, "\"", 1);
162 if (truncated)
163 sv_catpvn(dsv, "...", 3);
164
165 return SvPVX(dsv);
3967c732 166}
167
168char *
864dbfa3 169Perl_sv_peek(pTHX_ SV *sv)
3967c732 170{
171 SV *t = sv_newmortal();
2d8e6c8d 172 STRLEN n_a;
3967c732 173 int unref = 0;
174
175 sv_setpvn(t, "", 0);
176 retry:
177 if (!sv) {
178 sv_catpv(t, "VOID");
179 goto finish;
180 }
181 else if (sv == (SV*)0x55555555 || SvTYPE(sv) == 'U') {
182 sv_catpv(t, "WILD");
183 goto finish;
184 }
185 else if (sv == &PL_sv_undef || sv == &PL_sv_no || sv == &PL_sv_yes) {
186 if (sv == &PL_sv_undef) {
187 sv_catpv(t, "SV_UNDEF");
188 if (!(SvFLAGS(sv) & (SVf_OK|SVf_OOK|SVs_OBJECT|
189 SVs_GMG|SVs_SMG|SVs_RMG)) &&
190 SvREADONLY(sv))
191 goto finish;
192 }
193 else if (sv == &PL_sv_no) {
194 sv_catpv(t, "SV_NO");
195 if (!(SvFLAGS(sv) & (SVf_ROK|SVf_OOK|SVs_OBJECT|
196 SVs_GMG|SVs_SMG|SVs_RMG)) &&
197 !(~SvFLAGS(sv) & (SVf_POK|SVf_NOK|SVf_READONLY|
198 SVp_POK|SVp_NOK)) &&
199 SvCUR(sv) == 0 &&
200 SvNVX(sv) == 0.0)
201 goto finish;
202 }
203 else {
204 sv_catpv(t, "SV_YES");
205 if (!(SvFLAGS(sv) & (SVf_ROK|SVf_OOK|SVs_OBJECT|
206 SVs_GMG|SVs_SMG|SVs_RMG)) &&
207 !(~SvFLAGS(sv) & (SVf_POK|SVf_NOK|SVf_READONLY|
208 SVp_POK|SVp_NOK)) &&
209 SvCUR(sv) == 1 &&
210 SvPVX(sv) && *SvPVX(sv) == '1' &&
211 SvNVX(sv) == 1.0)
212 goto finish;
213 }
214 sv_catpv(t, ":");
215 }
216 else if (SvREFCNT(sv) == 0) {
217 sv_catpv(t, "(");
218 unref++;
219 }
04932ac8 220 else if (DEBUG_R_TEST && SvREFCNT(sv) > 1) {
29b291f7 221 Perl_sv_catpvf(aTHX_ t, "<%"UVuf">", (UV)SvREFCNT(sv));
04932ac8 222 }
223
224
3967c732 225 if (SvROK(sv)) {
226 sv_catpv(t, "\\");
227 if (SvCUR(t) + unref > 10) {
228 SvCUR(t) = unref + 3;
229 *SvEND(t) = '\0';
230 sv_catpv(t, "...");
231 goto finish;
232 }
233 sv = (SV*)SvRV(sv);
234 goto retry;
235 }
236 switch (SvTYPE(sv)) {
237 default:
238 sv_catpv(t, "FREED");
239 goto finish;
240
241 case SVt_NULL:
242 sv_catpv(t, "UNDEF");
243 goto finish;
244 case SVt_IV:
245 sv_catpv(t, "IV");
246 break;
247 case SVt_NV:
248 sv_catpv(t, "NV");
249 break;
250 case SVt_RV:
251 sv_catpv(t, "RV");
252 break;
253 case SVt_PV:
254 sv_catpv(t, "PV");
255 break;
256 case SVt_PVIV:
257 sv_catpv(t, "PVIV");
258 break;
259 case SVt_PVNV:
260 sv_catpv(t, "PVNV");
261 break;
262 case SVt_PVMG:
263 sv_catpv(t, "PVMG");
264 break;
265 case SVt_PVLV:
266 sv_catpv(t, "PVLV");
267 break;
268 case SVt_PVAV:
269 sv_catpv(t, "AV");
270 break;
271 case SVt_PVHV:
272 sv_catpv(t, "HV");
273 break;
274 case SVt_PVCV:
275 if (CvGV(sv))
cea2e8a9 276 Perl_sv_catpvf(aTHX_ t, "CV(%s)", GvNAME(CvGV(sv)));
3967c732 277 else
278 sv_catpv(t, "CV()");
279 goto finish;
280 case SVt_PVGV:
281 sv_catpv(t, "GV");
282 break;
283 case SVt_PVBM:
284 sv_catpv(t, "BM");
285 break;
286 case SVt_PVFM:
287 sv_catpv(t, "FM");
288 break;
289 case SVt_PVIO:
290 sv_catpv(t, "IO");
291 break;
292 }
293
294 if (SvPOKp(sv)) {
295 if (!SvPVX(sv))
296 sv_catpv(t, "(null)");
297 else {
79cb57f6 298 SV *tmp = newSVpvn("", 0);
3967c732 299 sv_catpv(t, "(");
300 if (SvOOK(sv))
cea2e8a9 301 Perl_sv_catpvf(aTHX_ t, "[%s]", pv_display(tmp, SvPVX(sv)-SvIVX(sv), SvIVX(sv), 0, 127));
302 Perl_sv_catpvf(aTHX_ t, "%s)", pv_display(tmp, SvPVX(sv), SvCUR(sv), SvLEN(sv), 127));
32639b87 303 if (SvUTF8(sv))
e6abe6d8 304 Perl_sv_catpvf(aTHX_ t, " [UTF8 %s]",
305 sv_uni_display(tmp, sv, 8 * sv_len_utf8(sv)));
3967c732 306 SvREFCNT_dec(tmp);
307 }
308 }
309 else if (SvNOKp(sv)) {
e54dc35b 310 STORE_NUMERIC_LOCAL_SET_STANDARD();
cea2e8a9 311 Perl_sv_catpvf(aTHX_ t, "(%g)",SvNVX(sv));
e54dc35b 312 RESTORE_NUMERIC_LOCAL();
3967c732 313 }
57def98f 314 else if (SvIOKp(sv)) {
cf2093f6 315 if (SvIsUV(sv))
57def98f 316 Perl_sv_catpvf(aTHX_ t, "(%"UVuf")", (UV)SvUVX(sv));
cf2093f6 317 else
57def98f 318 Perl_sv_catpvf(aTHX_ t, "(%"IVdf")", (IV)SvIVX(sv));
25da4f38 319 }
3967c732 320 else
321 sv_catpv(t, "()");
2ef28da1 322
3967c732 323 finish:
324 if (unref) {
325 while (unref--)
326 sv_catpv(t, ")");
327 }
2d8e6c8d 328 return SvPV(t, n_a);
3967c732 329}
330
331void
864dbfa3 332Perl_do_pmop_dump(pTHX_ I32 level, PerlIO *file, PMOP *pm)
3967c732 333{
334 char ch;
335
336 if (!pm) {
cea2e8a9 337 Perl_dump_indent(aTHX_ level, file, "{}\n");
3967c732 338 return;
339 }
cea2e8a9 340 Perl_dump_indent(aTHX_ level, file, "{\n");
3967c732 341 level++;
342 if (pm->op_pmflags & PMf_ONCE)
343 ch = '?';
344 else
345 ch = '/';
aaa362c4 346 if (PM_GETRE(pm))
cea2e8a9 347 Perl_dump_indent(aTHX_ level, file, "PMf_PRE %c%s%c%s\n",
aaa362c4 348 ch, PM_GETRE(pm)->precomp, ch,
3967c732 349 (pm->op_private & OPpRUNTIME) ? " (RUNTIME)" : "");
350 else
cea2e8a9 351 Perl_dump_indent(aTHX_ level, file, "PMf_PRE (RUNTIME)\n");
3967c732 352 if (pm->op_type != OP_PUSHRE && pm->op_pmreplroot) {
cea2e8a9 353 Perl_dump_indent(aTHX_ level, file, "PMf_REPL = ");
3967c732 354 op_dump(pm->op_pmreplroot);
355 }
aaa362c4 356 if (pm->op_pmflags || (PM_GETRE(pm) && PM_GETRE(pm)->check_substr)) {
79cb57f6 357 SV *tmpsv = newSVpvn("", 0);
3967c732 358 if (pm->op_pmdynflags & PMdf_USED)
359 sv_catpv(tmpsv, ",USED");
360 if (pm->op_pmdynflags & PMdf_TAINTED)
361 sv_catpv(tmpsv, ",TAINTED");
362 if (pm->op_pmflags & PMf_ONCE)
363 sv_catpv(tmpsv, ",ONCE");
aaa362c4 364 if (PM_GETRE(pm) && PM_GETRE(pm)->check_substr
365 && !(PM_GETRE(pm)->reganch & ROPT_NOSCAN))
3967c732 366 sv_catpv(tmpsv, ",SCANFIRST");
aaa362c4 367 if (PM_GETRE(pm) && PM_GETRE(pm)->check_substr
368 && PM_GETRE(pm)->reganch & ROPT_CHECK_ALL)
3967c732 369 sv_catpv(tmpsv, ",ALL");
370 if (pm->op_pmflags & PMf_SKIPWHITE)
371 sv_catpv(tmpsv, ",SKIPWHITE");
372 if (pm->op_pmflags & PMf_CONST)
373 sv_catpv(tmpsv, ",CONST");
374 if (pm->op_pmflags & PMf_KEEP)
375 sv_catpv(tmpsv, ",KEEP");
376 if (pm->op_pmflags & PMf_GLOBAL)
377 sv_catpv(tmpsv, ",GLOBAL");
378 if (pm->op_pmflags & PMf_CONTINUE)
379 sv_catpv(tmpsv, ",CONTINUE");
380 if (pm->op_pmflags & PMf_RETAINT)
381 sv_catpv(tmpsv, ",RETAINT");
382 if (pm->op_pmflags & PMf_EVAL)
383 sv_catpv(tmpsv, ",EVAL");
cea2e8a9 384 Perl_dump_indent(aTHX_ level, file, "PMFLAGS = (%s)\n", SvCUR(tmpsv) ? SvPVX(tmpsv) + 1 : "");
3967c732 385 SvREFCNT_dec(tmpsv);
386 }
387
cea2e8a9 388 Perl_dump_indent(aTHX_ level-1, file, "}\n");
3967c732 389}
390
391void
864dbfa3 392Perl_pmop_dump(pTHX_ PMOP *pm)
3967c732 393{
394 do_pmop_dump(0, Perl_debug_log, pm);
79072805 395}
396
397void
864dbfa3 398Perl_do_op_dump(pTHX_ I32 level, PerlIO *file, OP *o)
79072805 399{
cea2e8a9 400 Perl_dump_indent(aTHX_ level, file, "{\n");
3967c732 401 level++;
11343788 402 if (o->op_seq)
3967c732 403 PerlIO_printf(file, "%-4d", o->op_seq);
93a17b20 404 else
3967c732 405 PerlIO_printf(file, " ");
c8db6e60 406 PerlIO_printf(file,
407 "%*sTYPE = %s ===> ",
53e06cf0 408 (int)(PL_dumpindent*level-4), "", OP_NAME(o));
11343788 409 if (o->op_next) {
410 if (o->op_seq)
3967c732 411 PerlIO_printf(file, "%d\n", o->op_next->op_seq);
93a17b20 412 else
3967c732 413 PerlIO_printf(file, "(%d)\n", o->op_next->op_seq);
93a17b20 414 }
79072805 415 else
3967c732 416 PerlIO_printf(file, "DONE\n");
11343788 417 if (o->op_targ) {
acb36ea4 418 if (o->op_type == OP_NULL)
ae7d165c 419 {
cea2e8a9 420 Perl_dump_indent(aTHX_ level, file, " (was %s)\n", PL_op_name[o->op_targ]);
ae7d165c 421 if (o->op_targ == OP_NEXTSTATE)
422 {
423 if (CopLINE(cCOPo))
424 Perl_dump_indent(aTHX_ level, file, "LINE = %d\n",CopLINE(cCOPo));
425 if (CopSTASHPV(cCOPo))
426 Perl_dump_indent(aTHX_ level, file, "PACKAGE = \"%s\"\n",
427 CopSTASHPV(cCOPo));
428 if (cCOPo->cop_label)
429 Perl_dump_indent(aTHX_ level, file, "LABEL = \"%s\"\n",
430 cCOPo->cop_label);
431 }
432 }
8990e307 433 else
894356b3 434 Perl_dump_indent(aTHX_ level, file, "TARG = %ld\n", (long)o->op_targ);
8990e307 435 }
748a9306 436#ifdef DUMPADDR
57def98f 437 Perl_dump_indent(aTHX_ level, file, "ADDR = 0x%"UVxf" => 0x%"UVxf"\n", (UV)o, (UV)o->op_next);
79072805 438#endif
11343788 439 if (o->op_flags) {
79cb57f6 440 SV *tmpsv = newSVpvn("", 0);
5dc0d613 441 switch (o->op_flags & OPf_WANT) {
54310121 442 case OPf_WANT_VOID:
46fc3d4c 443 sv_catpv(tmpsv, ",VOID");
54310121 444 break;
445 case OPf_WANT_SCALAR:
46fc3d4c 446 sv_catpv(tmpsv, ",SCALAR");
54310121 447 break;
448 case OPf_WANT_LIST:
46fc3d4c 449 sv_catpv(tmpsv, ",LIST");
54310121 450 break;
451 default:
46fc3d4c 452 sv_catpv(tmpsv, ",UNKNOWN");
54310121 453 break;
454 }
11343788 455 if (o->op_flags & OPf_KIDS)
46fc3d4c 456 sv_catpv(tmpsv, ",KIDS");
11343788 457 if (o->op_flags & OPf_PARENS)
46fc3d4c 458 sv_catpv(tmpsv, ",PARENS");
11343788 459 if (o->op_flags & OPf_STACKED)
46fc3d4c 460 sv_catpv(tmpsv, ",STACKED");
11343788 461 if (o->op_flags & OPf_REF)
46fc3d4c 462 sv_catpv(tmpsv, ",REF");
11343788 463 if (o->op_flags & OPf_MOD)
46fc3d4c 464 sv_catpv(tmpsv, ",MOD");
11343788 465 if (o->op_flags & OPf_SPECIAL)
46fc3d4c 466 sv_catpv(tmpsv, ",SPECIAL");
cea2e8a9 467 Perl_dump_indent(aTHX_ level, file, "FLAGS = (%s)\n", SvCUR(tmpsv) ? SvPVX(tmpsv) + 1 : "");
46fc3d4c 468 SvREFCNT_dec(tmpsv);
79072805 469 }
11343788 470 if (o->op_private) {
79cb57f6 471 SV *tmpsv = newSVpvn("", 0);
07447971 472 if (PL_opargs[o->op_type] & OA_TARGLEX) {
473 if (o->op_private & OPpTARGET_MY)
474 sv_catpv(tmpsv, ",TARGET_MY");
475 }
bf91b999 476 else if (o->op_type == OP_LEAVESUB ||
477 o->op_type == OP_LEAVE ||
478 o->op_type == OP_LEAVESUBLV ||
479 o->op_type == OP_LEAVEWRITE) {
480 if (o->op_private & OPpREFCOUNTED)
481 sv_catpv(tmpsv, ",REFCOUNTED");
482 }
483 else if (o->op_type == OP_AASSIGN) {
11343788 484 if (o->op_private & OPpASSIGN_COMMON)
46fc3d4c 485 sv_catpv(tmpsv, ",COMMON");
10c8fecd 486 if (o->op_private & OPpASSIGN_HASH)
487 sv_catpv(tmpsv, ",HASH");
8d063cd8 488 }
11343788 489 else if (o->op_type == OP_SASSIGN) {
490 if (o->op_private & OPpASSIGN_BACKWARDS)
46fc3d4c 491 sv_catpv(tmpsv, ",BACKWARDS");
a0d0e21e 492 }
11343788 493 else if (o->op_type == OP_TRANS) {
494 if (o->op_private & OPpTRANS_SQUASH)
46fc3d4c 495 sv_catpv(tmpsv, ",SQUASH");
11343788 496 if (o->op_private & OPpTRANS_DELETE)
46fc3d4c 497 sv_catpv(tmpsv, ",DELETE");
11343788 498 if (o->op_private & OPpTRANS_COMPLEMENT)
46fc3d4c 499 sv_catpv(tmpsv, ",COMPLEMENT");
bf91b999 500 if (o->op_private & OPpTRANS_IDENTICAL)
501 sv_catpv(tmpsv, ",IDENTICAL");
502 if (o->op_private & OPpTRANS_GROWS)
503 sv_catpv(tmpsv, ",GROWS");
8d063cd8 504 }
11343788 505 else if (o->op_type == OP_REPEAT) {
506 if (o->op_private & OPpREPEAT_DOLIST)
46fc3d4c 507 sv_catpv(tmpsv, ",DOLIST");
8d063cd8 508 }
11343788 509 else if (o->op_type == OP_ENTERSUB ||
510 o->op_type == OP_RV2SV ||
23f1ca44 511 o->op_type == OP_GVSV ||
11343788 512 o->op_type == OP_RV2AV ||
513 o->op_type == OP_RV2HV ||
514 o->op_type == OP_RV2GV ||
515 o->op_type == OP_AELEM ||
516 o->op_type == OP_HELEM )
85e6fe83 517 {
5dc0d613 518 if (o->op_type == OP_ENTERSUB) {
519 if (o->op_private & OPpENTERSUB_AMPER)
46fc3d4c 520 sv_catpv(tmpsv, ",AMPER");
5dc0d613 521 if (o->op_private & OPpENTERSUB_DB)
46fc3d4c 522 sv_catpv(tmpsv, ",DB");
d3011074 523 if (o->op_private & OPpENTERSUB_HASTARG)
524 sv_catpv(tmpsv, ",HASTARG");
bf91b999 525 if (o->op_private & OPpENTERSUB_NOPAREN)
526 sv_catpv(tmpsv, ",NOPAREN");
527 if (o->op_private & OPpENTERSUB_INARGS)
528 sv_catpv(tmpsv, ",INARGS");
68dc0745 529 }
bf91b999 530 else {
d3011074 531 switch (o->op_private & OPpDEREF) {
5f05dabc 532 case OPpDEREF_SV:
46fc3d4c 533 sv_catpv(tmpsv, ",SV");
5f05dabc 534 break;
535 case OPpDEREF_AV:
46fc3d4c 536 sv_catpv(tmpsv, ",AV");
5f05dabc 537 break;
538 case OPpDEREF_HV:
46fc3d4c 539 sv_catpv(tmpsv, ",HV");
5f05dabc 540 break;
541 }
bf91b999 542 if (o->op_private & OPpMAYBE_LVSUB)
543 sv_catpv(tmpsv, ",MAYBE_LVSUB");
544 }
5dc0d613 545 if (o->op_type == OP_AELEM || o->op_type == OP_HELEM) {
546 if (o->op_private & OPpLVAL_DEFER)
46fc3d4c 547 sv_catpv(tmpsv, ",LVAL_DEFER");
68dc0745 548 }
549 else {
5dc0d613 550 if (o->op_private & HINT_STRICT_REFS)
46fc3d4c 551 sv_catpv(tmpsv, ",STRICT_REFS");
192587c2 552 if (o->op_private & OPpOUR_INTRO)
553 sv_catpv(tmpsv, ",OUR_INTRO");
68dc0745 554 }
8d063cd8 555 }
11343788 556 else if (o->op_type == OP_CONST) {
557 if (o->op_private & OPpCONST_BARE)
46fc3d4c 558 sv_catpv(tmpsv, ",BARE");
7a52d87a 559 if (o->op_private & OPpCONST_STRICT)
560 sv_catpv(tmpsv, ",STRICT");
bf91b999 561 if (o->op_private & OPpCONST_ARYBASE)
562 sv_catpv(tmpsv, ",ARYBASE");
563 if (o->op_private & OPpCONST_WARNING)
564 sv_catpv(tmpsv, ",WARNING");
565 if (o->op_private & OPpCONST_ENTERED)
566 sv_catpv(tmpsv, ",ENTERED");
79072805 567 }
11343788 568 else if (o->op_type == OP_FLIP) {
569 if (o->op_private & OPpFLIP_LINENUM)
46fc3d4c 570 sv_catpv(tmpsv, ",LINENUM");
79072805 571 }
11343788 572 else if (o->op_type == OP_FLOP) {
573 if (o->op_private & OPpFLIP_LINENUM)
46fc3d4c 574 sv_catpv(tmpsv, ",LINENUM");
cd06dffe 575 } else if (o->op_type == OP_RV2CV) {
576 if (o->op_private & OPpLVAL_INTRO)
577 sv_catpv(tmpsv, ",INTRO");
79072805 578 }
bf91b999 579 else if (o->op_type == OP_GV) {
580 if (o->op_private & OPpEARLY_CV)
581 sv_catpv(tmpsv, ",EARLY_CV");
582 }
583 else if (o->op_type == OP_LIST) {
584 if (o->op_private & OPpLIST_GUESSED)
585 sv_catpv(tmpsv, ",GUESSED");
586 }
587 else if (o->op_type == OP_DELETE) {
588 if (o->op_private & OPpSLICE)
589 sv_catpv(tmpsv, ",SLICE");
590 }
591 else if (o->op_type == OP_EXISTS) {
592 if (o->op_private & OPpEXISTS_SUB)
593 sv_catpv(tmpsv, ",EXISTS_SUB");
594 }
595 else if (o->op_type == OP_SORT) {
596 if (o->op_private & OPpSORT_NUMERIC)
597 sv_catpv(tmpsv, ",NUMERIC");
598 if (o->op_private & OPpSORT_INTEGER)
599 sv_catpv(tmpsv, ",INTEGER");
600 if (o->op_private & OPpSORT_REVERSE)
601 sv_catpv(tmpsv, ",REVERSE");
602 }
603 else if (o->op_type == OP_THREADSV) {
604 if (o->op_private & OPpDONE_SVREF)
605 sv_catpv(tmpsv, ",SVREF");
606 }
607 else if (o->op_type == OP_OPEN || o->op_type == OP_BACKTICK) {
608 if (o->op_private & OPpOPEN_IN_RAW)
609 sv_catpv(tmpsv, ",IN_RAW");
610 if (o->op_private & OPpOPEN_IN_CRLF)
611 sv_catpv(tmpsv, ",IN_CRLF");
612 if (o->op_private & OPpOPEN_OUT_RAW)
613 sv_catpv(tmpsv, ",OUT_RAW");
614 if (o->op_private & OPpOPEN_OUT_CRLF)
615 sv_catpv(tmpsv, ",OUT_CRLF");
616 }
617 else if (o->op_type == OP_EXIT) {
618 if (o->op_private & OPpEXIT_VMSISH)
619 sv_catpv(tmpsv, ",EXIST_VMSISH");
620 }
11343788 621 if (o->op_flags & OPf_MOD && o->op_private & OPpLVAL_INTRO)
46fc3d4c 622 sv_catpv(tmpsv, ",INTRO");
623 if (SvCUR(tmpsv))
cea2e8a9 624 Perl_dump_indent(aTHX_ level, file, "PRIVATE = (%s)\n", SvPVX(tmpsv) + 1);
46fc3d4c 625 SvREFCNT_dec(tmpsv);
8d063cd8 626 }
8d063cd8 627
11343788 628 switch (o->op_type) {
971a9dd3 629 case OP_AELEMFAST:
93a17b20 630 case OP_GVSV:
79072805 631 case OP_GV:
971a9dd3 632#ifdef USE_ITHREADS
633 Perl_dump_indent(aTHX_ level, file, "PADIX = %d\n", cPADOPo->op_padix);
634#else
635 if (cSVOPo->op_sv) {
46fc3d4c 636 SV *tmpsv = NEWSV(0,0);
155aba94 637 STRLEN n_a;
8990e307 638 ENTER;
8990e307 639 SAVEFREESV(tmpsv);
971a9dd3 640 gv_fullname3(tmpsv, (GV*)cSVOPo->op_sv, Nullch);
cea2e8a9 641 Perl_dump_indent(aTHX_ level, file, "GV = %s\n", SvPV(tmpsv, n_a));
8990e307 642 LEAVE;
378cc40b 643 }
79072805 644 else
cea2e8a9 645 Perl_dump_indent(aTHX_ level, file, "GV = NULL\n");
971a9dd3 646#endif
79072805 647 break;
648 case OP_CONST:
f5d5a27c 649 case OP_METHOD_NAMED:
cea2e8a9 650 Perl_dump_indent(aTHX_ level, file, "SV = %s\n", SvPEEK(cSVOPo->op_sv));
79072805 651 break;
7399586d 652 case OP_SETSTATE:
93a17b20 653 case OP_NEXTSTATE:
654 case OP_DBSTATE:
57843af0 655 if (CopLINE(cCOPo))
656 Perl_dump_indent(aTHX_ level, file, "LINE = %d\n",CopLINE(cCOPo));
ed094faf 657 if (CopSTASHPV(cCOPo))
658 Perl_dump_indent(aTHX_ level, file, "PACKAGE = \"%s\"\n",
659 CopSTASHPV(cCOPo));
11343788 660 if (cCOPo->cop_label)
ed094faf 661 Perl_dump_indent(aTHX_ level, file, "LABEL = \"%s\"\n",
662 cCOPo->cop_label);
79072805 663 break;
664 case OP_ENTERLOOP:
cea2e8a9 665 Perl_dump_indent(aTHX_ level, file, "REDO ===> ");
11343788 666 if (cLOOPo->op_redoop)
3967c732 667 PerlIO_printf(file, "%d\n", cLOOPo->op_redoop->op_seq);
79072805 668 else
3967c732 669 PerlIO_printf(file, "DONE\n");
cea2e8a9 670 Perl_dump_indent(aTHX_ level, file, "NEXT ===> ");
11343788 671 if (cLOOPo->op_nextop)
3967c732 672 PerlIO_printf(file, "%d\n", cLOOPo->op_nextop->op_seq);
79072805 673 else
3967c732 674 PerlIO_printf(file, "DONE\n");
cea2e8a9 675 Perl_dump_indent(aTHX_ level, file, "LAST ===> ");
11343788 676 if (cLOOPo->op_lastop)
3967c732 677 PerlIO_printf(file, "%d\n", cLOOPo->op_lastop->op_seq);
79072805 678 else
3967c732 679 PerlIO_printf(file, "DONE\n");
79072805 680 break;
681 case OP_COND_EXPR:
1a67a97c 682 case OP_RANGE:
a0d0e21e 683 case OP_MAPWHILE:
79072805 684 case OP_GREPWHILE:
685 case OP_OR:
686 case OP_AND:
cea2e8a9 687 Perl_dump_indent(aTHX_ level, file, "OTHER ===> ");
11343788 688 if (cLOGOPo->op_other)
3967c732 689 PerlIO_printf(file, "%d\n", cLOGOPo->op_other->op_seq);
79072805 690 else
3967c732 691 PerlIO_printf(file, "DONE\n");
79072805 692 break;
693 case OP_PUSHRE:
694 case OP_MATCH:
8782bef2 695 case OP_QR:
79072805 696 case OP_SUBST:
3967c732 697 do_pmop_dump(level, file, cPMOPo);
79072805 698 break;
7934575e 699 case OP_LEAVE:
700 case OP_LEAVEEVAL:
701 case OP_LEAVESUB:
702 case OP_LEAVESUBLV:
703 case OP_LEAVEWRITE:
704 case OP_SCOPE:
705 if (o->op_private & OPpREFCOUNTED)
706 Perl_dump_indent(aTHX_ level, file, "REFCNT = %"UVuf"\n", (UV)o->op_targ);
707 break;
a0d0e21e 708 default:
709 break;
79072805 710 }
11343788 711 if (o->op_flags & OPf_KIDS) {
79072805 712 OP *kid;
11343788 713 for (kid = cUNOPo->op_first; kid; kid = kid->op_sibling)
3967c732 714 do_op_dump(level, file, kid);
8d063cd8 715 }
cea2e8a9 716 Perl_dump_indent(aTHX_ level-1, file, "}\n");
3967c732 717}
718
719void
864dbfa3 720Perl_op_dump(pTHX_ OP *o)
3967c732 721{
722 do_op_dump(0, Perl_debug_log, o);
8d063cd8 723}
724
8adcabd8 725void
864dbfa3 726Perl_gv_dump(pTHX_ GV *gv)
378cc40b 727{
79072805 728 SV *sv;
378cc40b 729
79072805 730 if (!gv) {
760ac839 731 PerlIO_printf(Perl_debug_log, "{}\n");
378cc40b 732 return;
733 }
8990e307 734 sv = sv_newmortal();
760ac839 735 PerlIO_printf(Perl_debug_log, "{\n");
f6aff53a 736 gv_fullname3(sv, gv, Nullch);
cea2e8a9 737 Perl_dump_indent(aTHX_ 1, Perl_debug_log, "GV_NAME = %s", SvPVX(sv));
79072805 738 if (gv != GvEGV(gv)) {
f6aff53a 739 gv_efullname3(sv, GvEGV(gv), Nullch);
cea2e8a9 740 Perl_dump_indent(aTHX_ 1, Perl_debug_log, "-> %s", SvPVX(sv));
8adcabd8 741 }
3967c732 742 PerlIO_putc(Perl_debug_log, '\n');
cea2e8a9 743 Perl_dump_indent(aTHX_ 0, Perl_debug_log, "}\n");
8d063cd8 744}
745
14befaf4 746
747/* map magic types to the symbolic name
748 * (with the PERL_MAGIC_ prefixed stripped)
749 */
750
751static struct { char type; char *name; } magic_names[] = {
516a5887 752 { PERL_MAGIC_sv, "sv(\\0)" },
753 { PERL_MAGIC_arylen, "arylen(#)" },
754 { PERL_MAGIC_glob, "glob(*)" },
755 { PERL_MAGIC_pos, "pos(.)" },
756 { PERL_MAGIC_backref, "backref(<)" },
757 { PERL_MAGIC_overload, "overload(A)" },
758 { PERL_MAGIC_bm, "bm(B)" },
759 { PERL_MAGIC_regdata, "regdata(D)" },
760 { PERL_MAGIC_env, "env(E)" },
761 { PERL_MAGIC_isa, "isa(I)" },
762 { PERL_MAGIC_dbfile, "dbfile(L)" },
763 { PERL_MAGIC_tied, "tied(P)" },
764 { PERL_MAGIC_sig, "sig(S)" },
765 { PERL_MAGIC_uvar, "uvar(U)" },
766 { PERL_MAGIC_overload_elem, "overload_elem(a)" },
767 { PERL_MAGIC_overload_table, "overload_table(c)" },
768 { PERL_MAGIC_regdatum, "regdatum(d)" },
769 { PERL_MAGIC_envelem, "envelem(e)" },
770 { PERL_MAGIC_fm, "fm(f)" },
771 { PERL_MAGIC_regex_global, "regex_global(g)" },
772 { PERL_MAGIC_isaelem, "isaelem(i)" },
773 { PERL_MAGIC_nkeys, "nkeys(k)" },
774 { PERL_MAGIC_dbline, "dbline(l)" },
775 { PERL_MAGIC_mutex, "mutex(m)" },
776 { PERL_MAGIC_collxfrm, "collxfrm(o)" },
777 { PERL_MAGIC_tiedelem, "tiedelem(p)" },
778 { PERL_MAGIC_tiedscalar, "tiedscalar(q)" },
779 { PERL_MAGIC_qr, "qr(r)" },
780 { PERL_MAGIC_sigelem, "sigelem(s)" },
781 { PERL_MAGIC_taint, "taint(t)" },
782 { PERL_MAGIC_vec, "vec(v)" },
783 { PERL_MAGIC_substr, "substr(x)" },
784 { PERL_MAGIC_defelem, "defelem(y)" },
785 { PERL_MAGIC_ext, "ext(~)" },
786 /* this null string terminates the list */
787 { 0, 0 },
14befaf4 788};
789
8adcabd8 790void
864dbfa3 791Perl_do_magic_dump(pTHX_ I32 level, PerlIO *file, MAGIC *mg, I32 nest, I32 maxnest, bool dumpops, STRLEN pvlim)
8d063cd8 792{
3967c732 793 for (; mg; mg = mg->mg_moremagic) {
b900a521 794 Perl_dump_indent(aTHX_ level, file,
795 " MAGIC = 0x%"UVxf"\n", PTR2UV(mg));
3967c732 796 if (mg->mg_virtual) {
797 MGVTBL *v = mg->mg_virtual;
798 char *s = 0;
799 if (v == &PL_vtbl_sv) s = "sv";
800 else if (v == &PL_vtbl_env) s = "env";
801 else if (v == &PL_vtbl_envelem) s = "envelem";
802 else if (v == &PL_vtbl_sig) s = "sig";
803 else if (v == &PL_vtbl_sigelem) s = "sigelem";
804 else if (v == &PL_vtbl_pack) s = "pack";
805 else if (v == &PL_vtbl_packelem) s = "packelem";
806 else if (v == &PL_vtbl_dbline) s = "dbline";
807 else if (v == &PL_vtbl_isa) s = "isa";
808 else if (v == &PL_vtbl_arylen) s = "arylen";
809 else if (v == &PL_vtbl_glob) s = "glob";
810 else if (v == &PL_vtbl_mglob) s = "mglob";
811 else if (v == &PL_vtbl_nkeys) s = "nkeys";
812 else if (v == &PL_vtbl_taint) s = "taint";
813 else if (v == &PL_vtbl_substr) s = "substr";
814 else if (v == &PL_vtbl_vec) s = "vec";
815 else if (v == &PL_vtbl_pos) s = "pos";
816 else if (v == &PL_vtbl_bm) s = "bm";
817 else if (v == &PL_vtbl_fm) s = "fm";
818 else if (v == &PL_vtbl_uvar) s = "uvar";
819 else if (v == &PL_vtbl_defelem) s = "defelem";
820#ifdef USE_LOCALE_COLLATE
821 else if (v == &PL_vtbl_collxfrm) s = "collxfrm";
822#endif
3967c732 823 else if (v == &PL_vtbl_amagic) s = "amagic";
824 else if (v == &PL_vtbl_amagicelem) s = "amagicelem";
810b8aa5 825 else if (v == &PL_vtbl_backref) s = "backref";
3967c732 826 if (s)
cea2e8a9 827 Perl_dump_indent(aTHX_ level, file, " MG_VIRTUAL = &PL_vtbl_%s\n", s);
3967c732 828 else
b900a521 829 Perl_dump_indent(aTHX_ level, file, " MG_VIRTUAL = 0x%"UVxf"\n", PTR2UV(v));
3967c732 830 }
831 else
cea2e8a9 832 Perl_dump_indent(aTHX_ level, file, " MG_VIRTUAL = 0\n");
8d063cd8 833
3967c732 834 if (mg->mg_private)
cea2e8a9 835 Perl_dump_indent(aTHX_ level, file, " MG_PRIVATE = %d\n", mg->mg_private);
3967c732 836
14befaf4 837 {
838 int n;
839 char *name = 0;
840 for (n=0; magic_names[n].name; n++) {
841 if (mg->mg_type == magic_names[n].type) {
842 name = magic_names[n].name;
843 break;
844 }
845 }
846 if (name)
847 Perl_dump_indent(aTHX_ level, file,
848 " MG_TYPE = PERL_MAGIC_%s\n", name);
849 else
850 Perl_dump_indent(aTHX_ level, file,
851 " MG_TYPE = UNKNOWN(\\%o)\n", mg->mg_type);
852 }
3967c732 853
854 if (mg->mg_flags) {
cea2e8a9 855 Perl_dump_indent(aTHX_ level, file, " MG_FLAGS = 0x%02X\n", mg->mg_flags);
3967c732 856 if (mg->mg_flags & MGf_TAINTEDDIR)
cea2e8a9 857 Perl_dump_indent(aTHX_ level, file, " TAINTEDDIR\n");
3967c732 858 if (mg->mg_flags & MGf_REFCOUNTED)
cea2e8a9 859 Perl_dump_indent(aTHX_ level, file, " REFCOUNTED\n");
3967c732 860 if (mg->mg_flags & MGf_GSKIP)
cea2e8a9 861 Perl_dump_indent(aTHX_ level, file, " GSKIP\n");
3967c732 862 if (mg->mg_flags & MGf_MINMATCH)
cea2e8a9 863 Perl_dump_indent(aTHX_ level, file, " MINMATCH\n");
3967c732 864 }
865 if (mg->mg_obj) {
b900a521 866 Perl_dump_indent(aTHX_ level, file, " MG_OBJ = 0x%"UVxf"\n", PTR2UV(mg->mg_obj));
3967c732 867 if (mg->mg_flags & MGf_REFCOUNTED)
868 do_sv_dump(level+2, file, mg->mg_obj, nest+1, maxnest, dumpops, pvlim); /* MG is already +1 */
869 }
870 if (mg->mg_len)
894356b3 871 Perl_dump_indent(aTHX_ level, file, " MG_LEN = %ld\n", (long)mg->mg_len);
3967c732 872 if (mg->mg_ptr) {
b900a521 873 Perl_dump_indent(aTHX_ level, file, " MG_PTR = 0x%"UVxf, PTR2UV(mg->mg_ptr));
3967c732 874 if (mg->mg_len >= 0) {
79cb57f6 875 SV *sv = newSVpvn("", 0);
3967c732 876 PerlIO_printf(file, " %s", pv_display(sv, mg->mg_ptr, mg->mg_len, 0, pvlim));
877 SvREFCNT_dec(sv);
878 }
879 else if (mg->mg_len == HEf_SVKEY) {
880 PerlIO_puts(file, " => HEf_SVKEY\n");
881 do_sv_dump(level+2, file, (SV*)((mg)->mg_ptr), nest+1, maxnest, dumpops, pvlim); /* MG is already +1 */
882 continue;
883 }
884 else
885 PerlIO_puts(file, " ???? - please notify IZ");
886 PerlIO_putc(file, '\n');
887 }
378cc40b 888 }
3967c732 889}
890
891void
864dbfa3 892Perl_magic_dump(pTHX_ MAGIC *mg)
3967c732 893{
894 do_magic_dump(0, Perl_debug_log, mg, 0, 0, 0, 0);
895}
896
897void
864dbfa3 898Perl_do_hv_dump(pTHX_ I32 level, PerlIO *file, char *name, HV *sv)
3967c732 899{
b900a521 900 Perl_dump_indent(aTHX_ level, file, "%s = 0x%"UVxf, name, PTR2UV(sv));
3967c732 901 if (sv && HvNAME(sv))
902 PerlIO_printf(file, "\t\"%s\"\n", HvNAME(sv));
79072805 903 else
3967c732 904 PerlIO_putc(file, '\n');
905}
906
907void
864dbfa3 908Perl_do_gv_dump(pTHX_ I32 level, PerlIO *file, char *name, GV *sv)
3967c732 909{
b900a521 910 Perl_dump_indent(aTHX_ level, file, "%s = 0x%"UVxf, name, PTR2UV(sv));
3967c732 911 if (sv && GvNAME(sv))
912 PerlIO_printf(file, "\t\"%s\"\n", GvNAME(sv));
c90c0ff4 913 else
3967c732 914 PerlIO_putc(file, '\n');
915}
916
917void
864dbfa3 918Perl_do_gvgv_dump(pTHX_ I32 level, PerlIO *file, char *name, GV *sv)
3967c732 919{
b900a521 920 Perl_dump_indent(aTHX_ level, file, "%s = 0x%"UVxf, name, PTR2UV(sv));
3967c732 921 if (sv && GvNAME(sv)) {
922 PerlIO_printf(file, "\t\"");
6676db26 923 if (GvSTASH(sv))
3967c732 924 PerlIO_printf(file, "%s\" :: \"", HvNAME(GvSTASH(sv)));
925 PerlIO_printf(file, "%s\"\n", GvNAME(sv));
8d063cd8 926 }
3967c732 927 else
928 PerlIO_putc(file, '\n');
929}
930
931void
864dbfa3 932Perl_do_sv_dump(pTHX_ I32 level, PerlIO *file, SV *sv, I32 nest, I32 maxnest, bool dumpops, STRLEN pvlim)
3967c732 933{
cea89e20 934 SV *d;
3967c732 935 char *s;
936 U32 flags;
937 U32 type;
2d8e6c8d 938 STRLEN n_a;
3967c732 939
940 if (!sv) {
cea2e8a9 941 Perl_dump_indent(aTHX_ level, file, "SV = 0\n");
3967c732 942 return;
378cc40b 943 }
2ef28da1 944
3967c732 945 flags = SvFLAGS(sv);
946 type = SvTYPE(sv);
79072805 947
cea89e20 948 d = Perl_newSVpvf(aTHX_
57def98f 949 "(0x%"UVxf") at 0x%"UVxf"\n%*s REFCNT = %"IVdf"\n%*s FLAGS = (",
56431972 950 PTR2UV(SvANY(sv)), PTR2UV(sv),
894356b3 951 (int)(PL_dumpindent*level), "", (IV)SvREFCNT(sv),
952 (int)(PL_dumpindent*level), "");
8d063cd8 953
3967c732 954 if (flags & SVs_PADBUSY) sv_catpv(d, "PADBUSY,");
955 if (flags & SVs_PADTMP) sv_catpv(d, "PADTMP,");
956 if (flags & SVs_PADMY) sv_catpv(d, "PADMY,");
957 if (flags & SVs_TEMP) sv_catpv(d, "TEMP,");
958 if (flags & SVs_OBJECT) sv_catpv(d, "OBJECT,");
959 if (flags & SVs_GMG) sv_catpv(d, "GMG,");
960 if (flags & SVs_SMG) sv_catpv(d, "SMG,");
961 if (flags & SVs_RMG) sv_catpv(d, "RMG,");
4db58590 962
3967c732 963 if (flags & SVf_IOK) sv_catpv(d, "IOK,");
964 if (flags & SVf_NOK) sv_catpv(d, "NOK,");
965 if (flags & SVf_POK) sv_catpv(d, "POK,");
810b8aa5 966 if (flags & SVf_ROK) {
967 sv_catpv(d, "ROK,");
968 if (SvWEAKREF(sv)) sv_catpv(d, "WEAKREF,");
969 }
3967c732 970 if (flags & SVf_OOK) sv_catpv(d, "OOK,");
971 if (flags & SVf_FAKE) sv_catpv(d, "FAKE,");
972 if (flags & SVf_READONLY) sv_catpv(d, "READONLY,");
4db58590 973
3967c732 974 if (flags & SVf_AMAGIC) sv_catpv(d, "OVERLOAD,");
3967c732 975 if (flags & SVp_IOK) sv_catpv(d, "pIOK,");
976 if (flags & SVp_NOK) sv_catpv(d, "pNOK,");
977 if (flags & SVp_POK) sv_catpv(d, "pPOK,");
978 if (flags & SVp_SCREAM) sv_catpv(d, "SCREAM,");
979
980 switch (type) {
981 case SVt_PVCV:
982 case SVt_PVFM:
983 if (CvANON(sv)) sv_catpv(d, "ANON,");
984 if (CvUNIQUE(sv)) sv_catpv(d, "UNIQUE,");
985 if (CvCLONE(sv)) sv_catpv(d, "CLONE,");
986 if (CvCLONED(sv)) sv_catpv(d, "CLONED,");
de3f1649 987 if (CvCONST(sv)) sv_catpv(d, "CONST,");
3967c732 988 if (CvNODEBUG(sv)) sv_catpv(d, "NODEBUG,");
25da4f38 989 if (SvCOMPILED(sv)) sv_catpv(d, "COMPILED,");
18f7acf9 990 if (CvLVALUE(sv)) sv_catpv(d, "LVALUE,");
991 if (CvMETHOD(sv)) sv_catpv(d, "METHOD,");
3967c732 992 break;
993 case SVt_PVHV:
994 if (HvSHAREKEYS(sv)) sv_catpv(d, "SHAREKEYS,");
995 if (HvLAZYDEL(sv)) sv_catpv(d, "LAZYDEL,");
996 break;
997 case SVt_PVGV:
998 if (GvINTRO(sv)) sv_catpv(d, "INTRO,");
999 if (GvMULTI(sv)) sv_catpv(d, "MULTI,");
7fb37951 1000 if (GvUNIQUE(sv)) sv_catpv(d, "UNIQUE,");
3967c732 1001 if (GvASSUMECV(sv)) sv_catpv(d, "ASSUMECV,");
12c18039 1002 if (GvIN_PAD(sv)) sv_catpv(d, "IN_PAD,");
addd1794 1003 if (flags & SVpad_OUR) sv_catpv(d, "OUR,");
3967c732 1004 if (GvIMPORTED(sv)) {
1005 sv_catpv(d, "IMPORT");
1006 if (GvIMPORTED(sv) == GVf_IMPORTED)
1007 sv_catpv(d, "ALL,");
1008 else {
1009 sv_catpv(d, "(");
1010 if (GvIMPORTED_SV(sv)) sv_catpv(d, " SV");
1011 if (GvIMPORTED_AV(sv)) sv_catpv(d, " AV");
1012 if (GvIMPORTED_HV(sv)) sv_catpv(d, " HV");
1013 if (GvIMPORTED_CV(sv)) sv_catpv(d, " CV");
1014 sv_catpv(d, " ),");
1015 }
1016 }
addd1794 1017 /* FALL THROUGH */
25da4f38 1018 default:
1019 if (SvEVALED(sv)) sv_catpv(d, "EVALED,");
1020 if (SvIsUV(sv)) sv_catpv(d, "IsUV,");
1021 break;
3967c732 1022 case SVt_PVBM:
1023 if (SvTAIL(sv)) sv_catpv(d, "TAIL,");
25da4f38 1024 if (SvVALID(sv)) sv_catpv(d, "VALID,");
3967c732 1025 break;
addd1794 1026 case SVt_PVMG:
1027 if (flags & SVpad_TYPED)
1028 sv_catpv(d, "TYPED,");
1029 break;
3967c732 1030 }
8b1981a6 1031 if (SvPOK(sv) && SvUTF8(sv))
9fe74ede 1032 sv_catpv(d, "UTF8");
3967c732 1033
1034 if (*(SvEND(d) - 1) == ',')
1035 SvPVX(d)[--SvCUR(d)] = '\0';
1036 sv_catpv(d, ")");
1037 s = SvPVX(d);
1038
cea2e8a9 1039 Perl_dump_indent(aTHX_ level, file, "SV = ");
3967c732 1040 switch (type) {
1041 case SVt_NULL:
1042 PerlIO_printf(file, "NULL%s\n", s);
cea89e20 1043 SvREFCNT_dec(d);
3967c732 1044 return;
1045 case SVt_IV:
1046 PerlIO_printf(file, "IV%s\n", s);
1047 break;
1048 case SVt_NV:
1049 PerlIO_printf(file, "NV%s\n", s);
1050 break;
1051 case SVt_RV:
1052 PerlIO_printf(file, "RV%s\n", s);
1053 break;
1054 case SVt_PV:
1055 PerlIO_printf(file, "PV%s\n", s);
1056 break;
1057 case SVt_PVIV:
1058 PerlIO_printf(file, "PVIV%s\n", s);
1059 break;
1060 case SVt_PVNV:
1061 PerlIO_printf(file, "PVNV%s\n", s);
1062 break;
1063 case SVt_PVBM:
1064 PerlIO_printf(file, "PVBM%s\n", s);
1065 break;
1066 case SVt_PVMG:
1067 PerlIO_printf(file, "PVMG%s\n", s);
1068 break;
1069 case SVt_PVLV:
1070 PerlIO_printf(file, "PVLV%s\n", s);
1071 break;
1072 case SVt_PVAV:
1073 PerlIO_printf(file, "PVAV%s\n", s);
1074 break;
1075 case SVt_PVHV:
1076 PerlIO_printf(file, "PVHV%s\n", s);
1077 break;
1078 case SVt_PVCV:
1079 PerlIO_printf(file, "PVCV%s\n", s);
1080 break;
1081 case SVt_PVGV:
1082 PerlIO_printf(file, "PVGV%s\n", s);
1083 break;
1084 case SVt_PVFM:
1085 PerlIO_printf(file, "PVFM%s\n", s);
1086 break;
1087 case SVt_PVIO:
1088 PerlIO_printf(file, "PVIO%s\n", s);
1089 break;
1090 default:
faccc32b 1091 PerlIO_printf(file, "UNKNOWN(0x%"UVxf") %s\n", (UV)type, s);
cea89e20 1092 SvREFCNT_dec(d);
3967c732 1093 return;
1094 }
1095 if (type >= SVt_PVIV || type == SVt_IV) {
cf2093f6 1096 if (SvIsUV(sv))
57def98f 1097 Perl_dump_indent(aTHX_ level, file, " UV = %"UVuf, (UV)SvUVX(sv));
cf2093f6 1098 else
57def98f 1099 Perl_dump_indent(aTHX_ level, file, " IV = %"IVdf, (IV)SvIVX(sv));
3967c732 1100 if (SvOOK(sv))
1101 PerlIO_printf(file, " (OFFSET)");
1102 PerlIO_putc(file, '\n');
1103 }
1104 if (type >= SVt_PVNV || type == SVt_NV) {
e54dc35b 1105 STORE_NUMERIC_LOCAL_SET_STANDARD();
57def98f 1106 /* %Vg doesn't work? --jhi */
cf2093f6 1107#ifdef USE_LONG_DOUBLE
2d4389e4 1108 Perl_dump_indent(aTHX_ level, file, " NV = %.*" PERL_PRIgldbl "\n", LDBL_DIG, SvNVX(sv));
cf2093f6 1109#else
cea2e8a9 1110 Perl_dump_indent(aTHX_ level, file, " NV = %.*g\n", DBL_DIG, SvNVX(sv));
cf2093f6 1111#endif
e54dc35b 1112 RESTORE_NUMERIC_LOCAL();
3967c732 1113 }
1114 if (SvROK(sv)) {
57def98f 1115 Perl_dump_indent(aTHX_ level, file, " RV = 0x%"UVxf"\n", PTR2UV(SvRV(sv)));
3967c732 1116 if (nest < maxnest)
1117 do_sv_dump(level+1, file, SvRV(sv), nest+1, maxnest, dumpops, pvlim);
cea89e20 1118 SvREFCNT_dec(d);
3967c732 1119 return;
1120 }
cea89e20 1121 if (type < SVt_PV) {
1122 SvREFCNT_dec(d);
3967c732 1123 return;
cea89e20 1124 }
3967c732 1125 if (type <= SVt_PVLV) {
1126 if (SvPVX(sv)) {
57def98f 1127 Perl_dump_indent(aTHX_ level, file," PV = 0x%"UVxf" ", PTR2UV(SvPVX(sv)));
3967c732 1128 if (SvOOK(sv))
1129 PerlIO_printf(file, "( %s . ) ", pv_display(d, SvPVX(sv)-SvIVX(sv), SvIVX(sv), 0, pvlim));
e6abe6d8 1130 PerlIO_printf(file, "%s", pv_display(d, SvPVX(sv), SvCUR(sv), SvLEN(sv), pvlim));
1131 if (SvUTF8(sv)) /* the 8? \x{....} */
98c991d1 1132 PerlIO_printf(file, " [UTF8 %s]", sv_uni_display(d, sv, 8 * sv_len_utf8(sv)));
e6abe6d8 1133 PerlIO_printf(file, "\n");
57def98f 1134 Perl_dump_indent(aTHX_ level, file, " CUR = %"IVdf"\n", (IV)SvCUR(sv));
1135 Perl_dump_indent(aTHX_ level, file, " LEN = %"IVdf"\n", (IV)SvLEN(sv));
3967c732 1136 }
1137 else
cea2e8a9 1138 Perl_dump_indent(aTHX_ level, file, " PV = 0\n");
3967c732 1139 }
1140 if (type >= SVt_PVMG) {
1141 if (SvMAGIC(sv))
1142 do_magic_dump(level, file, SvMAGIC(sv), nest, maxnest, dumpops, pvlim);
1143 if (SvSTASH(sv))
1144 do_hv_dump(level, file, " STASH", SvSTASH(sv));
1145 }
1146 switch (type) {
1147 case SVt_PVLV:
cea2e8a9 1148 Perl_dump_indent(aTHX_ level, file, " TYPE = %c\n", LvTYPE(sv));
57def98f 1149 Perl_dump_indent(aTHX_ level, file, " TARGOFF = %"IVdf"\n", (IV)LvTARGOFF(sv));
1150 Perl_dump_indent(aTHX_ level, file, " TARGLEN = %"IVdf"\n", (IV)LvTARGLEN(sv));
1151 Perl_dump_indent(aTHX_ level, file, " TARG = 0x%"UVxf"\n", PTR2UV(LvTARG(sv)));
3967c732 1152 /* XXX level+1 ??? */
1153 do_sv_dump(level, file, LvTARG(sv), nest+1, maxnest, dumpops, pvlim);
1154 break;
1155 case SVt_PVAV:
57def98f 1156 Perl_dump_indent(aTHX_ level, file, " ARRAY = 0x%"UVxf, PTR2UV(AvARRAY(sv)));
3967c732 1157 if (AvARRAY(sv) != AvALLOC(sv)) {
57def98f 1158 PerlIO_printf(file, " (offset=%"IVdf")\n", (IV)(AvARRAY(sv) - AvALLOC(sv)));
1159 Perl_dump_indent(aTHX_ level, file, " ALLOC = 0x%"UVxf"\n", PTR2UV(AvALLOC(sv)));
3967c732 1160 }
1161 else
1162 PerlIO_putc(file, '\n');
57def98f 1163 Perl_dump_indent(aTHX_ level, file, " FILL = %"IVdf"\n", (IV)AvFILLp(sv));
1164 Perl_dump_indent(aTHX_ level, file, " MAX = %"IVdf"\n", (IV)AvMAX(sv));
1165 Perl_dump_indent(aTHX_ level, file, " ARYLEN = 0x%"UVxf"\n", PTR2UV(AvARYLEN(sv)));
3967c732 1166 flags = AvFLAGS(sv);
1167 sv_setpv(d, "");
1168 if (flags & AVf_REAL) sv_catpv(d, ",REAL");
1169 if (flags & AVf_REIFY) sv_catpv(d, ",REIFY");
1170 if (flags & AVf_REUSED) sv_catpv(d, ",REUSED");
cea2e8a9 1171 Perl_dump_indent(aTHX_ level, file, " FLAGS = (%s)\n", SvCUR(d) ? SvPVX(d) + 1 : "");
3967c732 1172 if (nest < maxnest && av_len((AV*)sv) >= 0) {
1173 int count;
1174 for (count = 0; count <= av_len((AV*)sv) && count < maxnest; count++) {
1175 SV** elt = av_fetch((AV*)sv,count,0);
1176
57def98f 1177 Perl_dump_indent(aTHX_ level + 1, file, "Elt No. %"IVdf"\n", (IV)count);
2ef28da1 1178 if (elt)
3967c732 1179 do_sv_dump(level+1, file, *elt, nest+1, maxnest, dumpops, pvlim);
1180 }
1181 }
1182 break;
1183 case SVt_PVHV:
57def98f 1184 Perl_dump_indent(aTHX_ level, file, " ARRAY = 0x%"UVxf, PTR2UV(HvARRAY(sv)));
3967c732 1185 if (HvARRAY(sv) && HvKEYS(sv)) {
1186 /* Show distribution of HEs in the ARRAY */
1187 int freq[200];
1188#define FREQ_MAX (sizeof freq / sizeof freq[0] - 1)
1189 int i;
1190 int max = 0;
1191 U32 pow2 = 2, keys = HvKEYS(sv);
65202027 1192 NV theoret, sum = 0;
3967c732 1193
1194 PerlIO_printf(file, " (");
1195 Zero(freq, FREQ_MAX + 1, int);
1196 for (i = 0; i <= HvMAX(sv); i++) {
1197 HE* h; int count = 0;
1198 for (h = HvARRAY(sv)[i]; h; h = HeNEXT(h))
1199 count++;
1200 if (count > FREQ_MAX)
1201 count = FREQ_MAX;
1202 freq[count]++;
1203 if (max < count)
1204 max = count;
1205 }
1206 for (i = 0; i <= max; i++) {
1207 if (freq[i]) {
1208 PerlIO_printf(file, "%d%s:%d", i,
1209 (i == FREQ_MAX) ? "+" : "",
1210 freq[i]);
1211 if (i != max)
1212 PerlIO_printf(file, ", ");
1213 }
1214 }
1215 PerlIO_putc(file, ')');
b8fa94d8 1216 /* The "quality" of a hash is defined as the total number of
1217 comparisons needed to access every element once, relative
1218 to the expected number needed for a random hash.
1219
1220 The total number of comparisons is equal to the sum of
e76cd0fa 1221 the squares of the number of entries in each bucket.
1222 For a random hash of n keys into k buckets, the expected
b8fa94d8 1223 value is
1224 n + n(n-1)/2k
1225 */
1226
3967c732 1227 for (i = max; i > 0; i--) { /* Precision: count down. */
1228 sum += freq[i] * i * i;
1229 }
155aba94 1230 while ((keys = keys >> 1))
3967c732 1231 pow2 = pow2 << 1;
3967c732 1232 theoret = HvKEYS(sv);
b8fa94d8 1233 theoret += theoret * (theoret-1)/pow2;
3967c732 1234 PerlIO_putc(file, '\n');
6b4667fc 1235 Perl_dump_indent(aTHX_ level, file, " hash quality = %.1"NVff"%%", theoret/sum*100);
3967c732 1236 }
1237 PerlIO_putc(file, '\n');
57def98f 1238 Perl_dump_indent(aTHX_ level, file, " KEYS = %"IVdf"\n", (IV)HvKEYS(sv));
1239 Perl_dump_indent(aTHX_ level, file, " FILL = %"IVdf"\n", (IV)HvFILL(sv));
1240 Perl_dump_indent(aTHX_ level, file, " MAX = %"IVdf"\n", (IV)HvMAX(sv));
1241 Perl_dump_indent(aTHX_ level, file, " RITER = %"IVdf"\n", (IV)HvRITER(sv));
1242 Perl_dump_indent(aTHX_ level, file, " EITER = 0x%"UVxf"\n", PTR2UV(HvEITER(sv)));
3967c732 1243 if (HvPMROOT(sv))
57def98f 1244 Perl_dump_indent(aTHX_ level, file, " PMROOT = 0x%"UVxf"\n", PTR2UV(HvPMROOT(sv)));
3967c732 1245 if (HvNAME(sv))
cea2e8a9 1246 Perl_dump_indent(aTHX_ level, file, " NAME = \"%s\"\n", HvNAME(sv));
3967c732 1247 if (nest < maxnest && !HvEITER(sv)) { /* Try to preserve iterator */
1248 HE *he;
1249 HV *hv = (HV*)sv;
1250 int count = maxnest - nest;
1251
1252 hv_iterinit(hv);
1253 while ((he = hv_iternext(hv)) && count--) {
98c991d1 1254 SV *elt, *keysv;
1255 char *keypv;
1256 STRLEN len;
3967c732 1257 U32 hash = HeHASH(he);
1258
98c991d1 1259 keysv = hv_iterkeysv(he);
1260 keypv = SvPV(keysv, len);
3967c732 1261 elt = hv_iterval(hv, he);
98c991d1 1262 Perl_dump_indent(aTHX_ level+1, file, "Elt %s ", pv_display(d, keypv, len, 0, pvlim));
1263 if (SvUTF8(keysv))
1264 PerlIO_printf(file, "[UTF8 %s] ", sv_uni_display(d, keysv, 8 * sv_len_utf8(keysv)));
1265 PerlIO_printf(file, "HASH = 0x%"UVxf"\n", (UV)hash);
3967c732 1266 do_sv_dump(level+1, file, elt, nest+1, maxnest, dumpops, pvlim);
1267 }
1268 hv_iterinit(hv); /* Return to status quo */
1269 }
1270 break;
1271 case SVt_PVCV:
1272 if (SvPOK(sv))
cea2e8a9 1273 Perl_dump_indent(aTHX_ level, file, " PROTOTYPE = \"%s\"\n", SvPV(sv,n_a));
3967c732 1274 /* FALL THROUGH */
1275 case SVt_PVFM:
1276 do_hv_dump(level, file, " COMP_STASH", CvSTASH(sv));
1277 if (CvSTART(sv))
57def98f 1278 Perl_dump_indent(aTHX_ level, file, " START = 0x%"UVxf" ===> %"IVdf"\n", PTR2UV(CvSTART(sv)), (IV)CvSTART(sv)->op_seq);
1279 Perl_dump_indent(aTHX_ level, file, " ROOT = 0x%"UVxf"\n", PTR2UV(CvROOT(sv)));
3967c732 1280 if (CvROOT(sv) && dumpops)
1281 do_op_dump(level+1, file, CvROOT(sv));
57def98f 1282 Perl_dump_indent(aTHX_ level, file, " XSUB = 0x%"UVxf"\n", PTR2UV(CvXSUB(sv)));
1283 Perl_dump_indent(aTHX_ level, file, " XSUBANY = %"IVdf"\n", (IV)CvXSUBANY(sv).any_i32);
3967c732 1284 do_gvgv_dump(level, file, " GVGV::GV", CvGV(sv));
57843af0 1285 Perl_dump_indent(aTHX_ level, file, " FILE = \"%s\"\n", CvFILE(sv));
57def98f 1286 Perl_dump_indent(aTHX_ level, file, " DEPTH = %"IVdf"\n", (IV)CvDEPTH(sv));
4d1ff10f 1287#ifdef USE_5005THREADS
07270b1a 1288 Perl_dump_indent(aTHX_ level, file, " MUTEXP = 0x%"UVxf"\n", PTR2UV(CvMUTEXP(sv)));
1289 Perl_dump_indent(aTHX_ level, file, " OWNER = 0x%"UVxf"\n", PTR2UV(CvOWNER(sv)));
4d1ff10f 1290#endif /* USE_5005THREADS */
894356b3 1291 Perl_dump_indent(aTHX_ level, file, " FLAGS = 0x%"UVxf"\n", (UV)CvFLAGS(sv));
3967c732 1292 if (type == SVt_PVFM)
57def98f 1293 Perl_dump_indent(aTHX_ level, file, " LINES = %"IVdf"\n", (IV)FmLINES(sv));
1294 Perl_dump_indent(aTHX_ level, file, " PADLIST = 0x%"UVxf"\n", PTR2UV(CvPADLIST(sv)));
3967c732 1295 if (nest < maxnest && CvPADLIST(sv)) {
1296 AV* padlist = CvPADLIST(sv);
1297 AV* pad_name = (AV*)*av_fetch(padlist, 0, FALSE);
1298 AV* pad = (AV*)*av_fetch(padlist, 1, FALSE);
1299 SV** pname = AvARRAY(pad_name);
1300 SV** ppad = AvARRAY(pad);
1301 I32 ix;
1302
1303 for (ix = 1; ix <= AvFILL(pad_name); ix++) {
b9c39e73 1304 if (SvPOK(pname[ix]))
57def98f 1305 Perl_dump_indent(aTHX_ level,
1306 /* %5d below is enough whitespace. */
2ef28da1 1307 file,
57def98f 1308 "%5d. 0x%"UVxf" (%s\"%s\" %"IVdf"-%"IVdf")\n",
894356b3 1309 (int)ix, PTR2UV(ppad[ix]),
cf2093f6 1310 SvFAKE(pname[ix]) ? "FAKE " : "",
1311 SvPVX(pname[ix]),
1312 (IV)SvNVX(pname[ix]),
1313 (IV)SvIVX(pname[ix]));
3967c732 1314 }
1315 }
1316 {
1317 CV *outside = CvOUTSIDE(sv);
2ef28da1 1318 Perl_dump_indent(aTHX_ level, file, " OUTSIDE = 0x%"UVxf" (%s)\n",
57def98f 1319 PTR2UV(outside),
cf2093f6 1320 (!outside ? "null"
1321 : CvANON(outside) ? "ANON"
1322 : (outside == PL_main_cv) ? "MAIN"
1323 : CvUNIQUE(outside) ? "UNIQUE"
1324 : CvGV(outside) ? GvNAME(CvGV(outside)) : "UNDEFINED"));
3967c732 1325 }
1326 if (nest < maxnest && (CvCLONE(sv) || CvCLONED(sv)))
1327 do_sv_dump(level+1, file, (SV*)CvOUTSIDE(sv), nest+1, maxnest, dumpops, pvlim);
1328 break;
1329 case SVt_PVGV:
cea2e8a9 1330 Perl_dump_indent(aTHX_ level, file, " NAME = \"%s\"\n", GvNAME(sv));
57def98f 1331 Perl_dump_indent(aTHX_ level, file, " NAMELEN = %"IVdf"\n", (IV)GvNAMELEN(sv));
3967c732 1332 do_hv_dump (level, file, " GvSTASH", GvSTASH(sv));
57def98f 1333 Perl_dump_indent(aTHX_ level, file, " GP = 0x%"UVxf"\n", PTR2UV(GvGP(sv)));
f472eb5c 1334 if (!GvGP(sv))
1335 break;
57def98f 1336 Perl_dump_indent(aTHX_ level, file, " SV = 0x%"UVxf"\n", PTR2UV(GvSV(sv)));
1337 Perl_dump_indent(aTHX_ level, file, " REFCNT = %"IVdf"\n", (IV)GvREFCNT(sv));
1338 Perl_dump_indent(aTHX_ level, file, " IO = 0x%"UVxf"\n", PTR2UV(GvIOp(sv)));
1339 Perl_dump_indent(aTHX_ level, file, " FORM = 0x%"UVxf" \n", PTR2UV(GvFORM(sv)));
1340 Perl_dump_indent(aTHX_ level, file, " AV = 0x%"UVxf"\n", PTR2UV(GvAV(sv)));
1341 Perl_dump_indent(aTHX_ level, file, " HV = 0x%"UVxf"\n", PTR2UV(GvHV(sv)));
1342 Perl_dump_indent(aTHX_ level, file, " CV = 0x%"UVxf"\n", PTR2UV(GvCV(sv)));
1343 Perl_dump_indent(aTHX_ level, file, " CVGEN = 0x%"UVxf"\n", (UV)GvCVGEN(sv));
f4c556ac 1344 Perl_dump_indent(aTHX_ level, file, " GPFLAGS = 0x%"UVxf"\n", (UV)GvGPFLAGS(sv));
57def98f 1345 Perl_dump_indent(aTHX_ level, file, " LINE = %"IVdf"\n", (IV)GvLINE(sv));
b195d487 1346 Perl_dump_indent(aTHX_ level, file, " FILE = \"%s\"\n", GvFILE(sv));
e39917cc 1347 Perl_dump_indent(aTHX_ level, file, " FLAGS = 0x%"UVxf"\n", (UV)GvFLAGS(sv));
3967c732 1348 do_gv_dump (level, file, " EGV", GvEGV(sv));
1349 break;
1350 case SVt_PVIO:
57def98f 1351 Perl_dump_indent(aTHX_ level, file, " IFP = 0x%"UVxf"\n", PTR2UV(IoIFP(sv)));
1352 Perl_dump_indent(aTHX_ level, file, " OFP = 0x%"UVxf"\n", PTR2UV(IoOFP(sv)));
1353 Perl_dump_indent(aTHX_ level, file, " DIRP = 0x%"UVxf"\n", PTR2UV(IoDIRP(sv)));
1354 Perl_dump_indent(aTHX_ level, file, " LINES = %"IVdf"\n", (IV)IoLINES(sv));
1355 Perl_dump_indent(aTHX_ level, file, " PAGE = %"IVdf"\n", (IV)IoPAGE(sv));
1356 Perl_dump_indent(aTHX_ level, file, " PAGE_LEN = %"IVdf"\n", (IV)IoPAGE_LEN(sv));
1357 Perl_dump_indent(aTHX_ level, file, " LINES_LEFT = %"IVdf"\n", (IV)IoLINES_LEFT(sv));
27533608 1358 if (IoTOP_NAME(sv))
cea2e8a9 1359 Perl_dump_indent(aTHX_ level, file, " TOP_NAME = \"%s\"\n", IoTOP_NAME(sv));
3967c732 1360 do_gv_dump (level, file, " TOP_GV", IoTOP_GV(sv));
27533608 1361 if (IoFMT_NAME(sv))
cea2e8a9 1362 Perl_dump_indent(aTHX_ level, file, " FMT_NAME = \"%s\"\n", IoFMT_NAME(sv));
3967c732 1363 do_gv_dump (level, file, " FMT_GV", IoFMT_GV(sv));
27533608 1364 if (IoBOTTOM_NAME(sv))
cea2e8a9 1365 Perl_dump_indent(aTHX_ level, file, " BOTTOM_NAME = \"%s\"\n", IoBOTTOM_NAME(sv));
3967c732 1366 do_gv_dump (level, file, " BOTTOM_GV", IoBOTTOM_GV(sv));
57def98f 1367 Perl_dump_indent(aTHX_ level, file, " SUBPROCESS = %"IVdf"\n", (IV)IoSUBPROCESS(sv));
27533608 1368 if (isPRINT(IoTYPE(sv)))
cea2e8a9 1369 Perl_dump_indent(aTHX_ level, file, " TYPE = '%c'\n", IoTYPE(sv));
27533608 1370 else
cea2e8a9 1371 Perl_dump_indent(aTHX_ level, file, " TYPE = '\\%o'\n", IoTYPE(sv));
57def98f 1372 Perl_dump_indent(aTHX_ level, file, " FLAGS = 0x%"UVxf"\n", (UV)IoFLAGS(sv));
3967c732 1373 break;
1374 }
cea89e20 1375 SvREFCNT_dec(d);
3967c732 1376}
1377
1378void
864dbfa3 1379Perl_sv_dump(pTHX_ SV *sv)
3967c732 1380{
1381 do_sv_dump(0, Perl_debug_log, sv, 0, 0, 0, 0);
8d063cd8 1382}