<html><body><div style="font-family: arial, helvetica, sans-serif; font-size: 12pt; color: #000000"><div>This is due to limitations of the C preprocessor. We need to have the TP_ARGS() available<br></div><div>both in the TRACEPOINT_EVENT_INSTANCE(), which generates the tracepoint prototype<br data-mce-bogus="1"></div><div>used to validate type compability of the tracepoint callsite within the application, and within<br data-mce-bogus="1"></div><div>TRACEPOINT_EVENT_CLASS() which is used to generate the probe callback with the</div><div>correct arguments.<br data-mce-bogus="1"></div><div><br data-mce-bogus="1"></div><div>Unfortunately, the C preprocessor does not allow much freedom when it comes to accessing<br></div><div>arguments of another macro.<br data-mce-bogus="1"></div><div><br></div><div>Thanks,<br data-mce-bogus="1"></div><div><br data-mce-bogus="1"></div><div>Mathieu<br data-mce-bogus="1"></div><div><br data-mce-bogus="1"></div><div><span id="zwchr" data-marker="__DIVIDER__">----- On Dec 20, 2018, at 12:21 PM, Yonghong Yan <yanyh15@gmail.com> wrote:<br></span></div><div data-marker="__QUOTED_TEXT__"><blockquote style="border-left:2px solid #1010FF;margin-left:5px;padding-left:5px;color:#000;font-weight:normal;font-style:normal;text-decoration:none;font-family:Helvetica,Arial,sans-serif;font-size:12pt;"><div dir="ltr"><div dir="ltr"><div dir="ltr" class="gmail_signature"><div dir="ltr"><div dir="ltr"><div>Then why bother to require to have the TP_ARGS in TRACEPOINT_EVENT_INSTANCE? </div><br><div>Yonghong</div><br></div></div></div></div><div class="gmail_quote"><div dir="ltr">On Thu, Dec 20, 2018 at 11:56 AM Philippe Proulx <<a href="mailto:eeppeliteloop@gmail.com" target="_blank">eeppeliteloop@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On Thu, Dec 20, 2018 at 11:47 AM Yonghong Yan <<a href="mailto:yanyh15@gmail.com" target="_blank">yanyh15@gmail.com</a>> wrote:<br>
><br>
> I am looking at the following example from lttng-ust manual. The same TP_ARGS ( ... ) are repeated in both the TRACEPOINT_EVENT_CLASS and TRACEPOINT_EVENT_INSTANCE definition. My understanding is that it actually allows using different arguments, even in this example it is the same. Am I right?<br>
<br>
No it does not: they need to match.<br>
<br>
See <<a href="https://github.com/lttng/lttng-ust/commit/c75c0422c64f33c0102e1778cecc812c58b700e5" rel="noreferrer" target="_blank">https://github.com/lttng/lttng-ust/commit/c75c0422c64f33c0102e1778cecc812c58b700e5</a>>.<br>
<br>
Phil<br>
<br>
><br>
> I also like the feature of having one TP_ARGS in the TRACEPOINT_EVENT_CLASS that declares the arguments for several TRACEPOINT_EVENT_INSTANCE so we do not need to have TP_ARGS in TRACEPOINT_EVENT_INSTANCE. Is that possible?<br>
><br>
> Thank you<br>
> Yonghong<br>
><br>
> TRACEPOINT_EVENT_CLASS(<br>
>     my_provider,<br>
>     my_tracepoint_class,<br>
>     TP_ARGS(<br>
>         int, my_integer_arg,<br>
>         struct app_struct *, app_struct_arg<br>
>     ),<br>
>     TP_FIELDS(<br>
>         ctf_integer(int, a, my_integer_arg)<br>
>         ctf_integer(unsigned long, b, app_struct_arg->b)<br>
>         ctf_string(c, app_struct_arg->c)<br>
>     )<br>
> )<br>
><br>
> TRACEPOINT_EVENT_INSTANCE(<br>
>     my_provider,<br>
>     my_tracepoint_class,<br>
>     event_instance1,<br>
>     TP_ARGS(<br>
>         int, my_integer_arg,<br>
>         struct app_struct *, app_struct_arg<br>
>     )<br>
> )<br>
><br>
> TRACEPOINT_EVENT_INSTANCE(<br>
>     my_provider,<br>
>     my_tracepoint_class,<br>
>     event_instance2,<br>
>     TP_ARGS(<br>
>         int, my_integer_arg,<br>
>         struct app_struct *, app_struct_arg<br>
>     )<br>
> )<br>
><br>
><br>
> _______________________________________________<br>
> lttng-dev mailing list<br>
> <a href="mailto:lttng-dev@lists.lttng.org" target="_blank">lttng-dev@lists.lttng.org</a><br>
> <a href="https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev" rel="noreferrer" target="_blank">https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev</a><br>
</blockquote></div></div>
<br>_______________________________________________<br>lttng-dev mailing list<br>lttng-dev@lists.lttng.org<br>https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev<br></blockquote></div><div><br></div><div data-marker="__SIG_POST__">-- <br></div><div>Mathieu Desnoyers<br>EfficiOS Inc.<br>http://www.efficios.com</div></div></body></html>