View on GitHub


A toolkit for tracing C/C++ program

Download this project as a .zip file Download this project as a tar.gz file


A toolkit for tracing C/C++ program(including multi-thread program), it can generate a call graph for you
Sometimes you may hard to understand a complex program, especially a very big application. So you need a powerful tool to help you to dump the call graph.

Before you start

Please note that, the tracer works for you in the following scenarios:

If NOT, please leave.

How to Use it

Check out

git clone

Compile ftracer


Re-Compile your program

To make the tracer working, you should re-compile your application with -g -finstrument-functions flags

make CFLAGS="-g -finstrument-functions"

NOTE: you can try the example in ftracer

Generate Call Graph Report


env variables

NOTE: About signal and function address entrance two features, they can not enable in the same time, if that, the signal feature will not be take effect.

gen_report Options

Sometimes, we deal with C++ program, there are a lot of noise in there, like std, boost... so we should filter them out

Enjoy and Analysis the Report

For now, open the /tmp/trace_report.txt.threadid and enjoy it. The example like:

 1x main(/home/username/github/ftracer/example/test.c:44) - (called from ??:0)
.. 3x a(/home/username/github/ftracer/example/test.c:36) - (called from test.c:45)
.... 1x b(/home/username/github/ftracer/example/test.c:21) - (called from test.c:39)
...... 1x c(/home/username/github/ftracer/example/test.c:16) - (called from test.c:25)
.... 1x b(/home/username/github/ftracer/example/test.c:21) - (called from test.c:39)
...... 2x d(/home/username/github/ftracer/example/test.c:11) - (called from test.c:27)
...... 1x e(/home/username/github/ftracer/example/test.c:6) - (called from test.c:31)

More detail see the example