Recently reading some kernel code and think a call graph tool should be able to help me. So I tried NCC and CodeVIZ yesterday.
Installation:
* 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.
Compliation:
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.
Graph:
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!