Browsing through your code with cscope

How cscope works

When you invoke cscope for a set of C, lex, or yacc source files, it builds a symbol cross-reference table for the functions, function calls, macros, variables, and preprocessor symbols in those files. It then lets you query that table about the locations of symbols you specify. First, it presents a menu and asks you to choose the type of search you would like to have performed. You may, for instance, want cscope to find all functions that call a specified function.

When cscope has completed this search, it prints a list. Each list entry contains the name of the file, the number of the line, and the text of the line in which cscope has found the specified code. In this example, the list will also include the names of the functions that call the specified function. If you choose the latter, cscope invokes the editor for the file in which the line appears, with the cursor on that line. You may now view the code in context and edit the file as you would any other file. You can then return to the menu from the editor to request a new search.

Because of the procedure you follow there is no single set of instructions for using cscope. For an extended example of its use, review the cscope session described in ``How to use cscope'' It shows how you can locate a bug in a program without learning all the code.

Next topic: How to use cscope
Previous topic: Browsing through your code with cscope

© 2004 The SCO Group, Inc. All rights reserved.
UnixWare 7 Release 7.1.4 - 27 April 2004