How to use cscope?

I use cscope to get familiar with all the keywords used in socket programming. I went to a directory with c files. I used cscope. and then I searched for AF_INET. I got it:

#define AF_FILE PF_FILE #define AF_INET PF_INET #define AF_AX25 PF_AX25 

It was a full page. I just published part of it. Now I want to know where this PF_INET is from? which command should i use. I saw a guy double-click PF_INEt and use some command to find it. I do not know what this team is? Please help me with this.

Secondly, when I finish the page with the command: q. I come to this page:

 Global definition: AF_INET File Line 0 socket.h 119 #define AF_INET PF_INET Find this C symbol: Find this global definition: Find functions called by this function: Find functions calling this function: Find this text string: Change this text string: Find this egrep pattern: Find this file: Find files #including this file: 

here the cursor blinks to 0. If I want to look for something again, how will I do it? How to get from here. I tried to do this, but could not understand anything from the prisons. Please help me in this regard since I am a complete noob for Linux operating system and programming c. Thanks in advance.

+7
c linux vim cscope
source share
4 answers

I agree that the cscope documentation is not very clear.

Use the tab to go to the interactive part. Enter your character name in "find this C symbol" or "Find this egrep pattern" and confirm with RETURN.

If you want to call it from vim, type :help if_cscop.txt ; hoping this helps!

 :cscope add your_cscope_database :cscope find s [your_symbol] 

This will create a new quick list list. use :cn and :cp to navigate :cnf and :cpf to go from file to file in the results and: :colder and :cnewer to restore previous lists of fast files.

+10
source share

To exit the cscope online help, type Ctrl-d . If you just want to rebuild the cscope database and not invoke the cscope interactive hint, pass the -b option to it. I usually call cscope as cscope -bcqR .

As for jumping into vim with cscope, it really depends on your vim configuration.

Most likely, going to the tag ( Ctrl-] ) will first use cscope, then ctags (see :help cst and :help csto ). Use Ctrl-T to return.

There are several useful mappings for cscope that you can find by typing :help cscope-suggestions in vim. After adding these mappings to your .vimrc, you can go to the characters with Ctrl-_ s , calling the functions with Ctrl-_ c , etc.

You can access the vim cscope documentation by typing :help cscope .

+11
source share

I mainly use the following. They are very understandable for understanding cscope.

  • "cscope -R" Then you get the options.
  • Click the down arrow. Then you will go to the desired parameter. Enter everything you want according to the corresponding option.
  • From the search result. Use the arrows (up and down), then press enter key to view the detailed file.
  • ": q" to exit the file.
  • Press "Tab key" to go to the cscope options.
  • "ctrl + d" to exit cscope.
+2
source share
+1
source share

All Articles