Can anyone suggest a way to track every function call?

I want to track every way function calls. For instance,

int a()
{
    b();
    return 1;
}
void b()
{
}
int main()
{
    int x=a();
    return 0;
}

So my call trace is main-> a-> b So I want to track every set of call paths. I thought about the first search for depth. But I'm not sure how it will go. Can someone suggest me any specific method that will be implemented in perl? I will have a C program code file and a perl script will be run for it to get call traces.

+3
source share
3 answers

-, egypt, Perl script, gcc Graphviz C.

+5
0

- , . .

Here, a document about how tohook abouth information “blocks” is executed using a transformation system to insert such probes. There is a very small change in the specification of where to put the probes, and some minor work on capturing the current function would do what you want to make possible.

0
source

Source: https://habr.com/ru/post/1774748/