cscope

From Wikipedia, the free encyclopedia
cscope
Stable release
15.9 / July 24, 2018; 3 years ago (2018-07-24)[1]
Operating systemUnix, Linux
TypeProgramming tool,
for C, C++, Java
LicenseBSD
Websitecscope.sourceforge.net Edit this on Wikidata

cscope is a programming tool which works in console mode, text-based interface, that allows computer programmers or software developers to search source code of the programming language C, with some support for C++ and Java. It is often used on very large projects to aid code comprehension to find source code, functions, declarations, definitions and regular expressions given a text string. cscope is free and released under a BSD license. The original developer of cscope is Joe Steffen.

History[]

The history of the tool goes back to the days of the PDP-11,[2] but it is still used by developers who are accustomed to using the vi or Vim editor or other text-based editors, instead of editors based on graphical user interfaces (GUI)s. The functions in cscope are available to varying degrees in modern graphical source editors.

Mode of use[]

cscope is used in two phases. First a developer builds the cscope database. The developer can often use find or other Unix tools to get the list of filenames needed to index into a file called cscope.files. The developer then builds a database using the command cscope -b -q -k. The k flag is intended to build a database for an operating system or C library source code. It will not look in /usr/include. Second, the developer can now search those files using the command cscope -d. Often an index must be rebuilt whenever changes are made to files.

In software development it is often very useful to be able to find the callers of a function because this is the way to understand how code works and what other parts of the program expect from a function. cscope can find the callers and callees of functions, but it is not a compiler and it does that by searching the text for keywords. This has the disadvantages that macros and duplicate symbol names can generate an unclear graph. There are other programs that can extract this information by parsing the source code[3] or looking at the generated object files.[4]

cscope was created to search content within C files, but it can also be used (with some limits) for C++ and Java files.[5]

GUI frontends[]

Three graphical user interface (GUI) frontends are available for cscope which ease its use.

  • Kscope runs on KDE and integrates the Kate text editor. The KScope project is no longer being maintained.[6]
  • Seascope runs on PyQt4 and integrates the Scintilla text editor.[7]
  • Gscope is based on GTK2 and GTK3 and integrates with multiple text editors.[8]

CCTree is a native Vim plugin that integrates with the Vim editor and offers functions similar to Kscope and Seascope.[9]

See also[]

References[]

  1. ^ Horman, Neil (24 July 2018). "update configure.in script for 15.9 release". Retrieved 4 October 2018 – via SourceForge.
  2. ^ The History of Cscope
  3. ^ ncc - The new generation C compiler
  4. ^ "CodeViz: A CallGraph Visualiser". Archived from the original on 2007-01-26. Retrieved 2006-12-07.
  5. ^ CScope home page: "The fuzzy parser supports C, but is flexible enough to be useful for C++ and Java[...]"
  6. ^ Kscope homepage
  7. ^ Seascope homepage
  8. ^ Gscope homepage
  9. ^ http://www.vim.org/scripts/script.php?script_id=2368

External links[]

Retrieved from ""