3 * Copyright (c) 1991-1997, 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
19 deb(const char *pat, ...)
25 GV* gv = PL_curcop->cop_filegv;
28 PerlIO_printf(Perl_debug_log, "0x%lx (%s:%ld)\t",
30 SvTYPE(gv) == SVt_PVGV ? SvPVX(GvSV(gv)) : "<free>",
31 (long)curcop->cop_line);
33 PerlIO_printf(Perl_debug_log, "(%s:%ld)\t",
34 SvTYPE(gv) == SVt_PVGV ? SvPVX(GvSV(gv)) : "<free>",
35 (long)PL_curcop->cop_line);
36 #endif /* USE_THREADS */
37 for (i=0; i<PL_dlevel; i++)
38 PerlIO_printf(Perl_debug_log, "%c%c ",PL_debname[i],PL_debdelim[i]);
41 (void) PerlIO_vprintf(Perl_debug_log,pat,args);
43 #endif /* DEBUGGING */
51 Renew(PL_debname, PL_dlmax, char);
52 Renew(PL_debdelim, PL_dlmax, char);
53 #endif /* DEBUGGING */
61 PerlIO_printf(Perl_debug_log, "%8lx %8lx %8ld %8ld %8ld\n",
62 (unsigned long)PL_curstack, (unsigned long)PL_stack_base,
63 (long)*PL_markstack_ptr, (long)(PL_stack_sp-PL_stack_base),
64 (long)(PL_stack_max-PL_stack_base));
65 PerlIO_printf(Perl_debug_log, "%8lx %8lx %8ld %8ld %8ld\n",
66 (unsigned long)PL_mainstack, (unsigned long)AvARRAY(PL_curstack),
67 (long)PL_mainstack, (long)AvFILLp(PL_curstack), (long)AvMAX(PL_curstack));
68 #endif /* DEBUGGING */
77 I32 top = PL_stack_sp - PL_stack_base;
78 register I32 i = top - 30;
79 I32 *markscan = PL_curstackinfo->si_markbase;
84 while (++markscan <= PL_markstack_ptr)
89 PerlIO_printf(Perl_debug_log, i ? "0x%lx => ... " : "0x%lx => ",
92 PerlIO_printf(Perl_debug_log, i ? " => ... " : " => ");
93 #endif /* USE_THREADS */
94 if (PL_stack_base[0] != &PL_sv_undef || PL_stack_sp < PL_stack_base)
95 PerlIO_printf(Perl_debug_log, " [STACK UNDERFLOW!!!]\n");
98 if (markscan <= PL_markstack_ptr && *markscan < i) {
101 PerlIO_putc(Perl_debug_log, '*');
103 while (markscan <= PL_markstack_ptr && *markscan < i);
104 PerlIO_printf(Perl_debug_log, " ");
108 PerlIO_printf(Perl_debug_log, "%-4s ", SvPEEK(PL_stack_base[i]));
111 PerlIO_printf(Perl_debug_log, "\n");
112 #endif /* DEBUGGING */