[Contents]   [Back]   [Prev]   [Up]   [Next]   [Forward]  


2. Command line GLOBAL

You can use tag facilities from shell command line. It is a big merit of GLOBAL compared with any other tag system.

2.1 Preparation.

First of all, you must execute gtags(1)(see section 5.2 gtags - create tag files for global.) at the root of source tree. For example, if you want to browse vi's source code:


    $ cd /usr/src/usr.bin/vi
    $ gtags

Gtags traverse subdirectories and makes four databases at the root of the source tree.


    $ ls G*
    GPATH   GRTAGS  GSYMS   GTAGS

2.2 Basic usage.

Consider the following source tree:


    ROOT/           <- the root of source tree (GTAGS,GRTAGS,...)
    |
    |- DIR1/
    |  |
    |  |- fileA.c   .....   +---------------+
    |  |                    |main(){        |
    |  |                    |       func1();|
    |  |                    |       func2();|
    |  |                    |}              |
    |  |                    +---------------+
    |  |
    |  |- fileB.c   .....   +---------------+
    |                       |func1(){ ... } |
    |                       +---------------+
    |- DIR2/
       |
       |- fileC.c   .....   +---------------+
                            |#ifdef X       |
                            |func2(){ i++; }|
                            |#else          |
                            |func2(){ i--; }|
                            |#endif         |
                            |func3(){       |
                            |       func1();|
                            |}              |
                            +---------------+

2.3 Applied usage.

You can make multiple tag files. For example, you can execute gtags at ROOT/, version1.0/ and version2.0/.


    ROOT/                   <- the root of source tree      (GTAGS,...)
    |
    |- version1.0/          <- the root of version1.0       (GTAGS,...)
    |  |
    |  |- file.c    .....   +---------------+
    |                       |func1(){ i++; }|
    |                       +---------------+
    |
    |- version2.0/          <- the root of version2.0       (GTAGS,...)
       |
       |- file.c    .....   +---------------+
                            |func1(){ i--; }|
                            +---------------+

There is another usage of GTAGSROOT.


[Contents]   [Back]   [Prev]   [Up]   [Next]   [Forward]