[lttng-dev] gcc plugin for instrumenting individual functions

Jonathan Rajotte-Julien jonathan.rajotte-julien at efficios.com
Mon Jul 29 15:22:59 EDT 2019


Hi,

For those at home wondering why this would be relevant to lttng,
lttng-ust comes with a utility shared object allowing you to leverage the
-finstrument-function sites to hook lttng tracepoints [1].

[1] https://lttng.org/man/3/lttng-ust-cyg-profile/v2.10/

Thanks Christophe for this contribution.

Do you know why GCC does not support this out of the box? Is this something that
could be presented to the GCC community?

Cheers

On Mon, Jul 29, 2019 at 08:56:15PM +0200, Christophe Bédard wrote:
> Hi,
> 
> Sharing this just in case it can help someone!
> 
> gcc only lets you disable instrumentation, using the
> `no_instrument_function` attribute, or by matching file names. It does not
> let you explicitly choose the individual functions you want to instrument.
> 
> I've searched many times for a way to do it, but never found anything for
> some reason, so I wrote this plugin:
> https://github.com/christophebedard/instrument-attribute-gcc-plugin
> 
> It simply enables instrumentation for functions with the
> `instrument_function` attribute, and disables instrumentation for all other
> functions.
> 
> 
> Christophe

> _______________________________________________
> lttng-dev mailing list
> lttng-dev at lists.lttng.org
> https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev


-- 
Jonathan Rajotte-Julien
EfficiOS


More information about the lttng-dev mailing list