C Documentation Utility Needed

Jim Rogers jimr at hp-lsd.COS.HP.COM
Fri Jan 5 02:57:30 AEST 1990


/ hp-lsd:comp.unix.questions / dymm at b.cs.wvu.wvnet.edu (David Dymm) /  4:22 pm  Jan  2, 1990 /

>I am looking for a utility to help in the documentation of C code.
>
>Input:  Multiple 'C' files.
>
>Output: A cross reference report showing the call hierarchy of
>	all functions.
>	Thus, the report might be in the form of a tree where
>	each function is listed showing from where it is called
>	and perhaps how many times it is called.

On Sys V systems there is a utility called "cflow" which will take a
collection of C, YACC, LEX, assembler, and object files and builds a graph
charting the external references.

This will probably meet most of your needs for static analysis of your code.

When you ask to show how many times a function is called then you are jumping
into the world of dynamic analysis.

Dynamic analysis allows you to trace the actual execution of your program.
There are many forms of dynamic analysis including branch flow analysis and
path flow analysis.  The common factor in all dynamic analysis is that the
results obtained are completely dependant upon the data fed to the program.
Most dynamic analysis is used to determine test coverage.

If a test suite covers all the possible conditions your code can encounter
then you should get 100% coverage, with some functions being called many times.
If your test suite omits some conditions or combinations of conditions then
you may find that some of your functions or branches may not have been tested.

Static analysis is useful for documentation.
Dynamic analysis is useful for test design and verification.

Jim Rogers

Hewlett-Packard Logic Systems Division
Colorado Springs, Colorado



More information about the Comp.unix.questions mailing list