9 /* hack for pic32 gcc */
20 static volatile int live_check_disable=0;
22 void live_check(const char *file,int line,int alloc)
24 static volatile char *top=NULL,*top_printed=NULL;
25 static volatile size_t largest=0,largest_printed=0;
27 volatile char *will=&mark-(alloc==-1 ? 0 : alloc);
31 if (live_check_disable<=0 && top!=top_printed) {
32 printf("live_check [%s:%d]: new top=0x%08lX\n",file,line,(long)top);
36 if (largest < top-will)
38 if (live_check_disable<=0 && largest!=largest_printed) {
39 printf("live_check [%s:%d]: largest=%ld\n",file,line,(long)largest);
41 largest_printed=largest;
43 if (largest >= STACKCHECK) {
44 if (live_check_disable<=0)
45 printf("live_check - aborting: limit=%d < largest=%ld!\n",STACKCHECK,(long)largest);
50 void live_disable(int how)
52 live_check_disable+=how;
55 #define STACKCHECK_HEADER_PC_OFFSET 16
59 volatile static inside=0;
61 volatile int fp_alloc;
63 asm("movel %%d0,%0" : "=r" (fp_alloc) : /* input */ : "d0");
64 asm("movel %%sp@,%0" : "=r" (func) : /* input */);
70 if (live_check_disable<=0)
71 printf("mcount(func=0x%08lX,fp_alloc=%d)\n",((long)func)-STACKCHECK_HEADER_PC_OFFSET,-fp_alloc);
73 LIVE_ALLOC((-fp_alloc)+4);
74 #endif /* LIVE_ALLOC */
79 #endif /* STACKCHECK */