[comp.unix.wizards] Looking for a C call-graph generator ...

wayne@ames.arpa (07/09/87)

I have just been given the opportunity to become familiar with
a very large and extremely modularized C application.  A major
part of understanding this beast is figuring out who calls whom
and vice versa.  Unfortunately, it is way too huge for "cxref"
(don't think we have the disk space!), so I was wondering if
anybody out there knows of any UN*X tools that would help out,
such as by producing a manageable call-graph?  I have a Sun 3
running SunOS 3.2 (a 4.2BSD derivative, of course).  Be willing
to pay for such a tool if necessary ...  Also have access to
Internet FTP.

adTHANXvance!

        Wayne Hathaway        ultra!wayne@Ames.ARPA
        Ultra Corporation
        2140 Bering drive     with a domain server:
        San Jose, CA 95131       wayne@Ultra.COM
        408-922-0100

guy@gorodish.UUCP (07/09/87)

> Unfortunately, it is way too huge for "cxref" (don't think we have the
> disk space!), so I was wondering if anybody out there knows of any UN*X
> tools that would help out, such as by producing a manageable call-graph?
> I have a Sun 3 running SunOS 3.2 (a 4.2BSD derivative, of course).

More correctly, a 4.2BSD and System V Release 2 derivative; note the
presence, for example, of "cxref".  S5R2 also includes a flow-graph
utility called "cflow"; as with "cxref", to get it you have to select
the System V Optional Software item when installing SunOS.  (It
really has nothing to do with System V *per se* - it runs in the
4.2BSD environment, and lives in "/usr/bin".)  However, since it,
like "cxref", is a derivative of "lint", which produces BIG
intermediate-pass files, you may have the same disk space problems
with it as you might with "cxref".
	Guy Harris
	{ihnp4, decvax, seismo, decwrl, ...}!sun!guy
	guy@sun.com

franco@MIKEY.BBN.COM (07/09/87)

Wayne:
	Try 'cflow : generate C flow graph' or 'ctags : create a tags file'
or 'ctrace : C program debugger' or 'trace : trace system calls of programs'.
If this doesn't help, I would suggest to you to take volume 1 of your systems
manual and flip through page by page and learn a few new commands.

-franco

barnett@vdsvax.steinmetz.UUCP (Bruce G Barnett) (07/10/87)

Some people here use calls from mod.sources.
At least one person here say cflow wasn't as useful as calls.

 = Subject: v06i003:  new calls; shows function call flow (calls.new)
 = Message-ID: <78@mirror.UUCP>
 = Date: Mon, 16-Jun-86 20:23:48 EDT

 = Submitted by: Wombat <cca!caip!pur-ee!pucc-j.Purdue.EDU!rsk>
 = Archive-name: calls.new

 = This is a massively revised, bug-fixed, and hacked version of "calls",
 = which has been bouncing around the net for some time.  Comments and
 = bugs and whatnot to Kevin Braunsdorf at pucc-j!ksb or ksb@j.cc.purdue.edu.
 = 
 = It's also available via anonymous ftp on j.cc.purdue.edu.





-- 
Bruce G. Barnett  (barnett@ge-crd.ARPA) (barnett@steinmetz.UUCP)

skinner@saturn.ucsc.edu (Robert Skinner) (07/23/87)

In article <8230@brl-adm.ARPA>, franco@MIKEY.BBN.COM (Frank A. Lonigro) writes:
> Wayne:
> 	Try 'cflow : generate C flow graph' or 'ctags : create a tags file'
> or 'ctrace : C program debugger' or 'trace : trace system calls of programs'.
> If this doesn't help, I would suggest to you to take volume 1 of your systems
> manual and flip through page by page and learn a few new commands.
> 
> -franco

great,

someone asks about the existence of a tool that I could use also, and
we get the above response.  OK, Frank, I've 'learned a few new commands'
and here's what I know:

	cflow:	not present on either 4.3 or SYSV system I use

	ctags:  sure, it shows you where routines are defined, and I
		use it for `vi`, but it doesn't show who calls who
		(it does help narrow down the search by hand)

	ctrace:	not present

	trace:	not present

	cxref:	tried it on our SYSV system.  It barfed when I tried to
		do 'complicated' things like:
			
			#define	A  5
			#define B  A
		
		and it claims that its errors are cryptic but usually mean that
		the file wouldn't compile anyway, sure.


I also remember that there was a pretty good program also called 'cxref'
that we picked up at my last job.  I had the impression it was public
domain or came from Usenix.  It had only minor bugs, and I used it 
successfully on a 17K line program.

back to the original question:  what works?

Robert Skinner
skinner@saturn.ucsc.edu

	

rsalz@bbn.com (Richard Salz) (07/24/87)

The comp.sources.unix archives has "calls" which does flow-call analysis.
Contact your nearest archive site for info on how to get it; if you
need a list of archive sites, send a (human-readable :-) request to
sources@uunet.uu.net.....
	/r$
-- 
Rich $alz					Cronus Project, BBN Labs
rsalz@bbn.com					sources@uunet.uu.net

mlandau@Diamond.BBN.COM (Matt Landau) (07/24/87)

NOTE: I've changed the followup to comp.lang.c, where this discussion
      is more appropriate.  If you're reading this via Arpa mailing
      lists, check info-c (or get news working :-)

In comp.unix.wizards (<566@saturn.ucsc.edu>), skinner@saturn.ucsc.edu 
(Robert Skinner) writes:
>
>someone asks about the existence of a tool that I could use also, and
>we get the above response.  OK, Frank, I've 'learned a few new commands'
>and here's what I know:
>
> [List of programs that aren't present on stock BSD or certain SysV
>  systems...]
>
>back to the original question:  what works?

Try "calls", the call-graph generator posted to comp.sources.unix
(formerly mod.sources), and available from you nearest c.s.u archive
site.  It's not as nice as cflow in some ways, but it's eminently
serviceable.
-- 
 Matt Landau			Oblivion gallops closer,
 mlandau@bbn.com		    favoring the spur, sparing the rein...