3 * Copyright (c) 1991-1994, 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)
31 GV* gv = curcop->cop_filegv;
33 fprintf(stderr,"(%s:%ld)\t",
34 SvTYPE(gv) == SVt_PVGV ? SvPVX(GvSV(gv)) : "<free>",
35 (long)curcop->cop_line);
36 for (i=0; i<dlevel; i++)
37 fprintf(stderr,"%c%c ",debname[i],debdelim[i]);
38 fprintf(stderr,pat,a1,a2,a3,a4,a5,a6,a7,a8);
41 #else /* !defined(I_STDARG) && !defined(I_VARARGS) */
56 GV* gv = curcop->cop_filegv;
58 fprintf(stderr,"(%s:%ld)\t",
59 SvTYPE(gv) == SVt_PVGV ? SvPVX(GvSV(gv)) : "<free>",
60 (long)curcop->cop_line);
61 for (i=0; i<dlevel; i++)
62 fprintf(stderr,"%c%c ",debname[i],debdelim[i]);
69 (void) vfprintf(stderr,pat,args);
72 #endif /* !defined(I_STDARG) && !defined(I_VARARGS) */
78 Renew(debname, dlmax, char);
79 Renew(debdelim, dlmax, char);
85 fprintf(stderr, "%8lx %8lx %8ld %8ld %8ld\n",
86 (unsigned long)stack, (unsigned long)stack_base,
87 (long)*markstack_ptr, (long)(stack_sp-stack_base),
88 (long)(stack_max-stack_base));
89 fprintf(stderr, "%8lx %8lx %8ld %8ld %8ld\n",
90 (unsigned long)mainstack, (unsigned long)AvARRAY(stack),
91 (long)mainstack, (long)AvFILL(stack), (long)AvMAX(stack));
98 I32 top = stack_sp - stack_base;
99 register I32 i = top - 30;
100 I32 *markscan = markstack;
105 while (++markscan <= markstack_ptr)
109 fprintf(stderr, i ? " => ... " : " => ");
110 if (stack_base[0] != &sv_undef || stack_sp < stack_base)
111 fprintf(stderr, " [STACK UNDERFLOW!!!]\n");
114 if (markscan <= markstack_ptr && *markscan < i) {
119 while (markscan <= markstack_ptr && *markscan < i);
120 fprintf(stderr, " ");
124 fprintf(stderr, "%-4s ", SvPEEK(stack_base[i]));
127 fprintf(stderr, "\n");
131 static int dummy; /* avoid totally empty deb.o file */
132 #endif /* DEBUGGING */