debug

 vi ./include/linux/debug_if.h

#ifndef __DEBUG_IF_H__
#define __DEBUG_IF_H__


#define _SDEBUG_OUT_ENABLE_            1
#define _SDEBUG_DETAIL_                1


#if _SDEBUG_OUT_ENABLE_ == 1
extern int printk(const char *fmt,...);


#define PLINE   printk("\r\n[yy]<%s:%s:%d> enter_now", __FILE__, __func__, __LINE__)


#define TRACE_yy(fmt, ...)    printk("\r\n[yy]<%s:%s:%d>" fmt, __FILE__, __func__, __LINE__, ##__VA_ARGS__)


//#define   debug(fmt,...)       printk(KERN_ERR fmt)




#else
#define PLINE
#define TRACE_yy(fmt, ...)


#endif /* _SDEBUG_OUT_ENABLE_ */


#endif /* __DEBUG_IF_H__ */






====================

//#define my_DEBUG
#undef PDEBUG             /* undef it, just in case */
#ifdef my_DEBUG
#ifdef __KERNEL__
     /* This one if debugging is on, and kernel space */
#define myDEBUG(fmt, args...) printk( KERN_EMERG "my: " fmt, ## args)
#else
     /* This one for user space */
#define myDEBUG(fmt, args...) fprintf(stderr, fmt, ## args)
#endif
#else
#define myDEBUG(fmt, args...) /* not debugging: nothing */
#endif

~

你可能感兴趣的:(debug)