The 10th chapter debugging technology of Embedded Linux
Data interaction through a virtual file system (/PROC)
There are a few things you should know when writing code:
1. The Creat_proc_read_entry function is internally implemented by calling the Creat_proc_entry function. The so-called read-only is through the Creat_proc_read_entry function can specify the function of processing the file read action, and through the mode parameter set the file's read-only property (0944). If you want to change a read-only file to a read-write file, you only need to set the function that handles the file write action, and change the file property to 0666.
2. The read and write of Linux files is determined by attributes. In the program can be expressed in octal, for example, 0666 means octal 666, that is, binary 110110110. If you view the file properties, you will see that the file starts with-rw-rw-rw-. When you set the file property to 0444, the file property is –r-r-r-r--, which indicates read-only.
3. Before deleting a virtual directory, delete the virtual files in the virtual directory.
Issues to be aware of when using Gdb_debug:
Because Gdb_server is an ARM processor-based program debugger (ARM_NONE_LINUX_GNUEABI_GDB), and it is best to use which version of the compiled program, the corresponding version of the debugger is used. Although Gdb_debug is running on the Android emulator, executing the debugger on the Linux terminal is still required to specify Gdb_debug.
Linux kernel debugging has been considered by many people to be very difficult, most people prefer to use the PRINTK function directly output debugging information, but also do not want to use a variety of commands (GDB, gdbserver, KGDB, etc.) for debugging. Because doing so does not necessarily make for more benefits.
Android Deep Exploration with Hal Drive Development (Vol. 1)--tenth chapter essay