9 /* hack for pic32 gcc */
18 static volatile int live_check_disable=0;
20 void live_check(const char *file,int line,int alloc)
22 static volatile char *top=NULL,*top_printed=NULL;
23 static volatile size_t largest=0,largest_printed=0;
25 volatile char *will=&mark-(alloc==-1 ? 0 : alloc);
29 if (live_check_disable<=0 && top!=top_printed) {
30 printf("live_check [%s:%d]: new top=0x%08lX\n",file,line,(long)top);
34 if (largest < top-will)
36 if (live_check_disable<=0 && largest!=largest_printed) {
37 printf("live_check [%s:%d]: largest=%ld\n",file,line,(long)largest);
39 largest_printed=largest;
41 if (largest >= STACKCHECK) {
42 if (live_check_disable<=0)
43 printf("live_check - aborting: limit=%d < largest=%ld!\n",STACKCHECK,(long)largest);
48 void live_disable(int how)
50 live_check_disable+=how;
53 #define STACKCHECK_HEADER_PC_OFFSET 16
58 volatile int fp_alloc;
60 asm("movel %%d0,%0" : "=r" (fp_alloc) : /* input */ : "d0");
61 asm("movel %%sp@,%0" : "=r" (func) : /* input */);
63 if (live_check_disable<=0)
64 printf("mcount(func=0x%08lX,fp_alloc=%d)\n",((long)func)-STACKCHECK_HEADER_PC_OFFSET,-fp_alloc);
66 LIVE_ALLOC((-fp_alloc)+4);
67 #endif /* LIVE_ALLOC */
70 #endif /* STACKCHECK */