Function tracing

Vara Prasad prasadav@us.ibm.com
Wed Apr 27 21:39:00 GMT 2005


In order  to help developers debug kernel one useful feature in 
systemtap would be able to tell when the function entered and what are 
the arguments at the time of entry and when the function returned and 
what is the return value. With Jprobes we can do function entry and 
arguments. With return probes we can tell what the return value of the 
function is but we can not tell from which of the several possible 
returns the function returned.

Let me give an example.
Let us say if we have following function max
int max(int a, int b)
{
    if (a < b)
       return b;
    else
       return a;
}

What we cannot find out with return probes is, which of the the two 
possible return statements was executed.
I would think this feature will be very useful for tracing the code 
path. One possible way could be to do a call graph analysis of the 
function and put traps in all the possible return statements, but i 
would think that is not a very good way to go.
Any ideas on solving this would be appreciated?

A related problem would be how to trace a particular process. If we we 
know that running a particular test causes the problem one would like to 
trace all function calls and returns done by just that process. The call 
graph analysis method wont solve this problem as we can not possibly 
find out in advance what functions get called.

Thanks for your help in advance,
Vara Prasad



More information about the Systemtap mailing list