Drive common debugging method

Debugging log has a crucial position, equivalent to the doctor's CT report. Start log to become familiar with the various stages, such as PBL stage, sbl1 stage, kernel stage, android stage for the positioning of the analysis plays an important role.
Log output Android core
Android Linxu kernel kernel is based therefore it is common to log mechanism performed using the output printk Log Android kernel function. And c language similar to printf, printk provide formatted input function, at the same time, it also has the characteristics of all LOG mechanisms - to provide the log level misplaced functions. printk provides 8 log level (defined in detail include / linux / kern_levels.h) is:
The simplest use of rintk:
// KERN_WARNING indicates log level, followed by a string to be formatted bear behind.

Printk formatted output with the use of:

output in the case of connecting kernel adb print information
Android system, log information is stored in the output printk / proc / kmsg, to view the / proc / kmsg content,
the kernel parameter is used to control whether there is a character string printed printk output to the console (screen or / sys / log / syslog log file)

cat / proc / sys / kernel / printk6 4 July 1

6 shows a first level higher than (less than) message will be output to the console 6, the second message 4 indicating that no specified level (macro) the message if the call printk level 4, the third one represents received the highest (minimum) level is 1, the first initial value when the original 6 7 shows a fourth system startup is 7.

So, if you find that point of view in the console output less than some printk in your program, use the echo 8> / proc / sys / kernel / printk to resolve.

#define MTS_NAME "microtek usb (rev " MTS_VERSION "): "
#define MTS_WARNING(x…)
printk( KERN_WARNING MTS_NAME x )

Guess you like

Origin blog.csdn.net/qq_42894864/article/details/104072923
Recommended