[lttng-dev] tracing program flow

Mathieu Desnoyers mathieu.desnoyers at efficios.com
Sun May 6 12:27:02 EDT 2012

* Alexandre Montplaisir (alexandre.montplaisir at polymtl.ca) wrote:
> On 12-05-06 01:17 AM, Chuck Tuffli wrote:
> > Hi -
> >
> > I'm investigating the feasibility of replacing some home grown tracing
> > code with LTTng and am looking for advice from others who have used
> > LTTng to trace program flow (i.e. trace function entry and exit
> > points). One of the strengths of LTTng seems to be the ability to
> > selectively enable tracepoints of interest (much more useful than our
> > all-or-nothing tracing). To get this type of capability, would I need
> > to implement an entry and exit tracepoint for each function or is
> > there a better approach? Any other best practices people would be
> > willing to share? TIA.
> Hi,
> For now you'd have to create a custom probe for each function entry and
> exit.
> There's a feature on the wishlist to use GCC hooks to automatically
> generate those probes [1]. The end result would be the same, but it
> would be much less tedious to do the instrumentation part. A Clang
> plugin was also mentioned previously [2], but I don't think anybody has
> tried it yet.

Looking at how the Linux kernel implements function entry and exit
tracing is relevant here:

- kretprobes: using breakpoints, and boosted breakpoints.
- function tracer: based on gcc mcount instrumentation, replaced at
  build time and runtime by nops/function call.

Ideally at some point, we might want to reimplement those in user-space
as a LTTng-UST library.

Best regards,


> [1] https://bugs.lttng.org/issues/39
> [2] http://lists.lttng.org/pipermail/lttng-dev/2012-April/017787.html
> Hope this helps,
> -- 
> Alexandre Montplaisir
> DORSAL lab,
> École Polytechnique de Montréal
> _______________________________________________
> lttng-dev mailing list
> lttng-dev at lists.lttng.org
> http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev

Mathieu Desnoyers
Operating System Efficiency R&D Consultant
EfficiOS Inc.

More information about the lttng-dev mailing list