Search code examples
debugginggdbllvmbacktracecall-graph

Faster backtrace for call graph generation?


I use the following approach to generate call graphs.

https://github.com/tarun27sh/gdb_graphs

But gdb is dramatically (x100) slowed down by backtrace. Is there a much faster way to generate call graphs?


Solution

  • Is there a much faster way to generate call graphs?

    Of course there is (using GDB for this is completely inappropriate).

    The simplest solution is to use GCC -finstrument-functions to insert a call at every function entry and exit, and implement the data collection in these "injected" functions. There is an example here.