标签:macros tde bug his cas stderr and debugging pre
Add macros in header files:
1 #undef PDEBUG /* undef it, just in case */ 2 #ifdef SCULL_DEBUG 3 # ifdef __KERNEL__ 4 /* This one if debugging is on, and kernel space */ 5 # define PDEBUG(fmt, args...) printk( KERN_DEBUG "scull: " fmt, ## args) 6 # else 7 /* This one for user space */ 8 # define PDEBUG(fmt, args...) fprintf(stderr, fmt, ## args) 9 # endif 10 #else 11 # define PDEBUG(fmt, args...) /* not debugging: nothing */ 12 #endif 13 #undef PDEBUGG 14 #define PDEBUGG(fmt, args...) /* nothing: it‘s a placeholder */
Add following lines to makefile:
1 # Comment/uncomment the following line to disable/enable debugging 2 DEBUG = y 3 # Add your debugging flag (or not) to CFLAGS 4 ifeq ($(DEBUG),y) 5 DEBFLAGS = -O -g -DSCULL_DEBUG # "-O" is needed to expand inlines 6 else 7 DEBFLAGS = -O2 8 endif 9 CFLAGS += $(DEBFLAGS)
标签:macros tde bug his cas stderr and debugging pre
原文地址:http://www.cnblogs.com/adera/p/6296888.html