Top Qs
Timeline
Chat
Perspective

Cscope

Text-based programming tool that allows for searching source code written in C From Wikipedia, the free encyclopedia

Cscope
Remove ads

Cscope is a programming tool developed in the 1980s which uses a text-based user interface that allows computer programmers or software developers to search source code of the programming language C. It is often used on very large projects to aid code comprehension to find source code, functions, declarations, definitions, and regular expressions. As of 2000, cscope is free and released under a BSD license. The original developer of cscope is Joe Steffen.

Quick facts Stable release, Written in ...
Remove ads

History

Summarize
Perspective

Joe Steffen began writing cscope in the early 1980s, as an aid to his programming work on a PDP-11. The tool became very popular within Bell Labs, as fellow employees requested more features and improvements, and was used on some large projects with as many as a million lines of source code.[2]

The tool was later made part of the AT&T Unix distribution. That distribution then went through several ownership changes: to Unix System Laboratories, then Novell, then The Santa Cruz Operation (SCO).[2]

Cscope itself is implemented in C.[2] The text interface is built on top of curses.[3] Cscope is well-integrated with vim and Emacs.[3]

In April 2000, SCO announced that it was contributing cscope to open source under a BSD license, while still maintaining it. The move came as SCO was staging several initiatives in the open source and Linux space,[4] even as it was competition from those spaces that would soon lead to SCO's demise.[5]

Petr Sorfa, a software engineer at SCO, became the maintainer of cscope and did the work for the first open source release of it, including porting it to the GNU gcc environment.[6] Sorfa subsequently continued as a maintainer of it, through an association with SourceForge.[7]

Cscope is still used by developers today, some of whom are most accustomed to using vi or other text-based editors, instead of GUI editors. The functions in cscope are available to varying degrees in modern graphical text editors.

Cscope's maintainers later became Hans-Bernhard Bröker and Neil Horman.[8]

The Linux kernel's top-level makefile has a target for building for cscope.[9] Indeed, an O'Reilly Media book about Linux networking published in 2006 recommends use of cscope for browsing the Linux kernel source code.[10] Similarly, a Packt Publishing book about Linux kernel programming published in 2024 has multiple mentions of using cscope in connection with understanding aspects of the kernel source code.[9]

Analysts have also found cscope useful for software audit reviews. According to a 2007 book published by John Wiley & Sons, "Cscope can be invaluable for auditing and is used by many security researchers on a regular basis."[3]

Remove ads

Usage

Summarize
Perspective

Cscope is used in two phases. First, a developer builds the cscope database of the source code. 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. An index must be rebuilt whenever changes are made to indexed files.[11]

The menus within the cscope user interface allows the developer to search for functions, variables, and preprocessor directives including macros.[12]

There are a number of other options to the cscope command that can tailor its behavior.[12] The cscope database file is known for sometimes becoming large and requiring sufficient disk space.[10]

As created, cscope was created to search content within C code, but it can also be used (with some caveats) for C++ and Java code.[8] Cscope can also process lex and yacc files.[12]

While cscope normally runs on Unix and Linux systems, it has also been built in a version for Microsoft Windows.[3]

Remove ads

Derived software

  • KScope runs on KDE and integrates the Kate text editor. The KScope project is no longer being maintained.[13]
  • Seascope runs on PyQt4 and integrates the Scintilla text editor.[14]
  • Gscope is based on GTK2 and GTK3 and integrates with multiple text editors.[15]
  • CCTree is a native Vim plugin that integrates with the Vim editor and offers functions similar to KScope and Seascope.[16]
  • Csope is a fork with an altered TUI.[17]

See also

References

Loading related searches...

Wikiwand - on

Seamless Wikipedia browsing. On steroids.

Remove ads