*** ./op.c.orig	Tue Nov 25 07:11:14 1997
--- ./op.c	Mon Dec  8 03:04:34 1997
***************
*** 3466,3472 ****
  	    ENTER;
  	    SAVESPTR(compiling.cop_filegv);
  	    SAVEI16(compiling.cop_line);
- 	    SAVEI32(perldb);
  	    save_svref(&rs);
  	    sv_setsv(rs, nrs);
  
--- 3466,3471 ----
*** ./cop.h~	Tue Nov 25 06:46:00 1997
--- ./cop.h	Tue Dec  9 00:20:02 1997
***************
*** 285,287 ****
--- 285,288 ----
  #define G_EVAL		4	/* Assume eval {} around subroutine call. */
  #define G_NOARGS	8	/* Don't construct a @_ array. */
  #define G_KEEPERR      16	/* Append errors to $@, don't overwrite it */
+ #define G_NODEBUG      32	/* Disable debugging at toplevel.  */
*** ./perl.c~	Tue Nov 25 07:57:32 1997
--- ./perl.c	Tue Dec  9 00:21:00 1997
***************
*** 1186,1192 ****
  	  && (DBcv || (DBcv = GvCV(DBsub)))
  	   /* Try harder, since this may have been a sighandler, thus
  	    * curstash may be meaningless. */
! 	  && (SvTYPE(sv) != SVt_PVCV || CvSTASH((CV*)sv) != debstash))
  	op->op_private |= OPpENTERSUB_DB;
  
      if (flags & G_EVAL) {
--- 1186,1193 ----
  	  && (DBcv || (DBcv = GvCV(DBsub)))
  	   /* Try harder, since this may have been a sighandler, thus
  	    * curstash may be meaningless. */
! 	  && (SvTYPE(sv) != SVt_PVCV || CvSTASH((CV*)sv) != debstash)
! 	  && !(flags & G_NODEBUG))
  	op->op_private |= OPpENTERSUB_DB;
  
      if (flags & G_EVAL) {
*** ./pp_ctl.c.ini	Tue Nov 25 09:45:12 1997
--- ./pp_ctl.c	Wed Dec 10 02:55:28 1997
***************
*** 1869,1882 ****
  			mark++;
  		    }
  		}
! 		if (PERLDB_SUB && curstash != debstash) {
  		    /*
  		     * We do not care about using sv to call CV;
  		     * it's for informational purposes only.
  		     */
  		    SV *sv = GvSV(DBsub);
! 		    save_item(sv);
! 		    gv_efullname3(sv, CvGV(cv), Nullch);
  		}
  		RETURNOP(CvSTART(cv));
  	    }
--- 1869,1894 ----
  			mark++;
  		    }
  		}
! 		if (PERLDB_SUB) {	/* Checking curstash breaks DProf. */
  		    /*
  		     * We do not care about using sv to call CV;
  		     * it's for informational purposes only.
  		     */
  		    SV *sv = GvSV(DBsub);
! 		    CV *gotocv;
! 		    
! 		    if (PERLDB_SUB_NN) {
! 			SvIVX(sv) = (IV)cv; /* Already upgraded, saved */
! 		    } else {
! 			save_item(sv);
! 			gv_efullname3(sv, CvGV(cv), Nullch);
! 		    }
! 		    if (  PERLDB_GOTO
! 			  && (gotocv = perl_get_cv("DB::goto", FALSE)) ) {
! 			PUSHMARK( stack_sp );
! 			perl_call_sv((SV*)gotocv, G_SCALAR | G_NODEBUG);
! 			stack_sp--;
! 		    }
  		}
  		RETURNOP(CvSTART(cv));
  	    }
*** ./perl.h.nodprof	Wed Nov 26 12:40:24 1997
--- ./perl.h	Wed Dec 10 01:33:10 1997
***************
*** 2252,2258 ****
  
  #endif /* OVERLOAD */
  
! #define PERLDB_ALL	0xff
  #define PERLDBf_SUB	0x01		/* Debug sub enter/exit. */
  #define PERLDBf_LINE	0x02		/* Keep line #. */
  #define PERLDBf_NOOPT	0x04		/* Switch off optimizations. */
--- 2252,2258 ----
  
  #endif /* OVERLOAD */
  
! #define PERLDB_ALL	0x3f		/* No _NONAME, _GOTO */
  #define PERLDBf_SUB	0x01		/* Debug sub enter/exit. */
  #define PERLDBf_LINE	0x02		/* Keep line #. */
  #define PERLDBf_NOOPT	0x04		/* Switch off optimizations. */
***************
*** 2260,2265 ****
--- 2260,2267 ----
  					   later inspections.  */
  #define PERLDBf_SUBLINE	0x10		/* Keep subr source lines. */
  #define PERLDBf_SINGLE	0x20		/* Start with single-step on. */
+ #define PERLDBf_NONAME	0x40		/* For _SUB: no name of the subr. */
+ #define PERLDBf_GOTO	0x80		/* Report goto: call DB::goto. */
  
  #define PERLDB_SUB	(perldb && (perldb & PERLDBf_SUB))
  #define PERLDB_LINE	(perldb && (perldb & PERLDBf_LINE))
***************
*** 2267,2272 ****
--- 2269,2276 ----
  #define PERLDB_INTER	(perldb && (perldb & PERLDBf_INTER))
  #define PERLDB_SUBLINE	(perldb && (perldb & PERLDBf_SUBLINE))
  #define PERLDB_SINGLE	(perldb && (perldb & PERLDBf_SINGLE))
+ #define PERLDB_SUB_NN	(perldb && (perldb & (PERLDBf_NONAME)))
+ #define PERLDB_GOTO	(perldb && (perldb & PERLDBf_GOTO))
  
  #ifdef USE_LOCALE_COLLATE
  EXT U32		collation_ix;		/* Collation generation index */
*** ./pp_hot.c.orig	Thu Dec  4 01:00:20 1997
--- ./pp_hot.c	Tue Dec  9 00:17:22 1997
***************
*** 1753,1778 ****
  }
  
  static CV *
! get_db_sub(SV **svp, CV *cv)
  {
      dTHR;
!     SV *oldsv = *svp;
!     GV *gv;
  
!     *svp = GvSV(DBsub);
!     save_item(*svp);
!     gv = CvGV(cv);
!     if ( (CvFLAGS(cv) & (CVf_ANON | CVf_CLONED))
! 	 || strEQ(GvNAME(gv), "END") 
! 	 || ((GvCV(gv) != cv) && /* Could be imported, and old sub redefined. */
! 	     !( (SvTYPE(oldsv) == SVt_PVGV) && (GvCV((GV*)oldsv) == cv)
!     		&& (gv = (GV*)oldsv) ))) {
! 	/* Use GV from the stack as a fallback. */
! 	/* GV is potentially non-unique, or contain different CV. */
! 	sv_setsv(*svp, newRV((SV*)cv));
!     }
!     else {
! 	gv_efullname3(*svp, gv, Nullch);
      }
      cv = GvCV(DBsub);
      if (CvXSUB(cv))
--- 1753,1784 ----
  }
  
  static CV *
! get_db_sub(SV *sv, CV *cv)
  {
      dTHR;
!     SV *dbsv = GvSV(DBsub);
  
!     if (!PERLDB_SUB_NN) {
! 	GV *gv = CvGV(cv);
! 
! 	save_item(dbsv);
! 	if ( (CvFLAGS(cv) & (CVf_ANON | CVf_CLONED))
! 	     || strEQ(GvNAME(gv), "END") 
! 	     || ((GvCV(gv) != cv) && /* Could be imported, and old sub redefined. */
! 		 !( (SvTYPE(sv) == SVt_PVGV) && (GvCV((GV*)sv) == cv)
! 		    && (gv = (GV*)sv) ))) {
! 	    /* Use GV from the stack as a fallback. */
! 	    /* GV is potentially non-unique, or contain different CV. */
! 	    sv_setsv(dbsv, newRV((SV*)cv));
! 	}
! 	else {
! 	    gv_efullname3(dbsv, gv, Nullch);
! 	}
!     } else {
! 	SvUPGRADE(dbsv, SVt_PVIV);
! 	SvIOK_on(dbsv);
! 	SAVEIV(SvIVX(dbsv));
! 	SvIVX(dbsv) = (IV)cv;		/* Do it the quickest way  */
      }
      cv = GvCV(DBsub);
      if (CvXSUB(cv))
***************
*** 1865,1871 ****
  
      gimme = GIMME_V;
      if ((op->op_private & OPpENTERSUB_DB) && GvCV(DBsub) && !CvNODEBUG(cv))
! 	cv = get_db_sub(&sv, cv);
      if (!cv)
  	DIE("No DBsub routine");
  
--- 1871,1877 ----
  
      gimme = GIMME_V;
      if ((op->op_private & OPpENTERSUB_DB) && GvCV(DBsub) && !CvNODEBUG(cv))
! 	cv = get_db_sub(sv, cv);
      if (!cv)
  	DIE("No DBsub routine");
  
