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
19 #if defined(PERL_IMPLICIT_CONTEXT)
21 Perl_deb_nocontext(const char *pat, ...)
29 #endif /* DEBUGGING */
34 Perl_deb(pTHX_ const char *pat, ...)
41 #endif /* DEBUGGING */
45 Perl_vdeb(pTHX_ const char *pat, va_list *args)
50 GV* gv = PL_curcop->cop_filegv;
53 PerlIO_printf(Perl_debug_log, "0x%lx (%s:%ld)\t",
55 SvTYPE(gv) == SVt_PVGV ? SvPVX(GvSV(gv)) : "<free>",
56 (long)PL_curcop->cop_line);
58 PerlIO_printf(Perl_debug_log, "(%s:%ld)\t",
59 SvTYPE(gv) == SVt_PVGV ? SvPVX(GvSV(gv)) : "<free>",
60 (long)PL_curcop->cop_line);
61 #endif /* USE_THREADS */
62 for (i=0; i<PL_dlevel; i++)
63 PerlIO_printf(Perl_debug_log, "%c%c ",PL_debname[i],PL_debdelim[i]);
64 (void) PerlIO_vprintf(Perl_debug_log, pat, *args);
65 #endif /* DEBUGGING */
69 Perl_deb_growlevel(pTHX)
73 Renew(PL_debname, PL_dlmax, char);
74 Renew(PL_debdelim, PL_dlmax, char);
75 #endif /* DEBUGGING */
79 Perl_debstackptrs(pTHX)
83 PerlIO_printf(Perl_debug_log, "%8lx %8lx %8ld %8ld %8ld\n",
84 (unsigned long)PL_curstack, (unsigned long)PL_stack_base,
85 (long)*PL_markstack_ptr, (long)(PL_stack_sp-PL_stack_base),
86 (long)(PL_stack_max-PL_stack_base));
87 PerlIO_printf(Perl_debug_log, "%8lx %8lx %8ld %8ld %8ld\n",
88 (unsigned long)PL_mainstack, (unsigned long)AvARRAY(PL_curstack),
89 (long)PL_mainstack, (long)AvFILLp(PL_curstack), (long)AvMAX(PL_curstack));
90 #endif /* DEBUGGING */
99 I32 top = PL_stack_sp - PL_stack_base;
100 register I32 i = top - 30;
101 I32 *markscan = PL_curstackinfo->si_markbase;
106 while (++markscan <= PL_markstack_ptr)
111 PerlIO_printf(Perl_debug_log, i ? "0x%lx => ... " : "0x%lx => ",
112 (unsigned long) thr);
114 PerlIO_printf(Perl_debug_log, i ? " => ... " : " => ");
115 #endif /* USE_THREADS */
116 if (PL_stack_base[0] != &PL_sv_undef || PL_stack_sp < PL_stack_base)
117 PerlIO_printf(Perl_debug_log, " [STACK UNDERFLOW!!!]\n");
120 if (markscan <= PL_markstack_ptr && *markscan < i) {
123 PerlIO_putc(Perl_debug_log, '*');
125 while (markscan <= PL_markstack_ptr && *markscan < i);
126 PerlIO_printf(Perl_debug_log, " ");
130 PerlIO_printf(Perl_debug_log, "%-4s ", SvPEEK(PL_stack_base[i]));
133 PerlIO_printf(Perl_debug_log, "\n");
134 #endif /* DEBUGGING */