[lttng-dev] Automatic instrumentation using a clang plugin

Stefan Hajnoczi stefanha at gmail.com
Thu Apr 12 05:10:22 EDT 2012


You may have already seen this, it's a userspace C/C++ tracing tool
that uses a clang plugin to instrument all functions in the source
code including arguments and type information.  This allows it to
easily trace everything that happens inside an app.

The actual tracer is probably along the lines of LTTng UST, I haven't
checked.  Here's the link to the clang plugin which I think is the
interesting part:

https://github.com/yotamr/traces/tree/master/trace_instrumentor

and the wrapper script to use in place of gcc/g++:

https://github.com/yotamr/traces/blob/master/ccwrap.py

Hope this is not too spammy for the list, just wanted to share because
the clang plugin is an interesting approach.  The advantage is that
you don't need to hope your trace points provide the right information
- you can trace any function.  Another approach to achieving similar
ease-of-use would be a dynamic userspace probing mechanism that uses
DWARF info but I'm not sure if the right information is available in
the DWARF info or how hard dynamic probing is in practice.

Stefan



More information about the lttng-dev mailing list