This is the mail archive of the
systemtap@sources.redhat.com
mailing list for the systemtap project.
Re: runtime library wrapper for program counter
Vara Prasad wrote:
Vara Prasad wrote:
William Cohen wrote:
I like the wrapper for the return address in the systemtap runtime
libraries. Could there be a similar wrapper for the program
counter/instruction pointer? There are three possible uses for it:
1) It would be use in the case where the same systemtap
instrumentation code is used to multiple points. Allow the
instrumentation code to determine which probe fired.
2) Tracking destinations of calls. Have a post_handler instrumetation
look at the program counter to track the destination of indirect calls.
3) Tracking destination of jumps. For simple condition branch it
would probably be easier just to instrument the target and the fall
through. However for indirect jumps using jump tables, e.g. switch
case, the same post_handler as for destinations of calls could be
done. Have a probe that fires after executing the instruction.
-Will
I like the PC/IP wrapper idea.
I also like the idea of wrapper function for process credentials. This
call gives
process credentials like PID, PPID, UID, EUID, GID all filled into a
structure.
This information will be useful filtering what probes get fired for
which process like
process this probe only for my process kind of filter.
Another wrapper similarly would be print the call stack. For now we
can limit to
kernel stack but in the future similar functions could exist for user
stack and full stack.
bye,
Vara Prasad
Another useful runtime function for filtering would be who called this
routine.
One of the ways to define a probe is run the probe handler if this
function is
called from a specified function. For this we need to know the caller.
bye,
Vara Prasad
There is already a wrapper for the caller in the runtime libraries,
cur_ret_addr(). It is in src/runtime/io.c. There is an example that
uses it, src/runtime/probes/where_func.
-Will