Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Generating dynamic call graph of c/c++ programs on the run

Tags:

c++

c

call-graph

If one were to visualize the running of a program, I suppose one would start by getting the call graphs of the program.

But how would you get the call graph of c/c++ programs while on the run?

edit: clarifications, I'm currently running things on linux, using g++, but I suppose I am also curious about solutions if I'm using a different platform.

like image 302
kamziro Avatar asked Aug 16 '11 11:08

kamziro


2 Answers

I've used etrace to trace executions of programs.

Egypt does the same thing, but only has a limited support for C++.

Both requires the program to be instrumented with gcc.

like image 180
philant Avatar answered Sep 28 '22 17:09

philant


You can use KCachegrind to generate and analyze call graphs based on data generated by Valgrind's callgrind tool.

like image 25
Alok Save Avatar answered Sep 28 '22 18:09

Alok Save