world leader in high performance signal processing
Trace: » cscope_and_tags
Table of Contents

Cscope and Tags

Cscope is a developer's tool for browsing source code. Cscope and tags can be a particularly useful tools to wade into a large code base like the Linux kernel. You can save yourself a lot of time by being able to do fast, targeted searches rather than randomly grepping through the source files by hand.

Cscope

Cscope has an long 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, including the Linux kernel.

Cscope is:

  • 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

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

To learn how to use Cscope look at the man page. The Linux kernel has a support for cscope build in

rgetz@imhotep:~/uClinux-dist/linux-2.6.x> make cscope
  FILELST cscope.files
  MAKE    cscope.out
rgetz@imhotep:~/uClinux-dist/linux-2.6.x> cscope

Tags

Ctags also generates an index (or tag) file of language objects found in source files that allows these items to be quickly and easily located by a text editor or other utility. A tag signifies a language object for which an index entry is available (or, alternatively, the index entry created for that object).

It is capable of generating tags for all types of C/C++ language tags, including all of the following:

  • class names
  • macro definitions
  • enumeration names
  • enumerators
  • function definitions
  • function prototypes/declarations
  • class, interface, struct, and union data members
  • structure names
  • typedefs
  • union names
  • variables (definitions and external declarations)

Complete Table of Contents/Topics