CALLS(1u) UNIX System V (UNSUP) CALLS(1u)
NAME
calls - print out calling pattern of a C program
SYNOPSIS
calls [-aehirotTvVx] [-D name[=def]] [-f function] [-F
function[/file.c]] [-I dir] [-l depth] [-U name] [-w width]
[filenames]
DESCRIPTION
Calls analyzes the flow of a C program by laying out the
functions in one of two hierarchical graphs. Calls invokes
the C preprocessor on the named C source files, and prints
the analyzed calling graph on standard output. All
filenames given will have their calling sequences combined
into one graph. A filename of - is taken as standard input
(listed in the graph as stdin).
Functions called but not defined within the source file are
shown as:
function
While functions defined in the source files are listed with
the file they are declared in brackets, as shown:
function [main.c(1009)] , or
function [static in main.c(527)]
or if the function is not being described
function [see also %d] , or
function [see below]
function
Recursive references are shown as:
function <<< recursive >>>
or, if the function is called only by itself, as:
function <<< isolated recursion >>>
OPTIONS
-a Normally only the first call to a function is recorded
for any given function, under this option all calls are
recorded. This may make the output for some large
programs very verbose and these are normally not needed
to show the calling structure of a program.
-Dname or -Dname=def
Define the name for the preprocessor, as if by #define.
If no definition is given, the name is defined as 1.
-e Normally an index listing does not contain the external
functions called in the program, under this option
these are also listed. Note this option also turns on
the indexing option, -i.
-ffunction
Page 1 (printed 5/23/00)
CALLS(1u) UNIX System V (UNSUP) CALLS(1u)
The named function will be printed as the root of a
calling graph.
-F function[/file]
The named static function (in the given file) is used
as the base of a calling graph, as above. This allows
closer examination of sources such as that of dbx(1)
that have many static functions with the same name.
-h Display a brief help message.
-i This option produces an index of all the functions
declared in the processed files. Optionally all
functions mentioned can be output; see -e above.
-Idir
Change the path for searching for #include files whose
names do not begin with `/' to look in dir before
looking in the directories on the standard list.
-ldepth
Limit the output graph depth to depth. This option may
prevent some recursion from being detected by calls.
-o Do not output any defined functions that were not
present in any of the output trees. Note this also
turns on the index option (-i above). For a list of
all functions called by 'missle' one might examine the
index output of
calls-ot -f missle *.c
-r This option reverses the direction of the calling
graph. Under this option the output graph shows who
calls the described function, not who the function
calls.
-t This option instructs calls not to display graphs that
were not explicitly asked for on the command line.
Using this option as well as the index option one can
produce just a list of the functions declared in a
file.
-T The function graph output is suitable input for
tsort(1).
-Uname
Remove any initial definition of name in the
preprocessor.
-v Be more verbose in the graph. This option inserts more
English words in the output and repeats some useful
information (such as the file a function came from).
Page 2 (printed 5/23/00)
CALLS(1u) UNIX System V (UNSUP) CALLS(1u)-V Also provide the variables used in the output graph.
This option forces calls to put ``()'' after functions
to disambiguate them from the variables.
-wwidth
Set the max indentation width to width. The default is
96 columns.
-x Do not show external functions in the output graphs.
-z Sort the descendant calls in alpha (a to z) order.
EXAMPLE
Given the file prog.c
main() {
abc();
def();
}
abc() {
ghi();
jkl();
}
static mno() { }
ghi() {
abc();
def();
mno();
}
dead() { }
Executing calls prog.c will produce:
1 dead [prog.c(15)]
2 main [prog.c(1)]
3 abc [prog.c(5)]
4 ghi [prog.c(10)]
5 abc <<< recursive >>>
6 def
7 mno [static in prog.c(9)]
8 jkl
9 def
Executing calls-r prog.c will produce:
1 abc [prog.c(5)]
2 main [prog.c(1)]
3 ghi [prog.c(10)]
4 abc <<< itself >>>
5 mno [static in prog.c(9)]
6 ghi see line 3
Page 3 (printed 5/23/00)
CALLS(1u) UNIX System V (UNSUP) CALLS(1u)
7 dead [prog.c(15)]
EXAMPLES
calls-l 2 main.c misc.c bop.c
Show a graph for the given files, but limit the depth
to 2 levels.
calls-rV *.c
Show all the which routines use which variables in the
given C source files.
calls-rtf yylex parser.c
Show which routines call yylex in parser.c.
BUGS
Static functions must be declared (in full) before used to
work properly.
Variables include typedef names, goto labels, structure
members and struct/union tags. This might be a feature too.
Output width checking is only done on the first character on
a new line.
AUTHOR
Originally from the net. Enhanced at Purdue University,
still maintained by Kevin S. Braunsdorf Federal Express,
ksb@fedex.com
SEE ALSO
cpp(1), cc(1), ctags(1)
NOT SUPPORTED BY PUCC
Page 4 (printed 5/23/00)