3 * Copyright (c) 1991-2001, Larry Wall
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.
15 * "Away now, Shadowfax! Run, greatheart, run as you have never run before!
16 * Now we are come to the lands where you were foaled, and every stone you
17 * know. Run now! Hope is in speed!" --Gandalf
21 Perl_runops_standard(pTHX)
23 while ((PL_op = CALL_FPTR(PL_op->op_ppaddr)(aTHX))) {
32 Perl_runops_debug(pTHX)
36 if (ckWARN_d(WARN_DEBUGGING))
37 Perl_warner(aTHX_ WARN_DEBUGGING, "NULL OP IN RUN");
44 if (PL_watchaddr != 0 && *PL_watchaddr != PL_watchok)
45 PerlIO_printf(Perl_debug_log,
46 "WARNING: %"UVxf" changed from %"UVxf" to %"UVxf"\n",
47 PTR2UV(PL_watchaddr), PTR2UV(PL_watchok),
48 PTR2UV(*PL_watchaddr));
50 DEBUG_t(debop(PL_op));
51 DEBUG_P(debprof(PL_op));
53 } while ((PL_op = CALL_FPTR(PL_op->op_ppaddr)(aTHX)));
58 return runops_standard();
59 #endif /* DEBUGGING */
63 Perl_debop(pTHX_ OP *o)
66 AV *padlist, *comppad;
70 Perl_deb(aTHX_ "%s", OP_NAME(o));
73 PerlIO_printf(Perl_debug_log, "(%s)", SvPEEK(cSVOPo_sv));
79 gv_fullname3(sv, cGVOPo_gv, Nullch);
80 PerlIO_printf(Perl_debug_log, "(%s)", SvPV(sv, n_a));
84 PerlIO_printf(Perl_debug_log, "(NULL)");
89 /* print the lexical's name */
90 cv = deb_curcv(cxstack_ix);
92 padlist = CvPADLIST(cv);
93 comppad = (AV*)(*av_fetch(padlist, 0, FALSE));
94 sv = *av_fetch(comppad, o->op_targ, FALSE);
98 PerlIO_printf(Perl_debug_log, "(%s)", SvPV_nolen(sv));
100 PerlIO_printf(Perl_debug_log, "[%"UVuf"]", (UV)o->op_targ);
105 PerlIO_printf(Perl_debug_log, "\n");
106 #endif /* DEBUGGING */
113 S_deb_curcv(pTHX_ I32 ix)
115 PERL_CONTEXT *cx = &cxstack[ix];
116 if (CxTYPE(cx) == CXt_SUB || CxTYPE(cx) == CXt_FORMAT)
117 return cx->blk_sub.cv;
118 else if (CxTYPE(cx) == CXt_EVAL && !CxTRYBLOCK(cx))
120 else if (ix == 0 && PL_curstackinfo->si_type == PERLSI_MAIN)
125 return deb_curcv(ix - 1);
128 #endif /* DEBUGGING */
131 Perl_watch(pTHX_ char **addr)
136 PerlIO_printf(Perl_debug_log, "WATCHING, %"UVxf" is currently %"UVxf"\n",
137 PTR2UV(PL_watchaddr), PTR2UV(PL_watchok));
138 #endif /* DEBUGGING */
144 S_debprof(pTHX_ OP *o)
147 Newz(000, PL_profiledata, MAXO, U32);
148 ++PL_profiledata[o->op_type];
151 #endif /* DEBUGGING */
154 Perl_debprofdump(pTHX)
160 for (i = 0; i < MAXO; i++) {
161 if (PL_profiledata[i])
162 PerlIO_printf(Perl_debug_log,
163 "%5lu %s\n", (unsigned long)PL_profiledata[i],
166 #endif /* DEBUGGING */