This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Teach dump.c:debop about CV refs in stashes
authorFather Chrysostomos <sprout@cpan.org>
Thu, 18 Sep 2014 06:50:58 +0000 (23:50 -0700)
committerFather Chrysostomos <sprout@cpan.org>
Thu, 18 Sep 2014 06:50:58 +0000 (23:50 -0700)
This is what -Dt was giving:

$ ./miniperl -Dt -e 'sub foo{} &foo'

EXECUTING...

(-e:0)enter
(-e:0)nextstate
(-e:1)pushmark
(-e:1)gvAssertion failed: (isGV_with_GP(_gvstash)), function Perl_gv_fullname4, file gv.c, line 2341.
Abort trap: 6

dump.c

diff --git a/dump.c b/dump.c
index 3dff2f2..1d2f095 100644 (file)
--- a/dump.c
+++ b/dump.c
@@ -2261,12 +2261,20 @@ Perl_debop(pTHX_ const OP *o)
        break;
     case OP_GVSV:
     case OP_GV:
-       if (cGVOPo_gv) {
+       if (cGVOPo_gv && isGV(cGVOPo_gv)) {
            SV * const sv = newSV(0);
            gv_fullname3(sv, cGVOPo_gv, NULL);
            PerlIO_printf(Perl_debug_log, "(%s)", SvPV_nolen_const(sv));
            SvREFCNT_dec_NN(sv);
        }
+       else if (cGVOPo_gv) {
+           SV * const sv = newSV(0);
+           assert(SvROK(cGVOPo_gv));
+           assert(SvTYPE(SvRV(cGVOPo_gv)) == SVt_PVCV);
+           PerlIO_printf(Perl_debug_log, "(cv ref: %s)",
+                     SvPV_nolen_const(cv_name((CV *)SvRV(cGVOPo_gv),sv)));
+           SvREFCNT_dec_NN(sv);
+       }
        else
            PerlIO_printf(Perl_debug_log, "(NULL)");
        break;