Strace plugins

Matt Wimer matt at cylant.com
Mon Apr 23 23:23:03 UTC 2001


Hi guys,

I sent Wichert and email this morning talking about adding
a plugin interface into strace.  I wrote up a little file
detailing what i think needs to be done for this to work
out.  This Document is written in the passed tense so it
will be correct as soon as the work is done.

Here is it:


PLUGINS
-------

This plugin interface for strace is setup to do profiling of the
"straced" application in realtime.


Interface:
Called when after each syscall from inside strace.c:trace_syscall().
stracelib_trace_syscall (struct tcb * tcp);

Called any time strace is detaching a process. Reason will say why
the process is being detached from.
stracelib_trace_detach (struct tcb * tcp, int reason);

Called anytime strace attachs to a new process. Reason will be set
to the reason why strace is attaching.
stracelib_trace_attach (struct tcb * tcp, int reason);


Programming:
You will need to have the strace source code. Create a directory
under strace-x.x for your source code. Put your configure and
bootstrap scripts in this directory. 


Building:
To build your software you need to tell configure which directory
you want it to build plugins in.  Configure like this:
./configure --plugins=libmystrace[,...]
make


Using:
Strace will load up the plugin library using the -l flag. Strace
accepts multiple strace plugins.
strace -l libmystrace/libmystrace.so [-l ...] ...


Notes and Issues
Because this takes strace out of the job of a simple debugging tool
we have to add a flag to turn off all the output and syscall 
interpreter code. We should also add the ablity to send arguments
to the library.  I suggest we encapselate the library args with
a pair of -- markers:
strace -<flags> -l lib.so [-- -<lib options> --] -<more flags>

--matt wimer





More information about the Strace-devel mailing list