[net.unix-wizards] call trace

mar (02/03/83)

Does anyone know of a way to obtain a call trace from an f77
program without inserting print statements into every procedure?

I have a database program with 217 routines so inserting print
statements is an undesirable solution. I've also thought of using
adb or sdb to set breakpoints on all the routines. This, also,
is unacceptably tedious.

I thought about writing a program (or shellscript, if possible)
to insert print statements into each routine, but I concluded that
that would be extremely messy (fortran does not allow executable
statements mixed in with declaration statements).

Does anyone have any other ideas?
HELP!

Mark Rosso
duke!mar

mark (02/12/83)

#R:duke:-296800:zinfandel:12400016:000:791
zinfandel!mark    Feb 10 13:44:00 1983

Call trace:  yes, there's another way (on PDP-11s and similar machines).
Without going into details, if your compiler generates calls to register
save/restore routines (C on 11s does this, so F77 must also), then
you re-write those routines (in assembler) to print out names, parameters,
return values, etc -- at Ames we had a package that would do all of that
to a file (and truncate it periodically -- it gets HUGE fast).

Be careful -- linking of the trace package is odd, because you must ensure
that any C/F77 routines you call to do the io, etc, link to the OLD csav/cret,
not the new one.  Some judicious patching of the symbol table
of the final object file is helpful. Linking of the program with the trace
package is straightforward.

Mark Wittenberg
...!decvax!sytek!zehntel!mark

clark.wbst@PARC-MAXC.ARPA (03/18/83)

If all else fails, put in print statements with #ifdef DEBUG type stuff,
if #ifdef DEBUGROUTINENAME, and run it through the C pre-processor.
Then you never have to take them out, and can turn it on and off.

				--Ray