How to debug: Set breakpoints, step through code, and output debugging information.
Print Nehe Debug information: PRINTK. The PRINTK function runs in kernel space, and the PRINTK function runs in user space. Linux kernel programs such as Linux drivers can only use the PRINTK function to output debug information.
asmlinkage int PRINTK (const char *FMT, ...) The first parameter represents a format string followed by a mutable parameter.
Although using the PRINTK function makes it easy to write a slim to a log file or console, a large number of PRINTK functions that frequently manipulate log files or console device files can severely affect the performance of Linux drivers. Prevent PRINTK functions from reducing the performance of Linux drivers
Data interaction through a virtual file system. In Linux file systems,/proc is often used as a tool for data interaction between kernel space and user space. /proc is not a real file system, but rather a mapping of memory. All read and write/proc are read and write to the memory, so reading and writing the/proc file system is much faster than reading/writing the/dev file system. As a result, the/proc file system can also serve as a tool for Linux to interact with user-space programs. There is a lot of system information that is provided to the outside world through the/proc file system by the kernel space program. The/proc file system, like the/dev file system, also needs to set the action handler function that accesses the file.
The tenth chapter: the Debugging technology of embedded Linux