Source insight tutorial 1

Source: Internet
Author: User
Document directory
  •  

As an open-source operating system, the source code library attached to Linux gives fans the opportunity to study and study extensively. In particular, the Linux kernel organization is extremely complex. At the same time, like a program on the Windows platform, you can use the integrated development environment to check the variables and functions, or even set breakpoints, single-step running, debugging, and other means to figure out the entire program's organizational structure, this makes it especially difficult to read the Linux kernel source code.

Of course, the vim and Emacs editing programs in Linux do not provide functions such as variable, function search, and color display program statements. Their functions are very powerful. For example, VIM and Emacs respectively embed a tag program called CTAG and etag. By configuring these two programs, you can also implement powerful function variable search functions, however, due to its complicated configuration, the relevant information attached to Linux is not very detailed. Even if a tag library is set up, the code color display function should be implemented, further configuration is still needed (in another article, I will describe how to configure these features). At the same time, for most enthusiasts, you may not be familiar with the powerful commands and shortcut keys of vim and Emacs.

To facilitate the study of the Linux source program, we may wish to go back to the Windows environment we are familiar with, which is also a "teacher to long Yi to make Yi. However, on the window platform, some common integrated development environments are used, and the results are not very satisfactory. For example, it is difficult to add all files, and the search speed is slow, functions other than Windows cannot be displayed in color. So I finally found a powerful source code editor by searching on the Internet. Its excellent performance greatly reduced the difficulty of learning the Linux kernel source code. This is source insight3.0, it is a sharing software on the Windows platform. It can download 30-day packages from http://www.sourceinsight.com. Because the source
Insight is an application software on the Windows platform. Therefore, you must first obtain the source code of the Program on the Linux system to the Windows platform, this can be achieved by copying files under the/usr/src directory to a partition on the Windows platform on the Linux platform, or directly copying files from the online CD to a partition on the Windows platform.

The following describes how to use source insight. Considering that the enthusiasts who read the source program have a considerable level of software usage, this article only introduces some of the trivial and well-known details, so that you can quickly use the software and reduce the process of exploration.

Install source insight and start the program. You can go to figure 1. There are several noteworthy items on the toolbar. The project button on the left side of the Inner Concave is used to display the project window. The button on the right will display a window, provides the call diagrams of other functions in the function body where the cursor is located. By clicking those functions in the form, you can enter the place where the function is located.


Because source insight is essentially an editor that supports multiple development languages (Java, C, C ++, and so on), it only has powerful functions such as searching, locating, and color display, it is used as a source code reading tool. Therefore, to effectively read the source program, you must first select the "project" option sub-menu "new project" on the function menu to create a new project. The project name can be freely selected, you can also choose to delete a project. When a project is deleted, the project auxiliary files generated by the software are not deleted. After setting, a dialog box 2 is displayed. Accept the default selection. If the disk space is sufficient, select the first check box, this option requires roughly the same space as the source code to create a local database to speed up searching.

Because source insight is essentially an editor that supports multiple development languages (Java, C, C ++, and so on), it only has powerful functions such as searching, locating, and color display, it is used as a source code reading tool. Therefore, to effectively read the source program, you must first select the "project" option sub-menu "new project" on the function menu to create a new project. The project name can be freely selected, you can also choose to delete a project. When a project is deleted, the project auxiliary files generated by the software are not deleted. After setting, a dialog box 2 is displayed. Accept the default selection. If the disk space is sufficient, select the first check box, this option requires roughly the same space as the source code to create a local database to speed up searching.

Figure 2 engineering settings

Click the "OK" button, and then click "OK ". enter the name of the source code file, click the "add" button to add it. You can also add all the files in the selected directory to the project through the "add all" and "add Tree" buttons, the "add all" option will prompt you to add the top-level file and recursively add all files. The "add Tree" is equivalent to the recursion of the "add all" option to add all files, you can use it as needed. For me, I prefer "add ".
Tree. Because this program uses part of the file opening method, unused files will not be opened, so you do not have to worry about joining thousands of files beyond the maximum allowed by the program, I added the Four thousand five hundred and ninety-one files in the linux2.4 kernel using the "add Tree" method.

Figure 3 add a file

After adding the file, click a file to display the user interface, as shown in Figure 4. the window on the right (Linux project, that is, the project window) all files in the current project are listed alphabetically by default.

Figure 4 work window

Click a file to open the file, as shown in Figure 5. In the window to the right, all files can be listed in the file list, with a row of buttons Under each form, the windows (21142.c) on the left are as follows: all tags are listed alphabetically, marked sequentially by the number of rows in the file, marked by type, viewed locally, and marked window properties. The windows (Linux project) on the right are as follows: file list in alphabetical order, display folder, classify files by file type, all mark lists of all files, mark by TAG type, jump to definition, display tag information, browse project tag, search for function calls and engineering properties, all the tag list options of all files may take some time to extract tags and synchronize them to the database. If you choose to create a tag database, the synchronization time will be saved in the future, the most useful method is browsing Tag Information and searching for function calls. The former can use the "jump" button to find the same tag in different places, you can also use the "Reference" button in combination with the latter to perform global tag search.

The reference feature is one of the characteristics of source insight. It can find all the tags in the project at extremely fast speeds and add a small red arrow button link to the front of the program. Figure 6 is the result of a reference search. It can be displayed in two modes, one is to show the results in a centralized manner. Figure 6 shows this mode. In this mode, you can use the red arrow button on the front to enter another mode. You can also click the Red Arrow to enter the mode where the tag is located, you can also use the two red arrows on the toolbar to move forward and backward in the second mode to view the corresponding information. Its powerful function makes reading the Linux source program as a godlike. However, when the second "Reference" is performed, it prompts you to append the result set to the end of the first result set or replace the first result set. If the former is selected, the result set cannot be classified based on the two search results before and after, and then moved in its subclass. It can only be moved in the entire result set. If the latter is selected, the result set will be replaced with the result of the second search, which is slightly inconvenient.

Figure 6 search results of reference

Of course, source insight also provides some other common conveniences. For example, the right-click menu contains almost all the functions of the program. You can add a row number to the program in the editing window and count the number of program lines in the project, of course, there are also powerful functions that cannot be automatically completed, and it seems that even its 30-day trial period is also ulterior motives-can force you to read the source program as quickly as possible, you can explore other tips during use. How is it? A friend who is interested in reading Source Code may wish to download one right away to start our Linux kernel adventure.

As an open-source operating system, the source code library attached to Linux gives fans the opportunity to study and study extensively. In particular, the Linux kernel organization is extremely complex. At the same time, like a program on the Windows platform, you can use the integrated development environment to check the variables and functions, or even set breakpoints, single-step running, debugging, and other means to figure out the entire program's organizational structure, this makes it especially difficult to read the Linux kernel source code.

Of course, the vim and Emacs editing programs in Linux do not provide functions such as variable, function search, and color display program statements. Their functions are very powerful. For example, VIM and Emacs respectively embed a tag program called CTAG and etag. By configuring these two programs, you can also implement powerful function variable search functions, however, due to its complicated configuration, the relevant information attached to Linux is not very detailed. Even if a tag library is set up, the code color display function should be implemented, further configuration is still needed (in another article, I will describe how to configure these features). At the same time, for most enthusiasts, you may not be familiar with the powerful commands and shortcut keys of vim and Emacs.

To facilitate the study of the Linux source program, we may wish to go back to the Windows environment we are familiar with, which is also a "teacher to long Yi to make Yi. However, on the window platform, some common integrated development environments are used, and the results are not very satisfactory. For example, it is difficult to add all files, and the search speed is slow, functions other than Windows cannot be displayed in color. So I finally found a powerful source code editor by searching on the Internet. Its excellent performance greatly reduced the difficulty of learning the Linux kernel source code. This is source insight3.0, it is a sharing software on the Windows platform. It can download 30-day packages from http://www.sourceinsight.com. Because the source
Insight is an application software on the Windows platform. Therefore, you must first obtain the source code of the Program on the Linux system to the Windows platform, this can be achieved by copying files under the/usr/src directory to a partition on the Windows platform on the Linux platform, or directly copying files from the online CD to a partition on the Windows platform.

The following describes how to use source insight. Considering that the enthusiasts who read the source program have a considerable level of software usage, this article only introduces some of the trivial and well-known details, so that you can quickly use the software and reduce the process of exploration.

Install source insight and start the program. You can go to figure 1. There are several noteworthy items on the toolbar. The project button on the left side of the Inner Concave is used to display the project window. The button on the right will display a window, provides the call diagrams of other functions in the function body where the cursor is located. By clicking those functions in the form, you can enter the place where the function is located.


Because source insight is essentially an editor that supports multiple development languages (Java, C, C ++, and so on), it only has powerful functions such as searching, locating, and color display, it is used as a source code reading tool. Therefore, to effectively read the source program, you must first select the "project" option sub-menu "new project" on the function menu to create a new project. The project name can be freely selected, you can also choose to delete a project. When a project is deleted, the project auxiliary files generated by the software are not deleted. After setting, a dialog box 2 is displayed. Accept the default selection. If the disk space is sufficient, select the first check box, this option requires roughly the same space as the source code to create a local database to speed up searching.

Because source insight is essentially an editor that supports multiple development languages (Java, C, C ++, and so on), it only has powerful functions such as searching, locating, and color display, it is used as a source code reading tool. Therefore, to effectively read the source program, you must first select the "project" option sub-menu "new project" on the function menu to create a new project. The project name can be freely selected, you can also choose to delete a project. When a project is deleted, the project auxiliary files generated by the software are not deleted. After setting, a dialog box 2 is displayed. Accept the default selection. If the disk space is sufficient, select the first check box, this option requires roughly the same space as the source code to create a local database to speed up searching.

Figure 2 engineering settings

Click the "OK" button, and then click "OK ". enter the name of the source code file, click the "add" button to add it. You can also add all the files in the selected directory to the project through the "add all" and "add Tree" buttons, the "add all" option will prompt you to add the top-level file and recursively add all files. The "add Tree" is equivalent to the recursion of the "add all" option to add all files, you can use it as needed. For me, I prefer "add ".
Tree. Because this program uses part of the file opening method, unused files will not be opened, so you do not have to worry about joining thousands of files beyond the maximum allowed by the program, I added the Four thousand five hundred and ninety-one files in the linux2.4 kernel using the "add Tree" method.

Figure 3 add a file

After adding the file, click a file to display the user interface, as shown in Figure 4. the window on the right (Linux project, that is, the project window) all files in the current project are listed alphabetically by default.

Figure 4 work window

Click a file to open the file, as shown in Figure 5. In the window to the right, all files can be listed in the file list, with a row of buttons Under each form, the windows (21142.c) on the left are as follows: all tags are listed alphabetically, marked sequentially by the number of rows in the file, marked by type, viewed locally, and marked window properties. The windows (Linux project) on the right are as follows: file list in alphabetical order, display folder, classify files by file type, all mark lists of all files, mark by TAG type, jump to definition, display tag information, browse project tag, search for function calls and engineering properties, all the tag list options of all files may take some time to extract tags and synchronize them to the database. If you choose to create a tag database, the synchronization time will be saved in the future, the most useful method is browsing Tag Information and searching for function calls. The former can use the "jump" button to find the same tag in different places, you can also use the "Reference" button in combination with the latter to perform global tag search.

The reference feature is one of the characteristics of source insight. It can find all the tags in the project at extremely fast speeds and add a small red arrow button link to the front of the program. Figure 6 is the result of a reference search. It can be displayed in two modes, one is to show the results in a centralized manner. Figure 6 shows this mode. In this mode, you can use the red arrow button on the front to enter another mode. You can also click the Red Arrow to enter the mode where the tag is located, you can also use the two red arrows on the toolbar to move forward and backward in the second mode to view the corresponding information. Its powerful function makes reading the Linux source program as a godlike. However, when the second "Reference" is performed, it prompts you to append the result set to the end of the first result set or replace the first result set. If the former is selected, the result set cannot be classified based on the two search results before and after, and then moved in its subclass. It can only be moved in the entire result set. If the latter is selected, the result set will be replaced with the result of the second search, which is slightly inconvenient.

Figure 6 search results of reference

Of course, source insight also provides some other common conveniences. For example, the right-click menu contains almost all the functions of the program. You can add a row number to the program in the editing window and count the number of program lines in the project, of course, there are also powerful functions that cannot be automatically completed, and it seems that even its 30-day trial period is also ulterior motives-can force you to read the source program as quickly as possible, you can explore other tips during use. How is it? A friend who is interested in reading Source Code may wish to download one right away to start our Linux kernel adventure.

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.