Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Looking for a utility that will trace function flow in c/C++ program.

Status
Not open for further replies.

gpsmith

Programmer
Jan 4, 2003
5
US
I am looking for a function that I can use to trace function flow in a C or C++ program.

I am looking for something like ctrace (Except ctrace is not installed on my HP box AND I don't know where to get it so that I could install it AND ctrace only produces its trace when the program you want to trace runs. i.e. I think ctrace does its magic by inserting printf statments in the source?)

I am working on an old, large application with very poor documentation. I would like to know what function calls another function which calls another fucntion,... , etc.

Does anyone have any ideas?

Thanks in advance,
George
 
Hi,
Download and install Caliper.


Caliper is HPUX's Performance analysis tool and it can do all sort of neat things without having to PRE INSTRUMENT the code.

ip sampling
Call Graph ( what you want )
profiling ( line counts, function timings )

the latest version can even attach to a running process, run for a specified duration and then print the results which allows you to run caliper against a server application that is always running.

----
 
Caliper will not run on my HP box I am told.

I was hoping to find a utility that would operate like the linker but would generated the name of the calling function and what module it was in and the function(s) that were being called and what module they were in, etc. .....


Thanks,
George
 
Hi,
Sorry to hear that. the old form of Caliper was called CXPERF which although unsupported may still be available for Older HPUX boxes.

I wrote a perl script on my SVR 4 box which basically
disassembles the file and pipes it into a script which finds all the CALL statements

dis -s file | script

The key to the script was the Disassemblers -s option which would translate addresses to known names if available but this only worked for global symbols.

Given the format of the disassembly of the HPUX box I am sure that a script could be written to tell you which functions are calling who.


----

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top