The cflow command presents a list of the functions
and function calls within a program. This list can be helpful
when debugging a program, especially if there are external references.
The information displayed by cflow indicates
the source filename and the line number of the function,
and lists additional functions
that are in turn called by that function.
To see a list of the functions
called within testcase.c,
we can run cflow:
1 main: int (), <testcase.c 76>
2 gets: <>
3 GetWords: int (), <testcase.c 43>
4 strlen: <>
5 PrintWords: void (), <testcase.c 21>
6 printf: <>
Output is displayed in the following fields:
In analyzing the output, we see that
the function main is the first function called by
testcase.c and is defined on line 76 as shown
in the angle brackets (<>).
Notice the function main returns a type int and
it calls the functions gets, GetWords, and
PrintWords. The <>
next to the gets function are empty because
cflow only looks in the source file to resolve
function call references. The gets function is
not in the source code (testcase.c)
and, therefore, cflow
does not have any information on it.
The function main calls two additional functions, GetWords
and PrintWords. Both of these functions are
found in the source file and, therefore, their locations are displayed.
The two additional functions, strlen and printf,
called respectively from GetWords and PrintWords,
do not exist within testcase.c; hence, no line
number information is available for them.
the number of the line in the output
the level at which the symbol is defined
the name of the symbol under consideration followed by a colon
the type of the symbol and the arguments to the symbol, if any
the name of the file and the number of the line
within the file in which the symbol is defined
As a result of analyzing testcase.c with cflow,
we now know the names of all of the functions referenced in the source
file and the location of their definitions in the source file.
If we need to change any of them, they should be easy to find.
For a larger more complex program, you
can make decisions on where best to optimize code, either by
reducing the number of function calls or by identifying
obsolete functions and removing them.
For more information on using cflow, see
© 2003 Caldera International, Inc. All rights reserved.
SCO OpenServer Release 5.0.7 -- 11 February 2003