From: Nicholas Clark Date: Sat, 15 Apr 2006 22:44:30 +0000 (+0000) Subject: Teach Perl_do_sv_dump how to cope with IOs that have bogus things in X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=9ba1f5657a950811acc3c9f990446c958b14c2a1;p=p5sagit%2Fp5-mst-13.2.git Teach Perl_do_sv_dump how to cope with IOs that have bogus things in GV slots. (Which source filters are prone to do to them). p4raw-id: //depot/perl@27827 --- diff --git a/dump.c b/dump.c index c8406a1..7081662 100644 --- a/dump.c +++ b/dump.c @@ -1638,13 +1638,36 @@ Perl_do_sv_dump(pTHX_ I32 level, PerlIO *file, SV *sv, I32 nest, I32 maxnest, bo Perl_dump_indent(aTHX_ level, file, " LINES_LEFT = %"IVdf"\n", (IV)IoLINES_LEFT(sv)); if (IoTOP_NAME(sv)) Perl_dump_indent(aTHX_ level, file, " TOP_NAME = \"%s\"\n", IoTOP_NAME(sv)); - do_gv_dump (level, file, " TOP_GV", IoTOP_GV(sv)); + if (!IoTOP_GV(sv) || SvTYPE(IoTOP_GV(sv)) == SVt_PVGV) + do_gv_dump (level, file, " TOP_GV", IoTOP_GV(sv)); + else { + Perl_dump_indent(aTHX_ level, file, " TOP_GV = 0x%"UVxf"\n", + PTR2UV(IoTOP_GV(sv))); + do_sv_dump (level+1, file, (SV *) IoTOP_GV(sv), nest+1, maxnest, + dumpops, pvlim); + } + /* Source filters hide things that are not GVs in these three, so let's + be careful out there. */ if (IoFMT_NAME(sv)) Perl_dump_indent(aTHX_ level, file, " FMT_NAME = \"%s\"\n", IoFMT_NAME(sv)); - do_gv_dump (level, file, " FMT_GV", IoFMT_GV(sv)); + if (!IoFMT_GV(sv) || SvTYPE(IoFMT_GV(sv)) == SVt_PVGV) + do_gv_dump (level, file, " FMT_GV", IoFMT_GV(sv)); + else { + Perl_dump_indent(aTHX_ level, file, " FMT_GV = 0x%"UVxf"\n", + PTR2UV(IoFMT_GV(sv))); + do_sv_dump (level+1, file, (SV *) IoFMT_GV(sv), nest+1, maxnest, + dumpops, pvlim); + } if (IoBOTTOM_NAME(sv)) Perl_dump_indent(aTHX_ level, file, " BOTTOM_NAME = \"%s\"\n", IoBOTTOM_NAME(sv)); - do_gv_dump (level, file, " BOTTOM_GV", IoBOTTOM_GV(sv)); + if (!IoBOTTOM_GV(sv) || SvTYPE(IoBOTTOM_GV(sv)) == SVt_PVGV) + do_gv_dump (level, file, " BOTTOM_GV", IoBOTTOM_GV(sv)); + else { + Perl_dump_indent(aTHX_ level, file, " BOTTOM_GV = 0x%"UVxf"\n", + PTR2UV(IoBOTTOM_GV(sv))); + do_sv_dump (level+1, file, (SV *) IoBOTTOM_GV(sv), nest+1, maxnest, + dumpops, pvlim); + } Perl_dump_indent(aTHX_ level, file, " SUBPROCESS = %"IVdf"\n", (IV)IoSUBPROCESS(sv)); if (isPRINT(IoTYPE(sv))) Perl_dump_indent(aTHX_ level, file, " TYPE = '%c'\n", IoTYPE(sv));