I want to trace a C program under Linux, and record all function calls and returns in a format of tree. For example, the source code:
void a ()
{
printf("a\n");
}
void b ()
{
printf("b\n");
}
void c ()
{
a();
b();
}
int main()
{
a();
b();
c();
}
And I want a output like the following:
call main
call a
exit a
call b
exit b
call c
call a
exit a
call b
exit b
exit c
exit main
It is a idealistic output. I just want to get all the process of local function calls and returns, so the similar output is also welcome.