2006-12-20 15:16:16 +01:00
|
|
|
Basic instructions to use ctracer:
|
|
|
|
|
2007-01-27 21:38:07 +01:00
|
|
|
1. Install dwarves, if you are not that excited about building it I'm
|
|
|
|
keeping rpms for Fedora Core 6 here:
|
2006-12-20 15:16:16 +01:00
|
|
|
|
2007-01-27 21:38:07 +01:00
|
|
|
http://oops.ghostprotocols.net:81/acme/dwarves/rpm/
|
2006-12-20 15:16:16 +01:00
|
|
|
|
2007-01-27 21:38:07 +01:00
|
|
|
The .src.rpm is there in case you want to rebuild it for another
|
|
|
|
rpm based distro.
|
2006-12-20 15:16:16 +01:00
|
|
|
|
2008-10-29 11:54:53 +01:00
|
|
|
Since fedora 9 you just have to run:
|
|
|
|
|
|
|
|
yum install dwarves
|
|
|
|
|
2007-01-27 21:38:07 +01:00
|
|
|
2. build the kernel with CONFIG_DEBUG_INFO=y, i.e. gcc -g, that will
|
|
|
|
insert the DWARF info needed by all the pahole tools, ctracer, etc, or
|
|
|
|
just install the kernel-debuginfo rpm package on FC6, other distros
|
|
|
|
have it with a different name, its just the kernel built with debug
|
|
|
|
info.
|
2006-12-20 15:16:16 +01:00
|
|
|
|
2007-01-27 21:38:07 +01:00
|
|
|
3. Assuming you installed the kernel-debuginfo package, to run ctracer
|
|
|
|
on your workstation, just do the following steps:
|
2006-12-20 15:16:16 +01:00
|
|
|
|
2007-01-27 21:38:07 +01:00
|
|
|
mkdir foo
|
|
|
|
cd foo
|
2007-05-22 18:51:58 +02:00
|
|
|
ln -s /usr/share/dwarves/runtime/* .
|
2007-01-27 21:38:07 +01:00
|
|
|
make CLASS=sock # to trace struct sock methods, this one is safe, try others
|
|
|
|
# and tell me your horror (or success :-) ) story.
|
|
|
|
|
|
|
|
(kbuild gurus, send suggestions to simplify this procedure! :-) )
|
|
|
|
|
|
|
|
4. load the resulting module:
|
|
|
|
|
|
|
|
insmod ctracer.ko
|
|
|
|
|
[CTRACER]: Lots of improvements
1. We now use relayfs
2. ostra-cg is shipped and used in the Makefile
3. README.ctracer has all the details
I followed README.ctracer and the result, in my workstation, was this one:
http://oops.ghostprotocols.net:81/acme/dwarves/callgraphs/acme_eating_his_dog_food/6.html
I've started on the 6th page as it is more interesting, having tcp and netlink
callchains, don't be disappointed by some pages having just one level of
nesting, that is just the lack of containers and aliases (to follow tcp_sock,
skb->sk, etc) from the OSTRA days, but it's getting there! :-)
Ah, it is collecting all the base types in the specified struct by doing a
struct "view", i.e. trimming the struct to have just members that are
"reducible" to basic types (int, long, char, signed and unsigned), then
reorganizing it with the code introduced in pahole --reorganize to get it to
the best layout possible, reducing the size of the entry probe points trace
entries.
Updated rpms are available at the usual place:
http://oops.ghostprotocols.net:81/acme/dwarves/rpm/
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2007-02-02 18:15:27 +01:00
|
|
|
dmesg will show how many probes were successfully installed
|
|
|
|
|
|
|
|
5. Do some related activity (ssh, in the above example should do)
|
|
|
|
|
|
|
|
6. Make sure debugfs is mounted
|
|
|
|
|
|
|
|
[root@filo ~]# mount -t debugfs none_debugfs /sys/kernel/debug/
|
|
|
|
|
|
|
|
7. Get the log:
|
|
|
|
|
|
|
|
cat /sys/kernel/debug/ctracer0 > /tmp/ctracer.log
|
|
|
|
|
|
|
|
8. Generate the callgraph!
|
|
|
|
|
|
|
|
make callgraph
|
|
|
|
|
|
|
|
9. rmmod ctracer
|
2007-01-27 21:38:07 +01:00
|
|
|
|
|
|
|
Change the shipped Makefile accordingly to build a module for qemu or another test
|
|
|
|
machine.
|
|
|
|
|
|
|
|
The relay transport is mostly ready and will be included in the upcoming changesets.
|