Fix: check that class and instance prototype match
[lttng-modules.git] / probes / lttng-events.h
index 1b7df762b92586b29b90b6301b0f7fbf25b06cf7..29b44af71d9316b0701adfba64dc4312c3c403e7 100644 (file)
@@ -134,7 +134,41 @@ void trace_##_name(_proto);
 
 #undef LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP_NOARGS
 #define LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP_NOARGS(_template, _name, _map) \
-void trace_##_name(void *__data);
+void trace_##_name(void);
+
+#include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
+
+/*
+ * Stage 1.1 of the trace events.
+ *
+ * Create dummy trace prototypes for each event class, and for each used
+ * template. This will allow checking whether the prototypes from the
+ * class and the instance using the class actually match.
+ */
+
+#include "lttng-events-reset.h"        /* Reset all macros within TRACE_EVENT */
+
+#undef TP_PROTO
+#define TP_PROTO(...)  __VA_ARGS__
+
+#undef TP_ARGS
+#define TP_ARGS(...)   __VA_ARGS__
+
+#undef LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP
+#define LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(_template, _name, _map, _proto, _args) \
+void __event_template_proto___##_template(_proto);
+
+#undef LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP_NOARGS
+#define LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP_NOARGS(_template, _name, _map) \
+void __event_template_proto___##_template(void);
+
+#undef LTTNG_TRACEPOINT_EVENT_CLASS_CODE
+#define LTTNG_TRACEPOINT_EVENT_CLASS_CODE(_name, _proto, _args, _locvar, _code, _fields) \
+void __event_template_proto___##_name(_proto);
+
+#undef LTTNG_TRACEPOINT_EVENT_CLASS_CODE_NOARGS
+#define LTTNG_TRACEPOINT_EVENT_CLASS_CODE_NOARGS(_name, _locvar, _code, _fields) \
+void __event_template_proto___##_name(void);
 
 #include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
 
@@ -182,7 +216,7 @@ void trace_##_name(void *__data);
 #undef _ctf_sequence_encoded
 #define _ctf_sequence_encoded(_type, _item, _src,              \
                        _length_type, _src_length, _encoding,   \
-                       _base, _user, _nowrite)                 \
+                       _byte_order, _base, _user, _nowrite)    \
        {                                                       \
          .name = #_item,                                       \
          .type =                                               \
@@ -193,7 +227,7 @@ void trace_##_name(void *__data);
                          .sequence =                           \
                                {                               \
                                  .length_type = __type_integer(_length_type, __BYTE_ORDER, 10, none), \
-                                 .elem_type = __type_integer(_type, __BYTE_ORDER, _base, _encoding), \
+                                 .elem_type = __type_integer(_type, _byte_order, _base, _encoding), \
                                },                              \
                        },                                      \
                },                                              \
@@ -276,7 +310,7 @@ static void __event_probe__##_name(void *__data);
 
 #undef _ctf_sequence_encoded
 #define _ctf_sequence_encoded(_type, _item, _src, _length_type,                        \
-                       _src_length, _encoding, _base, _user, _nowrite)         \
+                       _src_length, _encoding, _byte_order, _base, _user, _nowrite) \
        __event_len += lib_ring_buffer_align(__event_len, lttng_alignof(_length_type)); \
        __event_len += sizeof(_length_type);                                   \
        __event_len += lib_ring_buffer_align(__event_len, lttng_alignof(_type)); \
@@ -438,28 +472,28 @@ static inline size_t __event_get_size__##_name(size_t *__dynamic_len,           \
                const void *__ctf_tmp_ptr = (_src);                            \
                memcpy(__stack_data, &__ctf_tmp_ulong, sizeof(unsigned long)); \
                __stack_data += sizeof(unsigned long);                         \
-               memcpy(__stack_data, &__ctf_tmp_ptr, sizeof(void **));         \
-               __stack_data += sizeof(void **);                               \
+               memcpy(__stack_data, &__ctf_tmp_ptr, sizeof(void *));          \
+               __stack_data += sizeof(void *);                                \
        }
 
 #undef _ctf_sequence_encoded
 #define _ctf_sequence_encoded(_type, _item, _src, _length_type,                       \
-                       _src_length, _encoding, _base, _user, _nowrite)        \
+                       _src_length, _encoding, _byte_order, _base, _user, _nowrite) \
        {                                                                      \
                unsigned long __ctf_tmp_ulong = (unsigned long) (_src_length); \
                const void *__ctf_tmp_ptr = (_src);                            \
                memcpy(__stack_data, &__ctf_tmp_ulong, sizeof(unsigned long)); \
                __stack_data += sizeof(unsigned long);                         \
-               memcpy(__stack_data, &__ctf_tmp_ptr, sizeof(void **));         \
-               __stack_data += sizeof(void **);                               \
+               memcpy(__stack_data, &__ctf_tmp_ptr, sizeof(void *));          \
+               __stack_data += sizeof(void *);                                \
        }
 
 #undef _ctf_string
 #define _ctf_string(_item, _src, _user, _nowrite)                             \
        {                                                                      \
                const void *__ctf_tmp_ptr = (_src);                            \
-               memcpy(__stack_data, &__ctf_tmp_ptr, sizeof(void **));         \
-               __stack_data += sizeof(void **);                               \
+               memcpy(__stack_data, &__ctf_tmp_ptr, sizeof(void *));          \
+               __stack_data += sizeof(void *);                                \
        }
 
 #undef TP_PROTO
@@ -515,7 +549,7 @@ void __event_prepare_filter_stack__##_name(char *__stack_data,                    \
 
 #undef _ctf_sequence_encoded
 #define _ctf_sequence_encoded(_type, _item, _src, _length_type,                        \
-                       _src_length, _encoding, _base, _user, _nowrite)         \
+                       _src_length, _encoding, _byte_order, _base, _user, _nowrite) \
        __event_align = max_t(size_t, __event_align, lttng_alignof(_length_type)); \
        __event_align = max_t(size_t, __event_align, lttng_alignof(_type));
 
@@ -602,7 +636,7 @@ static inline size_t __event_get_align__##_name(void *__tp_locvar)        \
 
 #undef _ctf_sequence_encoded
 #define _ctf_sequence_encoded(_type, _item, _src, _length_type,                \
-                       _src_length, _encoding, _base, _user, _nowrite) \
+                       _src_length, _encoding, _byte_order, _base, _user, _nowrite) \
        {                                                               \
                _length_type __tmpl = __stackvar.__dynamic_len[__dynamic_len_idx]; \
                lib_ring_buffer_align_ctx(&__ctx, lttng_alignof(_length_type));\
This page took 0.024942 seconds and 4 git commands to generate.