3 * Copyright (c) 1991-2000, 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)
49 char* file = CopFILE(PL_curcop);
52 PerlIO_printf(Perl_debug_log, "0x%"UVxf" (%s:%ld)\t",
54 (file ? file : "<free>"),
55 (long)CopLINE(PL_curcop));
57 PerlIO_printf(Perl_debug_log, "(%s:%ld)\t", (file ? file : "<free>"),
58 (long)CopLINE(PL_curcop));
59 #endif /* USE_THREADS */
60 (void) PerlIO_vprintf(Perl_debug_log, pat, *args);
61 #endif /* DEBUGGING */
65 Perl_debstackptrs(pTHX)
69 PerlIO_printf(Perl_debug_log,
70 "%8"UVxf" %8"UVxf" %8"IVdf" %8"IVdf" %8"IVdf"\n",
71 PTR2UV(PL_curstack), PTR2UV(PL_stack_base),
72 (IV)*PL_markstack_ptr, (IV)(PL_stack_sp-PL_stack_base),
73 (IV)(PL_stack_max-PL_stack_base));
74 PerlIO_printf(Perl_debug_log,
75 "%8"UVxf" %8"UVxf" %8"UVuf" %8"UVuf" %8"UVuf"\n",
76 PTR2UV(PL_mainstack), PTR2UV(AvARRAY(PL_curstack)),
77 PTR2UV(PL_mainstack), PTR2UV(AvFILLp(PL_curstack)),
78 PTR2UV(AvMAX(PL_curstack)));
79 #endif /* DEBUGGING */
88 I32 top = PL_stack_sp - PL_stack_base;
89 register I32 i = top - 30;
90 I32 *markscan = PL_markstack + PL_curstackinfo->si_markoff;
95 while (++markscan <= PL_markstack_ptr)
100 PerlIO_printf(Perl_debug_log,
101 i ? "0x%"UVxf" => ... " : "0x%lx => ",
104 PerlIO_printf(Perl_debug_log, i ? " => ... " : " => ");
105 #endif /* USE_THREADS */
106 if (PL_stack_base[0] != &PL_sv_undef || PL_stack_sp < PL_stack_base)
107 PerlIO_printf(Perl_debug_log, " [STACK UNDERFLOW!!!]\n");
110 if (markscan <= PL_markstack_ptr && *markscan < i) {
113 PerlIO_putc(Perl_debug_log, '*');
115 while (markscan <= PL_markstack_ptr && *markscan < i);
116 PerlIO_printf(Perl_debug_log, " ");
120 PerlIO_printf(Perl_debug_log, "%-4s ", SvPEEK(PL_stack_base[i]));
123 PerlIO_printf(Perl_debug_log, "\n");
124 #endif /* DEBUGGING */