I do not own copyrights or do not pretend to be the author of this software. I'm putting it on GitHub to have a convenient way of getting it the next time I need it.
callgraph
is an equivalent of strace
or ltrace
for tracing functions defined locally in your code.
See this blog post
or this StackOverflow question for a longer description
or just give the script a try.