On Sat, 2005-02-26 at 20:28 -0600, Curran, Dominic wrote: > Hi > > Trying to do something very simple and failing miserably... > > I want to dump out the amount of stack size I have left at different > points in my LKM driver. as a debugging aid I assume > In order to do this I believe I need to know the value of 'current' and > 'esp'. Just copy the following code into yours (your module is gpl so that you can copy such things I assume): 58 #ifdef CONFIG_DEBUG_STACKOVERFLOW 59 /* Debugging check for stack overflow: is there less than 1KB free? */ 60 { 61 long esp; 62 63 __asm__ __volatile__("andl %%esp,%0" : 64 "=r" (esp) : "" (THREAD_SIZE - 1)); 65 if (unlikely(esp < (sizeof(struct thread_info) + STACK_WARN))) { 66 printk("do_IRQ: stack overflow: %ld\n", 67 esp - sizeof(struct thread_info)); 68 dump_stack(); 69 } 70 } 71 #endif -- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/