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 #if !defined(I_STDARG) && !defined(I_VARARGS)
22 * Fallback on the old hackers way of doing varargs
27 deb(pat,a1,a2,a3,a4,a5,a6,a7,a8)
32 GV* gv = curcop->cop_filegv;
35 PerlIO_printf(Perl_debug_log,"0x%lx (%s:%ld)\t",
37 SvTYPE(gv) == SVt_PVGV ? SvPVX(GvSV(gv)) : "<free>",
38 (long)curcop->cop_line);
40 PerlIO_printf(Perl_debug_log, "(%s:%ld)\t",
41 SvTYPE(gv) == SVt_PVGV ? SvPVX(GvSV(gv)) : "<free>",
42 (long)curcop->cop_line);
43 #endif /* USE_THREADS */
44 for (i=0; i<dlevel; i++)
45 PerlIO_printf(Perl_debug_log, "%c%c ",debname[i],debdelim[i]);
46 PerlIO_printf(Perl_debug_log, pat,a1,a2,a3,a4,a5,a6,a7,a8);
49 #else /* !defined(I_STDARG) && !defined(I_VARARGS) */
53 deb(const char *pat, ...)
65 GV* gv = curcop->cop_filegv;
68 PerlIO_printf(Perl_debug_log, "0x%lx (%s:%ld)\t",
70 SvTYPE(gv) == SVt_PVGV ? SvPVX(GvSV(gv)) : "<free>",
71 (long)curcop->cop_line);
73 PerlIO_printf(Perl_debug_log, "(%s:%ld)\t",
74 SvTYPE(gv) == SVt_PVGV ? SvPVX(GvSV(gv)) : "<free>",
75 (long)curcop->cop_line);
76 #endif /* USE_THREADS */
77 for (i=0; i<dlevel; i++)
78 PerlIO_printf(Perl_debug_log, "%c%c ",debname[i],debdelim[i]);
85 (void) PerlIO_vprintf(Perl_debug_log,pat,args);
88 #endif /* !defined(I_STDARG) && !defined(I_VARARGS) */
94 Renew(debname, dlmax, char);
95 Renew(debdelim, dlmax, char);
102 PerlIO_printf(Perl_debug_log, "%8lx %8lx %8ld %8ld %8ld\n",
103 (unsigned long)curstack, (unsigned long)stack_base,
104 (long)*markstack_ptr, (long)(stack_sp-stack_base),
105 (long)(stack_max-stack_base));
106 PerlIO_printf(Perl_debug_log, "%8lx %8lx %8ld %8ld %8ld\n",
107 (unsigned long)mainstack, (unsigned long)AvARRAY(curstack),
108 (long)mainstack, (long)AvFILLp(curstack), (long)AvMAX(curstack));
116 I32 top = stack_sp - stack_base;
117 register I32 i = top - 30;
118 I32 *markscan = markstack;
123 while (++markscan <= markstack_ptr)
128 PerlIO_printf(Perl_debug_log, i ? "0x%lx => ... " : "0x%lx => ",
129 (unsigned long) thr);
131 PerlIO_printf(Perl_debug_log, i ? " => ... " : " => ");
132 #endif /* USE_THREADS */
133 if (stack_base[0] != &sv_undef || stack_sp < stack_base)
134 PerlIO_printf(Perl_debug_log, " [STACK UNDERFLOW!!!]\n");
137 if (markscan <= markstack_ptr && *markscan < i) {
140 PerlIO_putc(Perl_debug_log, '*');
142 while (markscan <= markstack_ptr && *markscan < i);
143 PerlIO_printf(Perl_debug_log, " ");
147 PerlIO_printf(Perl_debug_log, "%-4s ", SvPEEK(stack_base[i]));
150 PerlIO_printf(Perl_debug_log, "\n");
154 static int dummy; /* avoid totally empty deb.o file */
155 #endif /* DEBUGGING */