Read the experience of "Embedded Linux debugging Technology"

Source: Internet
Author: User

1 for complex Linux drivers and libraries such as HAL, it is necessary to debug them using a variety of methods. Examples include setting breakpoints, stepping through code, outputting debugging information, and so on.

2 Print kernel debug information:printk, this function is similar to printf usage, but PRINTK runs in kernel space and printf runs in user space.

The 3PRINTK file is a simple text file with 4 numbers, default value:6 4 1 7

4 using the printk function heavily reduces Linux Drive performance. To facilitate the control of the output of the PRINTK function, it is best to take advantage of the compiler directives in the C language (#if, #else ,#endif)

The 5 printk function displays the message in the console (terminal) through the /dev/console device file. The device file only works under the console of the character interface. So only the console in the character interface can output messages normally.

6 Data interaction through a virtual file system (/proc). /proc is a virtual file system, a memory map, and a bookstore that reads and writes /proc file systems is much faster than reading/writing/ dev file systems.

7 The Read and write of a Linux file is determined by the properties, which can be represented in octal.

8 Delete the virtual directory from the virtual directory before deleting it.

9 Introduction of 2 Debugging Tools, you can trace the code of the program line by row

(1) using gdb,gdbserver can debug user space program

(2) remote debugging kernel space program with Kgdb

My blog Address
http://www.cnblogs.com/zhanghui4521/

Read the experience of "Embedded Linux debugging Technology"

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.