Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!cs.utexas.edu!tut.cis.ohio-state.edu!ucbvax!hplabs!hpfcso!hpldola!hp-lsd!jimr From: jimr@hp-lsd.COS.HP.COM (Jim Rogers) Newsgroups: comp.unix.questions Subject: Re: C Documentation Utility Needed Message-ID: <7370006@hp-lsd.COS.HP.COM> Date: 4 Jan 90 15:57:30 GMT References: <625@h.cs.wvu.wvnet.edu> Organization: HP Logic Systems Division - ColoSpgs, CO Lines: 39 / hp-lsd:comp.unix.questions / dymm@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