Open pr_debug of fixed files

Source: Internet
Author: User

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.