Visualize call tree of a C function

Fri 24 September 2010
  • 把戏 tags:
  • c
  • dot
  • foss
  • visualization published: true comments: true

Requirement

You want to visualize a call hierarchy of a C function.

Solution

Utilities you need are listed below:

Take 'rdbSaveBackground' (redis/rdb.c) for example:
[cc lang="bash"]
cflow --format=posix --omit-arguments --level-indent='0=\t' --level-indent='1=\t' --level-indent=start='\t' -m 'rdbSaveBackground' ~/osprojects/redis/src/rdb.c | cflow2dot | dot -Tjpg -o rdb.jpg
[/cc]

Output: visualization of a call tree

Source: unix diary

The post is brought to you by lekhonee v0.7