Tip: use Emacs + Cscope to read the code

Source: Internet
Author: User
Article Title: tip: use Emacs + Cscope to read the code. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.

1. Install cssag,

Http://cscope.sourceforge.net/

Download cscope here. The latest version is 15.6.

If you use debian or ubuntu, run sudo apt-get install cscope.

2. Install xcsloud. el

Put the xcssag. el file attached to cssag under the load-path of your emacs ~ /. Add the following to emacs:

(Require 'xcscope)

3. Generate the project file list. You can run the following command. For example, the kernel code is used to find the. h,. c,. S file.

Find-type f | grep-E '\. [chS] $'> cscope. files

4. Generate the cscope index file.-k is used to generate the index of the linux kernel source code.

Cscope-B-k

5. Run emacs. The following are some commonly used buttons.

C-c s C-h view all cssag-related buttons

C-c s a: directory where the index file is located

C-c s c: Find the place where the function is called

C-c s g to find the global definition of the symbol

C-c s f: Find the file corresponding to the symbol

......

If you are used to the Emacs buttons, it is quite convenient to use them. If you are interested, feel free to use them.

Related Article

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.