This is due to limitations of the C preprocessor. We need to have the TP_ARGS() available both in the TRACEPOINT_EVENT_INSTANCE(), which generates the tracepoint prototype used to validate type compability of the tracepoint callsite within the application, and within TRACEPOINT_EVENT_CLASS() which is used to generate the probe callback with the correct arguments.
Unfortunately, the C preprocessor does not allow much freedom when it comes to accessing arguments of another macro. Thanks, Mathieu ----- On Dec 20, 2018, at 12:21 PM, Yonghong Yan <yany...@gmail.com> wrote: > Then why bother to require to have the TP_ARGS in TRACEPOINT_EVENT_INSTANCE? > Yonghong > On Thu, Dec 20, 2018 at 11:56 AM Philippe Proulx < [ > mailto:eeppelitel...@gmail.com | eeppelitel...@gmail.com ] > wrote: >> On Thu, Dec 20, 2018 at 11:47 AM Yonghong Yan < [ mailto:yany...@gmail.com | >> yany...@gmail.com ] > wrote: >>> 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? >> No it does not: they need to match. >> See < [ >> https://github.com/lttng/lttng-ust/commit/c75c0422c64f33c0102e1778cecc812c58b700e5 >> | >> https://github.com/lttng/lttng-ust/commit/c75c0422c64f33c0102e1778cecc812c58b700e5 >> ] >. >> Phil >>> 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? >> > Thank you >> > Yonghong >> > TRACEPOINT_EVENT_CLASS( >> > my_provider, >> > my_tracepoint_class, >> > TP_ARGS( >> > int, my_integer_arg, >> > struct app_struct *, app_struct_arg >> > ), >> > TP_FIELDS( >> > ctf_integer(int, a, my_integer_arg) >> > ctf_integer(unsigned long, b, app_struct_arg->b) >> > ctf_string(c, app_struct_arg->c) >> > ) >> > ) >> > TRACEPOINT_EVENT_INSTANCE( >> > my_provider, >> > my_tracepoint_class, >> > event_instance1, >> > TP_ARGS( >> > int, my_integer_arg, >> > struct app_struct *, app_struct_arg >> > ) >> > ) >> > TRACEPOINT_EVENT_INSTANCE( >> > my_provider, >> > my_tracepoint_class, >> > event_instance2, >> > TP_ARGS( >> > int, my_integer_arg, >> > struct app_struct *, app_struct_arg >> > ) >> > ) >> > _______________________________________________ >> > lttng-dev mailing list >> > [ mailto:lttng-dev@lists.lttng.org | lttng-dev@lists.lttng.org ] >>> [ https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev | >> > https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev ] > _______________________________________________ > lttng-dev mailing list > lttng-dev@lists.lttng.org > https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev -- Mathieu Desnoyers EfficiOS Inc. http://www.efficios.com
_______________________________________________ lttng-dev mailing list lttng-dev@lists.lttng.org https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev