3 * Copyright (c) 1991-1999, 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.
11 * "Didst thou think that the eyes of the White Tower were blind? Nay, I
12 * have seen more than thou knowest, Gray Fool." --Denethor
20 Perl_deb(pTHX_ const char *pat, ...)
26 GV* gv = PL_curcop->cop_filegv;
29 PerlIO_printf(Perl_debug_log, "0x%lx (%s:%ld)\t",
31 SvTYPE(gv) == SVt_PVGV ? SvPVX(GvSV(gv)) : "<free>",
32 (long)PL_curcop->cop_line);
34 PerlIO_printf(Perl_debug_log, "(%s:%ld)\t",
35 SvTYPE(gv) == SVt_PVGV ? SvPVX(GvSV(gv)) : "<free>",
36 (long)PL_curcop->cop_line);
37 #endif /* USE_THREADS */
38 for (i=0; i<PL_dlevel; i++)
39 PerlIO_printf(Perl_debug_log, "%c%c ",PL_debname[i],PL_debdelim[i]);
42 (void) PerlIO_vprintf(Perl_debug_log,pat,args);
44 #endif /* DEBUGGING */
48 Perl_deb_growlevel(pTHX)
52 Renew(PL_debname, PL_dlmax, char);
53 Renew(PL_debdelim, PL_dlmax, char);
54 #endif /* DEBUGGING */
58 Perl_debstackptrs(pTHX)
62 PerlIO_printf(Perl_debug_log, "%8lx %8lx %8ld %8ld %8ld\n",
63 (unsigned long)PL_curstack, (unsigned long)PL_stack_base,
64 (long)*PL_markstack_ptr, (long)(PL_stack_sp-PL_stack_base),
65 (long)(PL_stack_max-PL_stack_base));
66 PerlIO_printf(Perl_debug_log, "%8lx %8lx %8ld %8ld %8ld\n",
67 (unsigned long)PL_mainstack, (unsigned long)AvARRAY(PL_curstack),
68 (long)PL_mainstack, (long)AvFILLp(PL_curstack), (long)AvMAX(PL_curstack));
69 #endif /* DEBUGGING */
78 I32 top = PL_stack_sp - PL_stack_base;
79 register I32 i = top - 30;
80 I32 *markscan = PL_curstackinfo->si_markbase;
85 while (++markscan <= PL_markstack_ptr)
90 PerlIO_printf(Perl_debug_log, i ? "0x%lx => ... " : "0x%lx => ",
93 PerlIO_printf(Perl_debug_log, i ? " => ... " : " => ");
94 #endif /* USE_THREADS */
95 if (PL_stack_base[0] != &PL_sv_undef || PL_stack_sp < PL_stack_base)
96 PerlIO_printf(Perl_debug_log, " [STACK UNDERFLOW!!!]\n");
99 if (markscan <= PL_markstack_ptr && *markscan < i) {
102 PerlIO_putc(Perl_debug_log, '*');
104 while (markscan <= PL_markstack_ptr && *markscan < i);
105 PerlIO_printf(Perl_debug_log, " ");
109 PerlIO_printf(Perl_debug_log, "%-4s ", SvPEEK(PL_stack_base[i]));
112 PerlIO_printf(Perl_debug_log, "\n");
113 #endif /* DEBUGGING */