CSCOPE is an opensource tool which is used to browse the "C" source code. In very large projects, the source code is spanned across several directories and the code walk to understand a particular code flow becomes very difficult. In such situation, the CSCOPE tool becomes handy.
When CSCOPE is run inside a directory where the source code of the project is present, it will builds up an internal database using the functions, variables, etc of the source code. Then the CSCOPE uses that database to help the users to browse the code.
To start the CSCOPE for a new project, go the project directory where the source C code is present. Execute the command "cscope -R" which will start and build the CSCOPE database. The -R flag will tell the CSCOPE to recursively go through all the sub-directories of the project directory to build the database.
Please find the below screenshot which shows the building of CSCOPE database when we run the "cscope -R" command for the first time.
When CSCOPE is run inside a directory where the source code of the project is present, it will builds up an internal database using the functions, variables, etc of the source code. Then the CSCOPE uses that database to help the users to browse the code.
To start the CSCOPE for a new project, go the project directory where the source C code is present. Execute the command "cscope -R" which will start and build the CSCOPE database. The -R flag will tell the CSCOPE to recursively go through all the sub-directories of the project directory to build the database.
Please find the below screenshot which shows the building of CSCOPE database when we run the "cscope -R" command for the first time.
The CSCOPE window has two section. One is the list of menus at the lower half of the window which can be used to browse the code. The upper half of the window is used to show the results when we browse the code using one of the menus.
As shown in the below screenshot, the search result of the C Symbol "sig_usr" is listed in the upper part of the screen.
Keyboard shortcuts to traverse the code browse options:
Tab
|
|
ctrl+n
|
|
ctrl+p
|
|
ctrl+y
|
|
ctrl+b
|
|
ctrl+f
|
|
ctrl+c
|
|
ctrl+r
|
|
ctrl+l
|
|
ctrl+d
|
Keyboard shortcuts to traverse the search results:
1 - 9
|
|
ctrl+v
|
|
ctrl+e
|
|