Tenth Chapter Experience

Source: Internet
Author: User

Through the tenth chapter, the debugging technology of embedded Linux driver development has been learned.

Knowledge Learned:

First, print kernel debug information: PRINTK

the PRINTK function is prototyped as follows:

asmlinkage int PRINTK (const char * fmt, ...)

The PRINTK file is a simple 4 -digit text file with the following default values:6 4 1 7

6: Output the message to the level of the console.

4: The default message log level.

1: Minimum value that can be set for the console log level

7: Default value for console log level.

Second, prevent PRINTK function to reduce Linux drive performance

1. variable-parameter macros

2.do{...} while (O)

Third, the data interaction through the virtual file system

Proc_mkdir

Name: virtual directory names.

Parent: Proc_dir_entry struct pointerto the parent directory of the virtual directory .

Create_proc_enttry

Name: Virtual file names.

Mode: Access permissions for virtual files

Parent: The proc_dir_entry struct pointer to the parent directory of the virtual file .

Create_proc_read_entty

Name: Virtual file names.

Mode: Access permissions for virtual files

Base: proc_dir_entry struct pointerto the parent directory of the virtual file .

Read_proc: A function pointer that handles read actions.

data: Used for the virtual file system.

Remove_proc_entry

Name: The names of the virtual files to be deleted.

Parent: The proc_dir_entry struct pointer to the parent directory of the virtual file .

Four, Debugging Tools

1. debugging the user-space program with gdb

2. remote debugging of user space programs with gdbserver

3. Remote Debug Kernel program with kgdb

Tenth Chapter Experience

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.