By learning Android Deep Exploration (Volume one) HAL and Driver Development chapter Tenth let me know the debugging technology and debugging tools for embedded Linux.
PRINTK can print kernel debugging information, the function is similar to the printf function, except that the PRINTK function runs in kernel space, and the printf function runs in user space. The PRINTK file is a simple four-digit text file with a default value of: 6: Output The message to the console level, 4: The default message log level, 1: The minimum value that can be set for the console log level, and 7: The default value for the console log level. All messages sent through the PRINTK function are output to the log file, regardless of the message level.
A large number of PRINTK functions frequently operating log files or console device files can seriously affect the performance of Linux drivers, to control the output of the PRINTK function, and the implementation is very convenient, the best way is undoubtedly the use of C language compiler instructions.
In the Linux file system,/proc is often used as a tool for data interaction between the kernel space and user space, it is not a real filesystem, but a memory map, and all read and write/proc operations are read and write to the memory, so reading and writing/proc file system is much faster than read/write/ The dev file system is fast.
The Debugging tools are: Debugging the user space program with GDB, debugging the user space program remotely with Gdbserver, and debugging the kernel program remotely with KGDB.
Android Deep Explore (Volume one) HAL and Driver Development chapter tenth