I'm trying to monitor library calls system-wide. I've written this script to trace library calls for libguestfs:
probe begin {
printf("ok\n")
}
probe process("/usr/lib64/libguestfs.so.0.471.0").function("*") {
print_usyms(ubacktrace())
}
Afterwards, I save it as test.stp and run "sudo stap test.stp". I needed some process which uses these function calls so I can intercept them. Therefore, I used a simple program called libguestfs-test-tool which is a part of libguestfs package. IT SEGFAULTS! It does not segfault if I don't run stap.
So basically I have two questions:
1- Why is this happening? Have I done something wrong?
2- I need to use the ltrace functionality, but system-wide. For every library call, I need to get the top-level API called along with the pid of the process which called this function. I tried using stap but seems it has some instability problems... Do you have any alternatives for me?
p.s: I use CentOS 7 with kernel 3.12.2.3