DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 
Using programming tools

Using cxref

The cxref tool produces a list of all functions and symbols (auto, static and global) that can be used as a cross-reference table for large or complex programs. cxref is more informative than cflow because not only are the function calls that exist within the source file displayed, with line numbers, but all external function calls also have that information. To see a list of the function calls and symbol references used by testcase.c, run cxref:

   cxref testcase.c
The output is displayed in the following format:
   testcase.c:
   NAME            FILE          FUNCTION        LINE
   BUFFERSIZE      testcase.c    ---                9*   12    77 
   BUFSIZ          stdio.h       ---               67*
   EOF             stdio.h       ---               56*
   FILENAME_MAX    stdio.h       ---               81*
   FOPEN_MAX       stdio.h       ---               74*
   GetWords        testcase.c    ---               43*   86 
   IGNORE          testcase.c    ---                7*   47    54    63 
   L_ctermid       stdio.h       ---               97*
   L_cuserid       stdio.h       ---               98*
   L_tmpnam        stdio.h       ---              105*
   M_I386          predefined    ---                0*
   M_UNIX          predefined    ---                0*
   M_XENIX         predefined    ---                0*
   NULL            stdio.h       ---               52*
                   string.h      ---               34 
                   testcase.c    ---               85 
   P_tmpdir        stdio.h       ---              100*
   PrintWords      testcase.c    ---               21*   87 
   SCO_DS          predefined    ---                0*
   SEEK_CUR        stdio.h       ---               60*
   SEEK_END        stdio.h       ---               61*
   SEEK_SET        stdio.h       ---               59*
   TMP_MAX         stdio.h       ---               64*
   WORD            testcase.c    ---                6*   57    60 
   WordCount       testcase.c    ---               13*   86=   87 
   Words           testcase.c    ---               12*   25    31    56=
   _A              ctype.h       ---               43*
   _B              ctype.h       ---               36*
   .
   .
   .
   wscanf          stdio.h       ---              262-
The first column lists the name of the symbol. The second column lists the name of the file(s) in which the symbol appears. The third column lists the name of the function in which the symbol appears, and the fourth column provides the line number within the file in which the symbol appears.

To illustrate, let's examine the symbol BUFFERSIZE in the cxref output. The first entry names the symbol, BUFFERSIZE, and the file where it is declared, indicated by an asterisk (*) next to the line number. The second entry indicates its first use in testcase denoted by only a line number. The third and final entry for BUFFERSIZE indicates its use in the function main of testcase.c on line 77.

The listing produced by cxref is helpful when debugging a large complex program. Using the cxref output, external function calls can be tracked down with ease. For more information, see cxref(CP).


Next topic: Archiving changes made during the analysis
Previous topic: Using cflow

© 2003 Caldera International, Inc. All rights reserved.
SCO OpenServer Release 5.0.7 -- 11 February 2003