SourceForge Logo

CSCOPECscope

Updated 2012-08-04 (15.8a Released) - downloads

SourceForge Project Page is here


Introduction
Cscope
Cscope is a developer's tool for browsing source code. It has an impeccable Unix pedigree, having been originally developed at Bell Labs back in the days of the PDP-11. Cscope was part of the official AT&T Unix distribution for many years, and has been used to manage projects involving 20 million lines of code!

In April, 2000, thanks to the Santa Cruz Operation, Inc. (SCO) (since merged with Caldera), the code for Cscope was open sourced under the BSD license.

  
Features
Cscope
  • Allows searching code for:
  • all references to a symbol
  • global definitions
  • functions called by a function
  • functions calling a function
  • text string
  • regular expression pattern
  • a file
  • files including a file
  • Curses based (text screen)
  • An information database is generated for faster searches and later reference
  • The fuzzy parser supports C, but is flexible enough to be useful for C++ and Java, and for use as a generalized 'grep database' (use it to browse large text documents!)
  • Has a command line mode for inclusion in scripts or as a backend to a GUI/frontend
  • Runs on all flavors of Unix, plus most monopoly-controlled operating systems.


Further documentation is available at the cscope man page


Screen shot of cscope in action:

C symbol: atoi

  File     Function     Line
  0 stdlib.h <global>      86 extern int atoi (const char *nptr);
  1 dir.c    makefilelist 336 dispcomponents = atoi(s);
  2 invlib.c invdump      793 j = atoi(term + 1);
  3 invlib.c invdump      804 j = atoi(term + 1);
  4 main.c   main         287 dispcomponents = atoi(s);
  5 main.c   main         500 dispcomponents = atoi(s);
  6 stdlib.h atoi         309 int atoi (const char *nptr) __THROW



  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:
  
Tutorials

Using Cscope on large projects (example: the Linux kernel)

Using Cscope with Vim

Using Cscope with Vim --- translated to Chinese (external link)

  
Vi Support
Cscope support is built into Vim (so long as it is compiled with the '--enable-cscope' option--this is the case for most binary distributions). The Vim interface, and a set of key mappings you may find useful, is documented in our Vim/Cscope Tutorial.

The Berkeley Vi editor (nvi) also works with cscope.

  
XEmacs/Emacs Support
Cscope
The XEmacs interface to cscope (which also works with GNU Emacs) is located in the subdirectory, cscope/contrib/xcscope/.
  • An automatic, hierarchical, search path mechanism exists, for locating cscope index files. If a database isn't found in the current directory, the interface will automatically search parent directories for index files.
  • In addition to your basic (normal) cscope setup, the XEmacs interface is also designed to support LARGE projects. Files which are indexed can be spread out over multiple directories, and these directories do NOT have to share a common root directory. Also, cscope index files can be shared amongst users. This is very useful for group software development.
  • Multiple cscope index files can be searched. Unlike plain cscope, you're not limited to searching only one database.
  • When searching multiple database (index) files, results can be returned from either the first database that contains matches, or all databases that contain matches. This is very useful when you have a local (partial) source tree, yet want to be able to search both your local tree and your project's full source tree.
  • Cscope is integrated into the C, C++, and dired modes. Pull-down and pop-up menus exist, as well as normal key bindings.
  • Cscope databases can be built using menu picks. There's also a menu pick for controlling the list of files to index.
  • You can have cscope index files using absolute or relative paths (absolute paths are useful for shared cscope databases).
  • Options can be set/reset from the pull-down and pop-up menus.

The source files contain all the installation and usage info you need to get started.

(Please contact Darryl Okahata for any queries regarding the XEmacs support.)

  
DOS/Windows Support
 
Cscope Cscope requires use of the (traditionally Unix-only) curses screen-drawing library, so some form of curses support is needed to run it on DOS or Windows.

Our download files include a zip file that contains a Cscope binary compiled with DJGPP (an open source compiler for DOS that has a fast native curses library). This binary should work on any version of Windows (3.1, 95, NT, 2000) or DOS. Note that it won't be able to see long filenames on NT4, and may show all kinds of strange bugs on 2000 and XP, which the DJGPP team is still working to resolve.

Windows NT and 2000 users also have the option of running Cscope under the CygWin toolkit, which provides a curses emulation library (among other goodies). Once Cygwin are installed on your system, you can compile and run Cscope just as if you were on a normal operating system (i.e. Unix).

  
Downloads
 

If you experience problems with the latest release version, please try the latest top of tree code. If that doesn't work, please check our bug database, and add a new bug report if you don't see your problem listed.

Latest release: 15.8a (previous versions available at same link)

CVSROOT contents tarball updated at the end of each day (WARNING: is not very straightforward to use --- it's easier to just use anonymous CVS in most cases).

  
Contact/Credits
Cscope
  
Change Log
  • (08/04/2012) 15.8a Release. Bug fixes and a few new features
  • (06/15/2012) 15.8 Release. Bug fixes and a few new features
  • (10/09/2009) 15.7a Release. Bug fixes (some security related)
  • (09/30/2006) 15.6 Release. Bug fixes (some security related)
  • (09/08/2003) 15.5 Release. Bug fixes, egrep.y now Bison compatible
  • (08/15/2002) 15.4 Release. Mainly bug fixes.
  • (07/02/2001) 15.3 Release. Improvements, major bug fixes, XEmacs, Vim and web interface support.
  • (11/22/2000) 15.1 Release. Improvements to interface and major bug fixes
  • (05/15/2000) 15.0bl2 (beta release)
  • (04/18/2000) 13.0 First Open Source Release. Initial Linux port
  
GUI Front-ends
Cscope

Cbrowser is an excellent GUI front-end written by Chris Felaco. It is available for cscope, as well as cs. It is now available on sourceforge.net. It can be downloaded from http://cbrowser.sourceforge.net

KScope is a great new GUI frontend for cscope based on the KDE environment.