Call graph

Recently reading some kernel code and think a call graph tool should be able to help me. So I tried NCC and CodeVIZ yesterday.


* NCC has rpm for Fedora Core 5 but some files in source tgz is missed from rpm.

* CodeVIZ, I do not want to use the patched gcc (that is why I choose NCC). So a simply copy (see README for detail) will finish the installation. NCC site has a nice writeup about how to compile kernel. I tried it on 2.6.19 with one extra hack.


In <2.6.19 ksrc>/include/linux/compiler-gcc4.h, have to comment this line in order to compile ok.
#define __compiler_offsetof(a,b) __builtin_offsetof(a,b)

Compile the code I need to read, SCST, is quite straightfoward.


First need to get full graph information,

#genfull -g cncc

Then generate what I want

#gengraph –output-type png -f init_scst -t

gengraph has various options can be used to customize the use. One of it is “-i” which can exclude some functions I do not want to see. I have to read the gengraph code to see how to use this option.

#gengraph –output-type png –no-extern -d 20 –output-layout LR -i “__fswab32;list_del;list_add_tail;list_del_init” -f init_scst

See what I get, quite nice right?


Today Stelios, author of ncc, suggest me to try nccnav more. I will for sure. But thank Stelios for this nice tool first!


1 Comment »

  1. another more awsome call graph.

RSS feed for comments on this post · TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: