Open pr_debug of fixed files
In the driver, pr_debug is defined in kernel/include/linux/printk. h.
/* If you are writing a driver, please usedev_dbg instead */
# If defined (CONFIG_DYNAMIC_DEBUG)
/* Dynamic_pr_debug () uses pr_fmt () internally so we don't need it here */
# Define pr_debug (fmt ,...)\
Dynamic_pr_debug (fmt, ##__ VA_ARGS __)
# Elif defined (DEBUG)
# Define pr_debug (fmt ,...)\
Printk (kern_debuupl_fmt (fmt), ##__ VA_ARGS __)
# Else
# Define pr_debug (fmt ,...)\
No_printk (kern_debuupl_fmt (fmt), ##__ VA_ARGS __)
# Endif
Add ccflag + y = -- ddebug to the makefile file.
Or dedicated macro control
Ccflag + $ (CONFIG_AUDIO_CODEC) = -- DDEBUG
All logs can be opened, but too many logs may cause system analysis inconvenience for multiple android files. To facilitate opening the log of the required module, I need to re-define in the file where the log needs to be opened.
#ifdef pr_debug#undef pr_debug#define pr_debug(fmt, ...) \printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)#else#define pr_debug(fmt, ...) \printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)#endif
In this way, the corresponding log in the source code can be debugged easily, avoiding the workload of opening one by one.