Fix: perform macro expansion on tracepoint signatures
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Tue, 5 Jun 2012 17:08:54 +0000 (13:08 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Tue, 5 Jun 2012 17:08:54 +0000 (13:08 -0400)
commit9eb061825ad8ebdf8c22d812eff0232d97d72cd2
treefe61e35d5538f226fccb5d9feb75d6b3cc4c9645
parent66bdd22a001a064327026551f8c1ba76a812421b
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 <stdbool.h>
+
 #include <lttng/tracepoint.h>

 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 <toojays@toojays.net>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
include/lttng/ust-tracepoint-event.h
This page took 0.024742 seconds and 4 git commands to generate.