I am trying to run some profiles on DBMSs written in C, primarily the postgres binary. I would like to be able to use a utility to print out the sequence of function calls made made by the program. As a simple example, take this program:
void func1 () {
printf("x\n");
}
void func2 () {
printf("y\n");
func1();
}
int main () {
func2();
func1();
return 0;
}
When compiled and executed with this "utility", I would like to see something along the lines of this:
-> main
-> func2
-> func1
-> func1
<-
Also, I cannot modify either the source code or the makefile, however -g
is already enabled.
I know that I have used a profiler in the past that did something similar to this, but I cannot remember which one. I did some googling, and I could't find a good solution that did not require me to change either the source or the makefile.
What profiling tool can I use to accomplish this? Or does one not exist?
Thanks.