All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: gcc plugin for instrumenting individual functions
       [not found] <CAAS9doaz=dF_42vWaKO9mnRgua8hTNrgx+aHQZ0j9XTAhy0vmw@mail.gmail.com>
@ 2019-07-29 19:22 ` Jonathan Rajotte-Julien
       [not found] ` <20190729192259.GA28213@joraj-alpa>
  1 sibling, 0 replies; 3+ messages in thread
From: Jonathan Rajotte-Julien @ 2019-07-29 19:22 UTC (permalink / raw)
  To: Christophe Bédard; +Cc: lttng-dev

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@lists.lttng.org
> https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev


-- 
Jonathan Rajotte-Julien
EfficiOS

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: gcc plugin for instrumenting individual functions
       [not found] ` <20190729192259.GA28213@joraj-alpa>
@ 2019-07-30 14:05   ` Christophe Bédard
  0 siblings, 0 replies; 3+ messages in thread
From: Christophe Bédard @ 2019-07-30 14:05 UTC (permalink / raw)
  To: Jonathan Rajotte-Julien; +Cc: lttng-dev


[-- Attachment #1.1: Type: text/plain, Size: 858 bytes --]

Hi,

On Mon, 29 Jul 2019 at 21:23, Jonathan Rajotte-Julien <
jonathan.rajotte-julien@efficios.com> wrote:

> 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/
>
>
Thank you for providing some context!


> Thanks Christophe for this contribution.
>
> Do you know why GCC does not support this out of the box?
>

I'm not sure. I looked at the the relevant parts of the gcc codebase, and
came to the conclusion that it just wasn't written with this feature in
mind (which is why the plugin uses a sort of workaround).

Is this something that
> could be presented to the GCC community?


If people think it should be presented!


Christophe

[-- Attachment #1.2: Type: text/html, Size: 1716 bytes --]

[-- Attachment #2: Type: text/plain, Size: 156 bytes --]

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* gcc plugin for instrumenting individual functions
@ 2019-07-29 18:56 Christophe Bédard
  0 siblings, 0 replies; 3+ messages in thread
From: Christophe Bédard @ 2019-07-29 18:56 UTC (permalink / raw)
  To: lttng-dev


[-- Attachment #1.1: Type: text/plain, Size: 594 bytes --]

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

[-- Attachment #1.2: Type: text/html, Size: 872 bytes --]

[-- Attachment #2: Type: text/plain, Size: 156 bytes --]

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-07-30 14:05 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CAAS9doaz=dF_42vWaKO9mnRgua8hTNrgx+aHQZ0j9XTAhy0vmw@mail.gmail.com>
2019-07-29 19:22 ` gcc plugin for instrumenting individual functions Jonathan Rajotte-Julien
     [not found] ` <20190729192259.GA28213@joraj-alpa>
2019-07-30 14:05   ` Christophe Bédard
2019-07-29 18:56 Christophe Bédard

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.