From: Mathieu Desnoyers Date: Tue, 5 Jun 2012 17:08:54 +0000 (-0400) Subject: Fix: perform macro expansion on tracepoint signatures X-Git-Tag: v2.0.4~12 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=fa790c0b78e1e7441268daa8340098e418f43762;p=lttng-ust.git Fix: perform macro expansion on tracepoint signatures The problem can be seen by patching the demo test from lttng-ust as follows: --- a/tests/demo/ust_tests_demo3.h +++ b/tests/demo/ust_tests_demo3.h @@ -22,12 +22,14 @@ extern "C" { * all copies or substantial portions of the Software. */ +#include + #include TRACEPOINT_EVENT(ust_tests_demo3, done, - TP_ARGS(int, value), + TP_ARGS(bool, value), TP_FIELDS( - ctf_integer(int, value, value) + ctf_integer(bool, value, value) ) ) Then when the demo is run with LTTNG_UST_DEBUG=1, a warning is shown, like: liblttng_ust_tracepoint[3315/3315]: Warning: Tracepoint signature mismatch, not enabling one or more tracepoints. Ensure that the tracepoint probes prototypes match the application. (in set_tracepoint() at tracepoint.c:310) liblttng_ust_tracepoint[3315/3315]: Warning: Tracepoint "ust_tests_demo3:done" signatures: call: "_Bool, value" vs probe: "bool, value". (in set_tracepoint() at tracepoint.c:312) It seems that TP_ARGS does not perform preprocessor expansion on the "bool" type spec, while something underneath TP_FIELDS does. And since (at least on this Centos 6.2 box) stdbool.h uses a #define rather than a typedef to make bool equivalent to _Bool, liblttng detects a mismatch. Reported-by: John Steele Scott Signed-off-by: Mathieu Desnoyers --- diff --git a/include/lttng/ust-tracepoint-event.h b/include/lttng/ust-tracepoint-event.h index 520f8c06..c2e95192 100644 --- a/include/lttng/ust-tracepoint-event.h +++ b/include/lttng/ust-tracepoint-event.h @@ -444,15 +444,19 @@ static void __event_probe__##_provider##___##_name(_TP_ARGS_DATA_PROTO(_args))\ #include #undef TP_ARGS -#define TP_ARGS(args...) #args +#define TP_ARGS(args...) args + +#define _TP_EXTRACT_STRING2(...) #__VA_ARGS__ #undef TRACEPOINT_EVENT_CLASS #define TRACEPOINT_EVENT_CLASS(_provider, _name, _args, _fields) \ const char __tp_event_signature___##_provider##___##_name[] = \ - _args; + _TP_EXTRACT_STRING2(_args); #include TRACEPOINT_INCLUDE +#undef _TP_EXTRACT_STRING2 + /* * Stage 6 of tracepoint event generation. *