Android Deep Explore--hal and Driver Development Tenth chapter

Source: Internet
Author: User

Embedded Linux debugging technology, for the complex Linux driver and Hal and other libraries, need to use a variety of methods for debugging, such as setting breakpoints, gradually tracking code, output debugging information. This chapter focuses on how to debug embedded Linux kernel modules, executables, and shared libraries using the Development Board, Android emulator, and some functions and tools.

The use of the PRINTK function is similar to the printf function except that the PRINTK function runs in kernel space and the printf function runs in user space. In other words, Linux kernel programs like Linux drivers can only output debugging information using the PRINTK function. The PRINTK function is implemented in the Printk.c file. The PRINTK file is a simple 4-digit text file with 4 numbers meaning the following:

6: Output messages to the console level, only output information above that level can be output to the console.

4: The default message log level, which is used as the default level if the log level is not set at the PRINTK function.

1: The minimum value that can be set for the console log level.

7: Console level level default value.

In Linux file systems,/proc is often used as a tool for data interaction between kernel space and user space. The/proc file system behaves in a similar manner to the device file system (/dev). /proc is a virtual file system, which means that/proc is not a real file system, but a memory map. All read-write/PROC operations are read-write to memory. Therefore, reading and writing/proc file systems is much faster than reading/writing/dev file systems. As a result, the/proc file system can also serve as a tool for Linux to interact with user-space programs.

Linux kernel debugging has been considered to be very difficult, most people will generally directly use the PEINTK function output debugging, do not want to use a variety of commands to debug, because this may not be able to replace more benefits.

Android Deep Explore--hal and Driver Development Tenth chapter

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.