This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Fix pp_hot.c:get_db_sub core dump when perl debugger used.
authorMalcolm Beattie <mbeattie@sable.ox.ac.uk>
Thu, 23 Oct 1997 14:00:27 +0000 (14:00 +0000)
committerMalcolm Beattie <mbeattie@sable.ox.ac.uk>
Thu, 23 Oct 1997 14:00:27 +0000 (14:00 +0000)
p4raw-id: //depot/perl@171

pp_hot.c

index bc46cca..f4741a1 100644 (file)
--- a/pp_hot.c
+++ b/pp_hot.c
@@ -1713,16 +1713,16 @@ PP(pp_leavesub)
 }
 
 static CV *
-get_db_sub(sv)
-SV *sv;
+get_db_sub(svp, cv)
+SV **svp;
+CV *cv;
 {
     dTHR;
-    SV *oldsv = sv;
+    SV *oldsv = *svp;
     GV *gv;
-    CV *cv;
 
-    sv = GvSV(DBsub);
-    save_item(sv);
+    *svp = GvSV(DBsub);
+    save_item(*svp);
     gv = CvGV(cv);
     if ( (CvFLAGS(cv) & (CVf_ANON | CVf_CLONED))
         || strEQ(GvNAME(gv), "END") 
@@ -1731,10 +1731,10 @@ SV *sv;
                && (gv = (GV*)oldsv) ))) {
        /* Use GV from the stack as a fallback. */
        /* GV is potentially non-unique, or contain different CV. */
-       sv_setsv(sv, newRV((SV*)cv));
+       sv_setsv(*svp, newRV((SV*)cv));
     }
     else {
-       gv_efullname3(sv, gv, Nullch);
+       gv_efullname3(*svp, gv, Nullch);
     }
     cv = GvCV(DBsub);
     if (CvXSUB(cv))
@@ -1827,7 +1827,7 @@ PP(pp_entersub)
 
     gimme = GIMME_V;
     if ((op->op_private & OPpENTERSUB_DB) && GvCV(DBsub) && !CvNODEBUG(cv))
-       cv = get_db_sub(sv);
+       cv = get_db_sub(&sv, cv);
     if (!cv)
        DIE("No DBsub routine");