Fix: disable array/sequence compile-time type check in C
[lttng-ust.git] / include / lttng / ust-tracepoint-event.h
CommitLineData
1c324e59 1/*
c0c0989a 2 * SPDX-License-Identifier: MIT
1c324e59 3 *
c0c0989a 4 * Copyright (C) 2011-2012 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
1c324e59
MD
5 */
6
fb31eb73 7#include <stdint.h>
1c324e59 8#include <stdio.h>
7d381d6e 9#include <stdlib.h>
1c324e59 10#include <urcu/compiler.h>
f488575f 11#include <urcu/rculist.h>
1c324e59 12#include <lttng/ust-events.h>
0b4b8811 13#include <lttng/ust-ringbuffer-context.h>
2eba8e39 14#include <lttng/ust-arch.h>
a8909ba5 15#include <lttng/ust-compiler.h>
000b8662 16#include <lttng/tracepoint.h>
3208818b 17#include <lttng/ust-endian.h>
4849bc7a 18#include <lttng/ust-api-compat.h>
44c72f10 19#include <string.h>
f3b06377
MD
20#include <lttng/ust-api-compat.h>
21
22#if LTTNG_UST_COMPAT_API(0)
23#define TP_FIELDS LTTNG_UST_TP_FIELDS
24
25#define ctf_integer lttng_ust_field_integer
26#define ctf_integer_hex lttng_ust_field_integer_hex
27#define ctf_integer_network lttng_ust_field_integer_network
28#define ctf_integer_network_hex lttng_ust_field_integer_network_hex
29#define ctf_integer_nowrite lttng_ust_field_integer_nowrite
30
31#define ctf_float lttng_ust_field_float
32#define ctf_float_nowrite lttng_ust_field_float_nowrite
33
34#define ctf_array lttng_ust_field_array
35#define ctf_array_hex lttng_ust_field_array_hex
36#define ctf_array_network lttng_ust_field_array_network
37#define ctf_array_network_hex lttng_ust_field_array_network_hex
38#define ctf_array_text lttng_ust_field_array_text
39#define ctf_array_nowrite lttng_ust_field_array_nowrite
40#define ctf_array_nowrite_hex lttng_ust_field_array_nowrite_hex
41#define ctf_array_network_nowrite lttng_ust_field_array_network_nowrite
42#define ctf_array_network_nowrite_hex lttng_ust_field_array_network_nowrite_hex
43#define ctf_array_text_nowrite lttng_ust_field_array_text_nowrite
44
45#define ctf_sequence lttng_ust_field_sequence
46#define ctf_sequence_hex lttng_ust_field_sequence_hex
47#define ctf_sequence_network lttng_ust_field_sequence_network
48#define ctf_sequence_network_hex lttng_ust_field_sequence_network_hex
49#define ctf_sequence_text lttng_ust_field_sequence_text
50#define ctf_sequence_nowrite lttng_ust_field_sequence_nowrite
51#define ctf_sequence_nowrite_hex lttng_ust_field_sequence_nowrite_hex
52#define ctf_sequence_network_nowrite lttng_ust_field_sequence_network_nowrite
53#define ctf_sequence_network_nowrite_hex lttng_ust_field_sequence_network_nowrite_hex
54#define ctf_sequence_text_nowrite lttng_ust_field_sequence_text_nowrite
55
56#define ctf_string lttng_ust_field_string
57#define ctf_string_nowrite lttng_ust_field_string_nowrite
58
59#define ctf_unused lttng_ust_field_unused
60#define ctf_unused_nowrite lttng_ust_field_unused_nowrite
61
62#define ctf_enum lttng_ust_field_enum
63#define ctf_enum_nowrite lttng_ust_field_enum_nowrite
64#define ctf_enum_value lttng_ust_field_enum_value
65#define ctf_enum_range lttng_ust_field_enum_range
66#define ctf_enum_auto lttng_ust_field_enum_auto
67#endif /* #if LTTNG_UST_COMPAT_API(0) */
1c324e59 68
ee0889a3 69#define LTTNG_UST__NULL_STRING "(null)"
24a39530 70
1c324e59 71/*
7f2f82c3 72 * LTTNG_UST_TRACEPOINT_EVENT_CLASS declares a class of tracepoints receiving the
1c324e59
MD
73 * same arguments and having the same field layout.
74 *
7f2f82c3 75 * LTTNG_UST_TRACEPOINT_EVENT_INSTANCE declares an instance of a tracepoint, with
1c324e59
MD
76 * its own provider and name. It refers to a class (template).
77 *
7f2f82c3 78 * LTTNG_UST_TRACEPOINT_EVENT declared both a class and an instance and does a
1c324e59
MD
79 * direct mapping from the instance to the class.
80 */
81
7f2f82c3
MJ
82#undef LTTNG_UST_TRACEPOINT_EVENT
83#define LTTNG_UST_TRACEPOINT_EVENT(_provider, _name, _args, _fields) \
84 LTTNG_UST__TRACEPOINT_EVENT_CLASS(_provider, _name, \
6eddcb06
MJ
85 LTTNG_UST__TP_PARAMS(_args), \
86 LTTNG_UST__TP_PARAMS(_fields)) \
5b675300 87 LTTNG_UST__TRACEPOINT_EVENT_INSTANCE(_provider, _name, _provider, _name, \
6eddcb06 88 LTTNG_UST__TP_PARAMS(_args))
1c324e59 89
7f2f82c3
MJ
90#undef LTTNG_UST_TRACEPOINT_EVENT_CLASS
91#define LTTNG_UST_TRACEPOINT_EVENT_CLASS(_provider, _name, _args, _fields) \
6eddcb06 92 LTTNG_UST__TRACEPOINT_EVENT_CLASS(_provider, _name, LTTNG_UST__TP_PARAMS(_args), LTTNG_UST__TP_PARAMS(_fields))
f8021d08 93
7f2f82c3 94#undef LTTNG_UST_TRACEPOINT_EVENT_INSTANCE
5b675300
MD
95#define LTTNG_UST_TRACEPOINT_EVENT_INSTANCE(_template_provider, _template_name, _provider, _name, _args) \
96 LTTNG_UST__TRACEPOINT_EVENT_INSTANCE(_template_provider, _template_name, _provider, _name, LTTNG_UST__TP_PARAMS(_args))
f8021d08 97
1c324e59 98/* Helpers */
ca6ed78d 99#define LTTNG_UST__TP_ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
1c324e59 100
1210ca90 101#define lttng_ust__tp_max_t(type, x, y) \
1c324e59 102 ({ \
1210ca90
MJ
103 type lttng_ust__max1 = (x); \
104 type lttng_ust__max2 = (y); \
105 lttng_ust__max1 > lttng_ust__max2 ? lttng_ust__max1: lttng_ust__max2; \
1c324e59
MD
106 })
107
108/*
109 * Stage 0 of tracepoint event generation.
110 *
7f2f82c3 111 * Check that each LTTNG_UST_TRACEPOINT_EVENT provider argument match the
5b393d64 112 * LTTNG_UST_TRACEPOINT_PROVIDER by creating dummy callbacks.
1c324e59
MD
113 */
114
7f2f82c3 115/* Reset all macros within LTTNG_UST_TRACEPOINT_EVENT */
1c324e59
MD
116#include <lttng/ust-tracepoint-event-reset.h>
117
106ff4da 118static inline
5b393d64 119void LTTNG_UST__TP_COMBINE_TOKENS(lttng_ust_tracepoint_provider_mismatch_, LTTNG_UST_TRACEPOINT_PROVIDER)(void)
106ff4da 120 lttng_ust_notrace;
1c324e59 121static inline
5b393d64 122void LTTNG_UST__TP_COMBINE_TOKENS(lttng_ust_tracepoint_provider_mismatch_, LTTNG_UST_TRACEPOINT_PROVIDER)(void)
1c324e59
MD
123{
124}
125
7f2f82c3
MJ
126#undef LTTNG_UST__TRACEPOINT_EVENT_CLASS
127#define LTTNG_UST__TRACEPOINT_EVENT_CLASS(_provider, _name, _args, _fields) \
0274f7f2 128 lttng_ust_tracepoint_provider_mismatch_##_provider();
1c324e59 129
7f2f82c3 130#undef LTTNG_UST__TRACEPOINT_EVENT_INSTANCE
5b675300 131#define LTTNG_UST__TRACEPOINT_EVENT_INSTANCE(_template_provider, _template_name, _provider, _name, _args) \
0274f7f2 132 lttng_ust_tracepoint_provider_mismatch_##_provider();
1c324e59 133
106ff4da 134static inline
5b393d64 135void LTTNG_UST__TP_COMBINE_TOKENS(lttng_ust_tracepoint_provider_check_, LTTNG_UST_TRACEPOINT_PROVIDER)(void)
106ff4da 136 lttng_ust_notrace;
e8bd1da7 137static inline
5b393d64 138void LTTNG_UST__TP_COMBINE_TOKENS(lttng_ust_tracepoint_provider_check_, LTTNG_UST_TRACEPOINT_PROVIDER)(void)
1c324e59 139{
bb71a8ea 140#include LTTNG_UST_TRACEPOINT_INCLUDE
1c324e59
MD
141}
142
f56cd1d5
MD
143/*
144 * Stage 0.1 of tracepoint event generation.
145 *
7f2f82c3 146 * Check that each LTTNG_UST_TRACEPOINT_EVENT provider:name does not exceed the
f56cd1d5
MD
147 * tracepoint name length limit.
148 */
149
7f2f82c3 150/* Reset all macros within LTTNG_UST_TRACEPOINT_EVENT */
f56cd1d5
MD
151#include <lttng/ust-tracepoint-event-reset.h>
152
7f2f82c3 153#undef LTTNG_UST__TRACEPOINT_EVENT_INSTANCE
5b675300 154#define LTTNG_UST__TRACEPOINT_EVENT_INSTANCE(_template_provider, _template_name, _provider, _name, _args) \
81b16412 155 lttng_ust_tracepoint_validate_name_len(_provider, _name);
f56cd1d5 156
bb71a8ea 157#include LTTNG_UST_TRACEPOINT_INCLUDE
f56cd1d5 158
c75c0422
MD
159/*
160 * Stage 0.2 of tracepoint event generation.
161 *
162 * Create dummy trace prototypes for each event class, and for each used
163 * template. This will allow checking whether the prototypes from the
164 * class and the instance using the class actually match.
165 */
166
7f2f82c3 167/* Reset all macros within LTTNG_UST_TRACEPOINT_EVENT */
c75c0422
MD
168#include <lttng/ust-tracepoint-event-reset.h>
169
cadfcbfc
MJ
170#undef LTTNG_UST_TP_ARGS
171#define LTTNG_UST_TP_ARGS(...) __VA_ARGS__
c75c0422 172
7f2f82c3 173#undef LTTNG_UST__TRACEPOINT_EVENT_INSTANCE
5b675300
MD
174#define LTTNG_UST__TRACEPOINT_EVENT_INSTANCE(_template_provider, _template_name, _provider, _name, _args) \
175void lttng_ust__event_template_proto___##_template_provider##___##_template_name(LTTNG_UST__TP_ARGS_DATA_PROTO(_args));
c75c0422 176
7f2f82c3
MJ
177#undef LTTNG_UST__TRACEPOINT_EVENT_CLASS
178#define LTTNG_UST__TRACEPOINT_EVENT_CLASS(_provider, _name, _args, _fields) \
bfcc2759 179void lttng_ust__event_template_proto___##_provider##___##_name(LTTNG_UST__TP_ARGS_DATA_PROTO(_args));
c75c0422 180
bb71a8ea 181#include LTTNG_UST_TRACEPOINT_INCLUDE
c75c0422 182
c785c634
MD
183/*
184 * Stage 0.9 of tracepoint event generation
185 *
186 * Unfolding the enums
187 */
188#include <lttng/ust-tracepoint-event-reset.h>
189
190/* Enumeration entry (single value) */
78684808
MJ
191#undef lttng_ust_field_enum_value
192#define lttng_ust_field_enum_value(_string, _value) \
5defa774 193 LTTNG_UST_COMPOUND_LITERAL(const struct lttng_ust_enum_entry, { \
891d6b55 194 .struct_size = sizeof(struct lttng_ust_enum_entry), \
a6f80644 195 .start = { \
eae3c729 196 .value = lttng_ust_is_signed_type(__typeof__(_value)) ? \
a6f80644 197 (long long) (_value) : (_value), \
eae3c729 198 .signedness = lttng_ust_is_signed_type(__typeof__(_value)), \
a6f80644
MD
199 }, \
200 .end = { \
eae3c729 201 .value = lttng_ust_is_signed_type(__typeof__(_value)) ? \
a6f80644 202 (long long) (_value) : (_value), \
eae3c729 203 .signedness = lttng_ust_is_signed_type(__typeof__(_value)), \
a6f80644
MD
204 }, \
205 .string = (_string), \
891d6b55 206 }),
c785c634
MD
207
208/* Enumeration entry (range) */
78684808
MJ
209#undef lttng_ust_field_enum_range
210#define lttng_ust_field_enum_range(_string, _range_start, _range_end) \
5defa774 211 LTTNG_UST_COMPOUND_LITERAL(const struct lttng_ust_enum_entry, { \
891d6b55 212 .struct_size = sizeof(struct lttng_ust_enum_entry), \
a6f80644 213 .start = { \
eae3c729 214 .value = lttng_ust_is_signed_type(__typeof__(_range_start)) ? \
a6f80644 215 (long long) (_range_start) : (_range_start), \
eae3c729 216 .signedness = lttng_ust_is_signed_type(__typeof__(_range_start)), \
a6f80644
MD
217 }, \
218 .end = { \
eae3c729 219 .value = lttng_ust_is_signed_type(__typeof__(_range_end)) ? \
a6f80644 220 (long long) (_range_end) : (_range_end), \
eae3c729 221 .signedness = lttng_ust_is_signed_type(__typeof__(_range_end)), \
a6f80644
MD
222 }, \
223 .string = (_string), \
891d6b55 224 }),
c785c634 225
3e762260 226/* Enumeration entry (automatic value; follows the rules of CTF) */
78684808
MJ
227#undef lttng_ust_field_enum_auto
228#define lttng_ust_field_enum_auto(_string) \
5defa774 229 LTTNG_UST_COMPOUND_LITERAL(const struct lttng_ust_enum_entry, { \
891d6b55 230 .struct_size = sizeof(struct lttng_ust_enum_entry), \
3e762260
PP
231 .start = { \
232 .value = -1ULL, \
233 .signedness = 0, \
234 }, \
235 .end = { \
236 .value = -1ULL, \
237 .signedness = 0, \
238 }, \
239 .string = (_string), \
1a37a873 240 .options = LTTNG_UST_ENUM_ENTRY_OPTION_IS_AUTO, \
891d6b55 241 }),
3e762260 242
4849bc7a
MJ
243#undef LTTNG_UST_TP_ENUM_VALUES
244#define LTTNG_UST_TP_ENUM_VALUES(...) \
c785c634
MD
245 __VA_ARGS__
246
4849bc7a
MJ
247#if LTTNG_UST_COMPAT_API(0)
248# undef TP_ENUM_VALUES
249# define TP_ENUM_VALUES LTTNG_UST_TP_ENUM_VALUES
250#endif /* #if LTTNG_UST_COMPAT_API(0) */
251
2ebf164b
MJ
252#undef LTTNG_UST_TRACEPOINT_ENUM
253#define LTTNG_UST_TRACEPOINT_ENUM(_provider, _name, _values) \
3d33ca1d 254 const struct lttng_ust_enum_entry * const __enum_values__##_provider##_##_name[] = { \
c785c634 255 _values \
78684808 256 lttng_ust_field_enum_value("", 0) /* Dummy, 0-len array forbidden by C99. */ \
c785c634 257 };
bb71a8ea 258#include LTTNG_UST_TRACEPOINT_INCLUDE
2df82195 259
f04f60a5
MD
260#if defined(__cplusplus)
261
2df82195
FD
262/*
263 * Stage 0.9.1
f04f60a5
MD
264 * Verifying array and sequence elements are of an integer or pointer
265 * type.
266 *
267 * This compile-time check is only enabled in C++, because the C
268 * implementation of lttng_ust_is_pointer_type does not support opaque
269 * pointer types.
2df82195
FD
270 */
271
7f2f82c3 272/* Reset all macros within LTTNG_UST_TRACEPOINT_EVENT */
2df82195
FD
273#include <lttng/ust-tracepoint-event-reset.h>
274#include <lttng/ust-tracepoint-event-write.h>
275#include <lttng/ust-tracepoint-event-nowrite.h>
276
10937ee5
MJ
277#undef lttng_ust__field_array_encoded
278#define lttng_ust__field_array_encoded(_type, _item, _src, _byte_order, \
2df82195
FD
279 _length, _encoding, _nowrite, \
280 _elem_type_base) \
10937ee5 281 lttng_ust_field_array_element_type_is_supported(_type, _item);
2df82195 282
1d188af9
MJ
283#undef lttng_ust__field_sequence_encoded
284#define lttng_ust__field_sequence_encoded(_type, _item, _src, _byte_order, \
2df82195
FD
285 _length_type, _src_length, _encoding, _nowrite, \
286 _elem_type_base) \
10937ee5 287 lttng_ust_field_array_element_type_is_supported(_type, _item);
2df82195 288
efa14d16
MJ
289#undef LTTNG_UST_TP_FIELDS
290#define LTTNG_UST_TP_FIELDS(...) __VA_ARGS__ /* Only one used in this phase */
2df82195 291
7f2f82c3
MJ
292#undef LTTNG_UST__TRACEPOINT_EVENT_CLASS
293#define LTTNG_UST__TRACEPOINT_EVENT_CLASS(_provider, _name, _args, _fields) \
2df82195 294 _fields
c785c634 295
bb71a8ea 296#include LTTNG_UST_TRACEPOINT_INCLUDE
c785c634 297
f04f60a5
MD
298#endif
299
5b675300
MD
300/*
301 * Stage 0.9.2 of tracepoint event generation.
302 *
303 * Create probe signature
304 */
305
306/* Reset all macros within LTTNG_UST_TRACEPOINT_EVENT */
307#include <lttng/ust-tracepoint-event-reset.h>
308
309#undef LTTNG_UST_TP_ARGS
310#define LTTNG_UST_TP_ARGS(...) __VA_ARGS__
311
312#define LTTNG_UST__TP_EXTRACT_STRING2(...) #__VA_ARGS__
313
314#undef LTTNG_UST__TRACEPOINT_EVENT_CLASS
315#define LTTNG_UST__TRACEPOINT_EVENT_CLASS(_provider, _name, _args, _fields) \
316static const char __tp_event_signature___##_provider##___##_name[] = \
317 LTTNG_UST__TP_EXTRACT_STRING2(_args);
318
319#include LTTNG_UST_TRACEPOINT_INCLUDE
320
321#undef LTTNG_UST__TP_EXTRACT_STRING2
322
1c324e59
MD
323/*
324 * Stage 1 of tracepoint event generation.
325 *
5b675300
MD
326 * Create probe callback prototypes.
327 */
328
329/* Reset all macros within LTTNG_UST_TRACEPOINT_EVENT */
330#include <lttng/ust-tracepoint-event-reset.h>
331
332#undef LTTNG_UST_TP_ARGS
333#define LTTNG_UST_TP_ARGS(...) __VA_ARGS__
334
335#undef LTTNG_UST__TRACEPOINT_EVENT_CLASS
336#define LTTNG_UST__TRACEPOINT_EVENT_CLASS(_provider, _name, _args, _fields) \
337static void lttng_ust__event_probe__##_provider##___##_name(LTTNG_UST__TP_ARGS_DATA_PROTO(_args));
338
339#include LTTNG_UST_TRACEPOINT_INCLUDE
340
2e7160d2
MD
341/*
342 * Stage 1.1 of tracepoint event generation.
343 *
344 * Declare toplevel descriptor for the whole probe.
345 * Unlike C, C++ does not allow tentative definitions. Therefore, we
346 * need to explicitly declare the variable with "extern", using hidden
347 * visibility to keep this symbol from being exported to the global
348 * symbol table.
349 */
350
351extern const struct lttng_ust_probe_desc LTTNG_UST__TP_COMBINE_TOKENS(lttng_ust__probe_desc___, LTTNG_UST_TRACEPOINT_PROVIDER)
352 __attribute__((visibility("hidden")));
353
5b675300
MD
354/*
355 * Stage 2 of tracepoint event generation.
356 *
1c324e59
MD
357 * Create event field type metadata section.
358 * Each event produce an array of fields.
359 */
360
7f2f82c3 361/* Reset all macros within LTTNG_UST_TRACEPOINT_EVENT */
1c324e59 362#include <lttng/ust-tracepoint-event-reset.h>
4774c8f3
MD
363#include <lttng/ust-tracepoint-event-write.h>
364#include <lttng/ust-tracepoint-event-nowrite.h>
1c324e59 365
b4064f28
MJ
366#undef lttng_ust__field_integer_ext
367#define lttng_ust__field_integer_ext(_type, _item, _src, _byte_order, _base, _nowrite) \
5defa774 368 LTTNG_UST_COMPOUND_LITERAL(const struct lttng_ust_event_field, { \
25cff019
MD
369 .struct_size = sizeof(struct lttng_ust_event_field), \
370 .name = #_item, \
a084756d 371 .type = lttng_ust_type_integer_define(_type, _byte_order, _base), \
25cff019
MD
372 .nowrite = _nowrite, \
373 .nofilter = 0, \
374 }),
1c324e59 375
891226fc
MJ
376#undef lttng_ust__field_float
377#define lttng_ust__field_float(_type, _item, _src, _nowrite) \
5defa774 378 LTTNG_UST_COMPOUND_LITERAL(const struct lttng_ust_event_field, { \
25cff019
MD
379 .struct_size = sizeof(struct lttng_ust_event_field), \
380 .name = #_item, \
a084756d 381 .type = lttng_ust_type_float_define(_type), \
25cff019
MD
382 .nowrite = _nowrite, \
383 .nofilter = 0, \
384 }),
1c324e59 385
10937ee5
MJ
386#undef lttng_ust__field_array_encoded
387#define lttng_ust__field_array_encoded(_type, _item, _src, _byte_order, \
f3ec4cb5
MD
388 _length, _encoding, _nowrite, \
389 _elem_type_base) \
5defa774 390 LTTNG_UST_COMPOUND_LITERAL(const struct lttng_ust_event_field, { \
25cff019
MD
391 .struct_size = sizeof(struct lttng_ust_event_field), \
392 .name = #_item, \
5defa774 393 .type = (const struct lttng_ust_type_common *) LTTNG_UST_COMPOUND_LITERAL(const struct lttng_ust_type_array, { \
a084756d
MD
394 .parent = { \
395 .type = lttng_ust_type_array, \
396 }, \
397 .struct_size = sizeof(struct lttng_ust_type_array), \
398 .elem_type = lttng_ust_type_integer_define(_type, _byte_order, _elem_type_base), \
399 .length = _length, \
400 .alignment = 0, \
401 .encoding = lttng_ust_string_encoding_##_encoding, \
402 }), \
25cff019
MD
403 .nowrite = _nowrite, \
404 .nofilter = 0, \
405 }),
1c324e59 406
1d188af9
MJ
407#undef lttng_ust__field_sequence_encoded
408#define lttng_ust__field_sequence_encoded(_type, _item, _src, _byte_order, \
f968510a
PP
409 _length_type, _src_length, _encoding, _nowrite, \
410 _elem_type_base) \
5defa774 411 LTTNG_UST_COMPOUND_LITERAL(const struct lttng_ust_event_field, { \
25cff019
MD
412 .struct_size = sizeof(struct lttng_ust_event_field), \
413 .name = "_" #_item "_length", \
baa8acf3 414 .type = lttng_ust_type_integer_define(_length_type, LTTNG_UST_BYTE_ORDER, 10), \
25cff019
MD
415 .nowrite = _nowrite, \
416 .nofilter = 1, \
417 }), \
5defa774 418 LTTNG_UST_COMPOUND_LITERAL(const struct lttng_ust_event_field, { \
25cff019
MD
419 .struct_size = sizeof(struct lttng_ust_event_field), \
420 .name = #_item, \
5defa774 421 .type = (const struct lttng_ust_type_common *) LTTNG_UST_COMPOUND_LITERAL(const struct lttng_ust_type_sequence, { \
a084756d
MD
422 .parent = { \
423 .type = lttng_ust_type_sequence, \
1c324e59 424 }, \
a084756d 425 .struct_size = sizeof(struct lttng_ust_type_sequence), \
28db0827 426 .length_name = NULL, /* Use previous field. */ \
a084756d
MD
427 .elem_type = lttng_ust_type_integer_define(_type, _byte_order, _elem_type_base), \
428 .alignment = 0, \
429 .encoding = lttng_ust_string_encoding_##_encoding, \
430 }), \
25cff019
MD
431 .nowrite = _nowrite, \
432 .nofilter = 0, \
433 }),
1c324e59 434
3202f63a
MJ
435#undef lttng_ust__field_string
436#define lttng_ust__field_string(_item, _src, _nowrite) \
5defa774 437 LTTNG_UST_COMPOUND_LITERAL(const struct lttng_ust_event_field, { \
25cff019
MD
438 .struct_size = sizeof(struct lttng_ust_event_field), \
439 .name = #_item, \
5defa774 440 .type = (const struct lttng_ust_type_common *) LTTNG_UST_COMPOUND_LITERAL(const struct lttng_ust_type_string, { \
a084756d
MD
441 .parent = { \
442 .type = lttng_ust_type_string, \
46d52200 443 }, \
a084756d
MD
444 .struct_size = sizeof(struct lttng_ust_type_string), \
445 .encoding = lttng_ust_string_encoding_UTF8, \
446 }), \
25cff019
MD
447 .nowrite = _nowrite, \
448 .nofilter = 0, \
449 }),
1c324e59 450
ddde62ca
MJ
451#undef lttng_ust__field_unused
452#define lttng_ust__field_unused(_src)
5152f6df 453
78684808
MJ
454#undef lttng_ust__field_enum
455#define lttng_ust__field_enum(_provider, _name, _type, _item, _src, _nowrite) \
5defa774 456 LTTNG_UST_COMPOUND_LITERAL(const struct lttng_ust_event_field, { \
25cff019 457 .struct_size = sizeof(struct lttng_ust_event_field), \
c785c634 458 .name = #_item, \
5defa774 459 .type = (const struct lttng_ust_type_common *) LTTNG_UST_COMPOUND_LITERAL(const struct lttng_ust_type_enum, { \
a084756d
MD
460 .parent = { \
461 .type = lttng_ust_type_enum, \
c785c634 462 }, \
a084756d
MD
463 .struct_size = sizeof(struct lttng_ust_type_enum), \
464 .desc = &__enum_##_provider##_##_name, \
baa8acf3 465 .container_type = lttng_ust_type_integer_define(_type, LTTNG_UST_BYTE_ORDER, 10), \
a084756d 466 }), \
c785c634 467 .nowrite = _nowrite, \
25cff019
MD
468 .nofilter = 0, \
469 }),
c785c634 470
efa14d16
MJ
471#undef LTTNG_UST_TP_FIELDS
472#define LTTNG_UST_TP_FIELDS(...) __VA_ARGS__ /* Only one used in this phase */
1c324e59 473
7f2f82c3
MJ
474#undef LTTNG_UST__TRACEPOINT_EVENT_CLASS
475#define LTTNG_UST__TRACEPOINT_EVENT_CLASS(_provider, _name, _args, _fields) \
bfcc2759 476 static const struct lttng_ust_event_field * const lttng_ust__event_fields___##_provider##___##_name[] = { \
1c324e59 477 _fields \
b4064f28 478 lttng_ust_field_integer(int, dummy, 0) /* Dummy, C99 forbids 0-len array. */ \
5b675300
MD
479 }; \
480 static const struct lttng_ust_tracepoint_class lttng_ust__event_class___##_provider##___##_name = { \
481 .struct_size = sizeof(struct lttng_ust_tracepoint_class), \
482 .fields = lttng_ust__event_fields___##_provider##___##_name, \
483 .nr_fields = LTTNG_UST__TP_ARRAY_SIZE(lttng_ust__event_fields___##_provider##___##_name) - 1, \
484 .probe_callback = (void (*)(void)) &lttng_ust__event_probe__##_provider##___##_name, \
485 .signature = __tp_event_signature___##_provider##___##_name, \
2e7160d2 486 .probe_desc = &lttng_ust__probe_desc___##_provider, \
1c324e59
MD
487 };
488
2ebf164b
MJ
489#undef LTTNG_UST_TRACEPOINT_ENUM
490#define LTTNG_UST_TRACEPOINT_ENUM(_provider, _name, _values) \
4e48b5d2 491 static const struct lttng_ust_enum_desc __enum_##_provider##_##_name = { \
a084756d 492 .struct_size = sizeof(struct lttng_ust_enum_desc), \
c785c634
MD
493 .name = #_provider "_" #_name, \
494 .entries = __enum_values__##_provider##_##_name, \
ca6ed78d 495 .nr_entries = LTTNG_UST__TP_ARRAY_SIZE(__enum_values__##_provider##_##_name) - 1, \
2e7160d2 496 .probe_desc = &lttng_ust__probe_desc___##_provider, \
c785c634
MD
497 };
498
bb71a8ea 499#include LTTNG_UST_TRACEPOINT_INCLUDE
1c324e59 500
1c324e59 501/*
c785c634 502 * Stage 3.0 of tracepoint event generation.
1c324e59 503 *
1c324e59
MD
504 * Create static inline function that calculates event size.
505 */
506
7f2f82c3 507/* Reset all macros within LTTNG_UST_TRACEPOINT_EVENT */
1c324e59 508#include <lttng/ust-tracepoint-event-reset.h>
4774c8f3 509#include <lttng/ust-tracepoint-event-write.h>
1c324e59 510
b4064f28
MJ
511#undef lttng_ust__field_integer_ext
512#define lttng_ust__field_integer_ext(_type, _item, _src, _byte_order, _base, _nowrite) \
5152f6df
MJ
513 if (0) \
514 (void) (_src); /* Unused */ \
b5457df5 515 __event_len += lttng_ust_ring_buffer_align(__event_len, lttng_ust_rb_alignof(_type)); \
1c324e59
MD
516 __event_len += sizeof(_type);
517
891226fc
MJ
518#undef lttng_ust__field_float
519#define lttng_ust__field_float(_type, _item, _src, _nowrite) \
5152f6df
MJ
520 if (0) \
521 (void) (_src); /* Unused */ \
b5457df5 522 __event_len += lttng_ust_ring_buffer_align(__event_len, lttng_ust_rb_alignof(_type)); \
1c324e59
MD
523 __event_len += sizeof(_type);
524
10937ee5
MJ
525#undef lttng_ust__field_array_encoded
526#define lttng_ust__field_array_encoded(_type, _item, _src, _byte_order, _length, _encoding, \
f3ec4cb5 527 _nowrite, _elem_type_base) \
5152f6df
MJ
528 if (0) \
529 (void) (_src); /* Unused */ \
b5457df5 530 __event_len += lttng_ust_ring_buffer_align(__event_len, lttng_ust_rb_alignof(_type)); \
1c324e59
MD
531 __event_len += sizeof(_type) * (_length);
532
1d188af9
MJ
533#undef lttng_ust__field_sequence_encoded
534#define lttng_ust__field_sequence_encoded(_type, _item, _src, _byte_order, _length_type, \
f968510a 535 _src_length, _encoding, _nowrite, _elem_type_base) \
5152f6df
MJ
536 if (0) \
537 (void) (_src); /* Unused */ \
b5457df5 538 __event_len += lttng_ust_ring_buffer_align(__event_len, lttng_ust_rb_alignof(_length_type)); \
1c324e59 539 __event_len += sizeof(_length_type); \
b5457df5 540 __event_len += lttng_ust_ring_buffer_align(__event_len, lttng_ust_rb_alignof(_type)); \
1c324e59
MD
541 __dynamic_len[__dynamic_len_idx] = (_src_length); \
542 __event_len += sizeof(_type) * __dynamic_len[__dynamic_len_idx]; \
543 __dynamic_len_idx++;
544
3202f63a
MJ
545#undef lttng_ust__field_string
546#define lttng_ust__field_string(_item, _src, _nowrite) \
24a39530 547 __event_len += __dynamic_len[__dynamic_len_idx++] = \
ee0889a3 548 strlen((_src) ? (_src) : LTTNG_UST__NULL_STRING) + 1;
1c324e59 549
ddde62ca
MJ
550#undef lttng_ust__field_unused
551#define lttng_ust__field_unused(_src) \
5152f6df
MJ
552 if (0) \
553 (void) (_src); /* Unused */
554
78684808
MJ
555#undef lttng_ust__field_enum
556#define lttng_ust__field_enum(_provider, _name, _type, _item, _src, _nowrite) \
b4064f28 557 lttng_ust__field_integer_ext(_type, _item, _src, LTTNG_UST_BYTE_ORDER, 10, _nowrite)
c785c634 558
cadfcbfc
MJ
559#undef LTTNG_UST_TP_ARGS
560#define LTTNG_UST_TP_ARGS(...) __VA_ARGS__
1c324e59 561
efa14d16
MJ
562#undef LTTNG_UST_TP_FIELDS
563#define LTTNG_UST_TP_FIELDS(...) __VA_ARGS__
1c324e59 564
7f2f82c3
MJ
565#undef LTTNG_UST__TRACEPOINT_EVENT_CLASS
566#define LTTNG_UST__TRACEPOINT_EVENT_CLASS(_provider, _name, _args, _fields) \
106ff4da 567static inline \
bfcc2759 568size_t lttng_ust__event_get_size__##_provider##___##_name(size_t *__dynamic_len, LTTNG_UST__TP_ARGS_DATA_PROTO(_args)) \
106ff4da 569 lttng_ust_notrace; \
a8909ba5 570static inline \
bfcc2759 571size_t lttng_ust__event_get_size__##_provider##___##_name( \
5152f6df 572 size_t *__dynamic_len __attribute__((__unused__)), \
6eddcb06 573 LTTNG_UST__TP_ARGS_DATA_PROTO(_args)) \
1c324e59
MD
574{ \
575 size_t __event_len = 0; \
5152f6df 576 unsigned int __dynamic_len_idx __attribute__((__unused__)) = 0; \
1c324e59
MD
577 \
578 if (0) \
5152f6df
MJ
579 (void) __tp_data; /* don't warn if unused */ \
580 \
1c324e59
MD
581 _fields \
582 return __event_len; \
583}
584
bb71a8ea 585#include LTTNG_UST_TRACEPOINT_INCLUDE
1c324e59 586
1ddfd641
MD
587/*
588 * Stage 3.1 of tracepoint event generation.
589 *
590 * Create static inline function that layout the filter stack data.
4774c8f3 591 * We make both write and nowrite data available to the filter.
1ddfd641
MD
592 */
593
7f2f82c3 594/* Reset all macros within LTTNG_UST_TRACEPOINT_EVENT */
1ddfd641 595#include <lttng/ust-tracepoint-event-reset.h>
4774c8f3
MD
596#include <lttng/ust-tracepoint-event-write.h>
597#include <lttng/ust-tracepoint-event-nowrite.h>
1ddfd641 598
b4064f28
MJ
599#undef lttng_ust__field_integer_ext
600#define lttng_ust__field_integer_ext(_type, _item, _src, _byte_order, _base, _nowrite) \
eae3c729 601 if (lttng_ust_is_signed_type(_type)) { \
3ebeea0d
MD
602 int64_t __ctf_tmp_int64; \
603 switch (sizeof(_type)) { \
604 case 1: \
605 { \
606 union { _type t; int8_t v; } __tmp = { (_type) (_src) }; \
607 __ctf_tmp_int64 = (int64_t) __tmp.v; \
608 break; \
609 } \
610 case 2: \
611 { \
612 union { _type t; int16_t v; } __tmp = { (_type) (_src) }; \
baa8acf3
MJ
613 if (_byte_order != LTTNG_UST_BYTE_ORDER) \
614 __tmp.v = lttng_ust_bswap_16(__tmp.v); \
3ebeea0d
MD
615 __ctf_tmp_int64 = (int64_t) __tmp.v; \
616 break; \
617 } \
618 case 4: \
619 { \
620 union { _type t; int32_t v; } __tmp = { (_type) (_src) }; \
baa8acf3
MJ
621 if (_byte_order != LTTNG_UST_BYTE_ORDER) \
622 __tmp.v = lttng_ust_bswap_32(__tmp.v); \
3ebeea0d
MD
623 __ctf_tmp_int64 = (int64_t) __tmp.v; \
624 break; \
625 } \
626 case 8: \
627 { \
628 union { _type t; int64_t v; } __tmp = { (_type) (_src) }; \
baa8acf3
MJ
629 if (_byte_order != LTTNG_UST_BYTE_ORDER) \
630 __tmp.v = lttng_ust_bswap_64(__tmp.v); \
3ebeea0d
MD
631 __ctf_tmp_int64 = (int64_t) __tmp.v; \
632 break; \
633 } \
634 default: \
635 abort(); \
636 }; \
fa099471
MD
637 memcpy(__stack_data, &__ctf_tmp_int64, sizeof(int64_t)); \
638 } else { \
3ebeea0d
MD
639 uint64_t __ctf_tmp_uint64; \
640 switch (sizeof(_type)) { \
641 case 1: \
642 { \
643 union { _type t; uint8_t v; } __tmp = { (_type) (_src) }; \
644 __ctf_tmp_uint64 = (uint64_t) __tmp.v; \
645 break; \
646 } \
647 case 2: \
648 { \
649 union { _type t; uint16_t v; } __tmp = { (_type) (_src) }; \
baa8acf3
MJ
650 if (_byte_order != LTTNG_UST_BYTE_ORDER) \
651 __tmp.v = lttng_ust_bswap_16(__tmp.v); \
3ebeea0d
MD
652 __ctf_tmp_uint64 = (uint64_t) __tmp.v; \
653 break; \
654 } \
655 case 4: \
656 { \
657 union { _type t; uint32_t v; } __tmp = { (_type) (_src) }; \
baa8acf3
MJ
658 if (_byte_order != LTTNG_UST_BYTE_ORDER) \
659 __tmp.v = lttng_ust_bswap_32(__tmp.v); \
3ebeea0d
MD
660 __ctf_tmp_uint64 = (uint64_t) __tmp.v; \
661 break; \
662 } \
663 case 8: \
664 { \
665 union { _type t; uint64_t v; } __tmp = { (_type) (_src) }; \
baa8acf3
MJ
666 if (_byte_order != LTTNG_UST_BYTE_ORDER) \
667 __tmp.v = lttng_ust_bswap_64(__tmp.v); \
3ebeea0d
MD
668 __ctf_tmp_uint64 = (uint64_t) __tmp.v; \
669 break; \
670 } \
671 default: \
672 abort(); \
673 }; \
fa099471
MD
674 memcpy(__stack_data, &__ctf_tmp_uint64, sizeof(uint64_t)); \
675 } \
1ddfd641
MD
676 __stack_data += sizeof(int64_t);
677
891226fc
MJ
678#undef lttng_ust__field_float
679#define lttng_ust__field_float(_type, _item, _src, _nowrite) \
fa099471
MD
680 { \
681 double __ctf_tmp_double = (double) (_type) (_src); \
682 memcpy(__stack_data, &__ctf_tmp_double, sizeof(double)); \
683 __stack_data += sizeof(double); \
684 }
1ddfd641 685
10937ee5
MJ
686#undef lttng_ust__field_array_encoded
687#define lttng_ust__field_array_encoded(_type, _item, _src, _byte_order, _length, \
f3ec4cb5 688 _encoding, _nowrite, _elem_type_base) \
fa099471
MD
689 { \
690 unsigned long __ctf_tmp_ulong = (unsigned long) (_length); \
59034aab 691 const void *__ctf_tmp_ptr = (_src); \
fa099471
MD
692 memcpy(__stack_data, &__ctf_tmp_ulong, sizeof(unsigned long)); \
693 __stack_data += sizeof(unsigned long); \
b1239ad6
MD
694 memcpy(__stack_data, &__ctf_tmp_ptr, sizeof(void *)); \
695 __stack_data += sizeof(void *); \
fa099471 696 }
1ddfd641 697
1d188af9
MJ
698#undef lttng_ust__field_sequence_encoded
699#define lttng_ust__field_sequence_encoded(_type, _item, _src, _byte_order, _length_type, \
f968510a 700 _src_length, _encoding, _nowrite, _elem_type_base) \
fa099471
MD
701 { \
702 unsigned long __ctf_tmp_ulong = (unsigned long) (_src_length); \
59034aab 703 const void *__ctf_tmp_ptr = (_src); \
fa099471
MD
704 memcpy(__stack_data, &__ctf_tmp_ulong, sizeof(unsigned long)); \
705 __stack_data += sizeof(unsigned long); \
b1239ad6
MD
706 memcpy(__stack_data, &__ctf_tmp_ptr, sizeof(void *)); \
707 __stack_data += sizeof(void *); \
fa099471 708 }
1ddfd641 709
3202f63a
MJ
710#undef lttng_ust__field_string
711#define lttng_ust__field_string(_item, _src, _nowrite) \
fa099471 712 { \
24a39530 713 const void *__ctf_tmp_ptr = \
ee0889a3 714 ((_src) ? (_src) : LTTNG_UST__NULL_STRING); \
b1239ad6
MD
715 memcpy(__stack_data, &__ctf_tmp_ptr, sizeof(void *)); \
716 __stack_data += sizeof(void *); \
fa099471 717 }
1ddfd641 718
ddde62ca
MJ
719#undef lttng_ust__field_unused
720#define lttng_ust__field_unused(_src) \
5152f6df
MJ
721 if (0) \
722 (void) (_src);
723
78684808
MJ
724#undef lttng_ust__field_enum
725#define lttng_ust__field_enum(_provider, _name, _type, _item, _src, _nowrite) \
b4064f28 726 lttng_ust__field_integer_ext(_type, _item, _src, LTTNG_UST_BYTE_ORDER, 10, _nowrite)
c785c634 727
cadfcbfc
MJ
728#undef LTTNG_UST_TP_ARGS
729#define LTTNG_UST_TP_ARGS(...) __VA_ARGS__
1ddfd641 730
efa14d16
MJ
731#undef LTTNG_UST_TP_FIELDS
732#define LTTNG_UST_TP_FIELDS(...) __VA_ARGS__
1ddfd641 733
7f2f82c3
MJ
734#undef LTTNG_UST__TRACEPOINT_EVENT_CLASS
735#define LTTNG_UST__TRACEPOINT_EVENT_CLASS(_provider, _name, _args, _fields) \
1ddfd641 736static inline \
bfcc2759 737void lttng_ust__event_prepare_interpreter_stack__##_provider##___##_name(char *__stack_data,\
6eddcb06 738 LTTNG_UST__TP_ARGS_DATA_PROTO(_args)) \
1ddfd641 739{ \
5152f6df
MJ
740 if (0) { \
741 (void) __tp_data; /* don't warn if unused */ \
742 (void) __stack_data; /* don't warn if unused */ \
743 } \
744 \
1ddfd641
MD
745 _fields \
746}
747
bb71a8ea 748#include LTTNG_UST_TRACEPOINT_INCLUDE
1ddfd641 749
1c324e59 750/*
df854e41 751 * Stage 4 of tracepoint event generation.
1c324e59
MD
752 *
753 * Create static inline function that calculates event payload alignment.
754 */
755
7f2f82c3 756/* Reset all macros within LTTNG_UST_TRACEPOINT_EVENT */
1c324e59 757#include <lttng/ust-tracepoint-event-reset.h>
4774c8f3 758#include <lttng/ust-tracepoint-event-write.h>
1c324e59 759
b4064f28
MJ
760#undef lttng_ust__field_integer_ext
761#define lttng_ust__field_integer_ext(_type, _item, _src, _byte_order, _base, _nowrite) \
5152f6df
MJ
762 if (0) \
763 (void) (_src); /* Unused */ \
26376e52 764 __event_align = lttng_ust__tp_max_t(size_t, __event_align, lttng_ust_rb_alignof(_type));
1c324e59 765
891226fc
MJ
766#undef lttng_ust__field_float
767#define lttng_ust__field_float(_type, _item, _src, _nowrite) \
5152f6df
MJ
768 if (0) \
769 (void) (_src); /* Unused */ \
26376e52 770 __event_align = lttng_ust__tp_max_t(size_t, __event_align, lttng_ust_rb_alignof(_type));
1c324e59 771
10937ee5
MJ
772#undef lttng_ust__field_array_encoded
773#define lttng_ust__field_array_encoded(_type, _item, _src, _byte_order, _length, \
f3ec4cb5 774 _encoding, _nowrite, _elem_type_base) \
5152f6df
MJ
775 if (0) \
776 (void) (_src); /* Unused */ \
26376e52 777 __event_align = lttng_ust__tp_max_t(size_t, __event_align, lttng_ust_rb_alignof(_type));
1c324e59 778
1d188af9
MJ
779#undef lttng_ust__field_sequence_encoded
780#define lttng_ust__field_sequence_encoded(_type, _item, _src, _byte_order, _length_type, \
f968510a 781 _src_length, _encoding, _nowrite, _elem_type_base) \
5152f6df
MJ
782 if (0) \
783 (void) (_src); /* Unused */ \
784 if (0) \
785 (void) (_src_length); /* Unused */ \
26376e52
MD
786 __event_align = lttng_ust__tp_max_t(size_t, __event_align, lttng_ust_rb_alignof(_length_type)); \
787 __event_align = lttng_ust__tp_max_t(size_t, __event_align, lttng_ust_rb_alignof(_type));
1c324e59 788
3202f63a
MJ
789#undef lttng_ust__field_string
790#define lttng_ust__field_string(_item, _src, _nowrite) \
5152f6df
MJ
791 if (0) \
792 (void) (_src); /* Unused */
793
ddde62ca
MJ
794#undef lttng_ust__field_unused
795#define lttng_ust__field_unused(_src) \
5152f6df
MJ
796 if (0) \
797 (void) (_src); /* Unused */
1c324e59 798
78684808
MJ
799#undef lttng_ust__field_enum
800#define lttng_ust__field_enum(_provider, _name, _type, _item, _src, _nowrite) \
b4064f28 801 lttng_ust__field_integer_ext(_type, _item, _src, LTTNG_UST_BYTE_ORDER, 10, _nowrite)
c785c634 802
cadfcbfc
MJ
803#undef LTTNG_UST_TP_ARGS
804#define LTTNG_UST_TP_ARGS(...) __VA_ARGS__
1c324e59 805
efa14d16
MJ
806#undef LTTNG_UST_TP_FIELDS
807#define LTTNG_UST_TP_FIELDS(...) __VA_ARGS__
1c324e59 808
7f2f82c3
MJ
809#undef LTTNG_UST__TRACEPOINT_EVENT_CLASS
810#define LTTNG_UST__TRACEPOINT_EVENT_CLASS(_provider, _name, _args, _fields) \
106ff4da 811static inline \
bfcc2759 812size_t lttng_ust__event_get_align__##_provider##___##_name(LTTNG_UST__TP_ARGS_PROTO(_args)) \
106ff4da 813 lttng_ust_notrace; \
1c324e59 814static inline \
bfcc2759 815size_t lttng_ust__event_get_align__##_provider##___##_name(LTTNG_UST__TP_ARGS_PROTO(_args)) \
1c324e59 816{ \
26376e52 817 size_t __event_align = 1; \
1c324e59 818 _fields \
26376e52 819 return __event_align; \
1c324e59
MD
820}
821
bb71a8ea 822#include LTTNG_UST_TRACEPOINT_INCLUDE
1c324e59
MD
823
824
825/*
df854e41 826 * Stage 5 of tracepoint event generation.
1c324e59
MD
827 *
828 * Create the probe function. This function calls event size calculation
829 * and writes event data into the buffer.
830 */
831
7f2f82c3 832/* Reset all macros within LTTNG_UST_TRACEPOINT_EVENT */
1c324e59 833#include <lttng/ust-tracepoint-event-reset.h>
4774c8f3 834#include <lttng/ust-tracepoint-event-write.h>
1c324e59 835
b4064f28
MJ
836#undef lttng_ust__field_integer_ext
837#define lttng_ust__field_integer_ext(_type, _item, _src, _byte_order, _base, _nowrite) \
1c324e59
MD
838 { \
839 _type __tmp = (_src); \
8936b6c0 840 __chan->ops->event_write(&__ctx, &__tmp, sizeof(__tmp), lttng_ust_rb_alignof(__tmp));\
1c324e59
MD
841 }
842
891226fc
MJ
843#undef lttng_ust__field_float
844#define lttng_ust__field_float(_type, _item, _src, _nowrite) \
1c324e59
MD
845 { \
846 _type __tmp = (_src); \
8936b6c0 847 __chan->ops->event_write(&__ctx, &__tmp, sizeof(__tmp), lttng_ust_rb_alignof(__tmp));\
1c324e59
MD
848 }
849
10937ee5
MJ
850#undef lttng_ust__field_array_encoded
851#define lttng_ust__field_array_encoded(_type, _item, _src, _byte_order, _length, \
f3ec4cb5 852 _encoding, _nowrite, _elem_type_base) \
27927814 853 if (lttng_ust_string_encoding_##_encoding == lttng_ust_string_encoding_none) \
8936b6c0 854 __chan->ops->event_write(&__ctx, _src, sizeof(_type) * (_length), lttng_ust_rb_alignof(_type)); \
27927814 855 else \
879f9b0a 856 __chan->ops->event_pstrcpy_pad(&__ctx, (const char *) (_src), _length); \
1c324e59 857
1d188af9
MJ
858#undef lttng_ust__field_sequence_encoded
859#define lttng_ust__field_sequence_encoded(_type, _item, _src, _byte_order, _length_type, \
f968510a 860 _src_length, _encoding, _nowrite, _elem_type_base) \
1c324e59 861 { \
d71b57b9 862 _length_type __tmpl = __stackvar.__dynamic_len[__dynamic_len_idx]; \
8936b6c0 863 __chan->ops->event_write(&__ctx, &__tmpl, sizeof(_length_type), lttng_ust_rb_alignof(_length_type));\
1c324e59 864 } \
27927814
MD
865 if (lttng_ust_string_encoding_##_encoding == lttng_ust_string_encoding_none) \
866 __chan->ops->event_write(&__ctx, _src, \
bae1f483 867 sizeof(_type) * lttng_ust__get_dynamic_len(dest), lttng_ust_rb_alignof(_type)); \
27927814 868 else \
bae1f483 869 __chan->ops->event_pstrcpy_pad(&__ctx, (const char *) (_src), lttng_ust__get_dynamic_len(dest)); \
1c324e59 870
3202f63a
MJ
871#undef lttng_ust__field_string
872#define lttng_ust__field_string(_item, _src, _nowrite) \
24a39530
PP
873 { \
874 const char *__ctf_tmp_string = \
ee0889a3 875 ((_src) ? (_src) : LTTNG_UST__NULL_STRING); \
f9ec4a97 876 __chan->ops->event_strcpy(&__ctx, __ctf_tmp_string, \
bae1f483 877 lttng_ust__get_dynamic_len(dest)); \
24a39530
PP
878 }
879
ddde62ca
MJ
880#undef lttng_ust__field_unused
881#define lttng_ust__field_unused(_src)
1c324e59 882
78684808
MJ
883#undef lttng_ust__field_enum
884#define lttng_ust__field_enum(_provider, _name, _type, _item, _src, _nowrite) \
b4064f28 885 lttng_ust__field_integer_ext(_type, _item, _src, LTTNG_UST_BYTE_ORDER, 10, _nowrite)
c785c634 886
1c324e59 887/* Beware: this get len actually consumes the len value */
bae1f483
MJ
888#undef lttng_ust__get_dynamic_len
889#define lttng_ust__get_dynamic_len(field) __stackvar.__dynamic_len[__dynamic_len_idx++]
1c324e59 890
cadfcbfc
MJ
891#undef LTTNG_UST_TP_ARGS
892#define LTTNG_UST_TP_ARGS(...) __VA_ARGS__
1c324e59 893
efa14d16
MJ
894#undef LTTNG_UST_TP_FIELDS
895#define LTTNG_UST_TP_FIELDS(...) __VA_ARGS__
1c324e59 896
95c25348
PW
897/*
898 * For state dump, check that "session" argument (mandatory) matches the
899 * session this event belongs to. Ensures that we write state dump data only
900 * into the started session, not into all sessions.
901 */
91fe3e13
MJ
902#undef LTTNG_UST__TP_SESSION_CHECK
903#ifdef LTTNG_UST_TP_SESSION_CHECK
904#define LTTNG_UST__TP_SESSION_CHECK(session, csession) (session == csession)
95c25348 905#else /* TP_SESSION_CHECK */
91fe3e13 906#define LTTNG_UST__TP_SESSION_CHECK(session, csession) 1
95c25348
PW
907#endif /* TP_SESSION_CHECK */
908
97904b41
MD
909/*
910 * Use of __builtin_return_address(0) sometimes seems to cause stack
911 * corruption on 32-bit PowerPC. Disable this feature on that
912 * architecture for now by always using the NULL value for the ip
913 * context.
914 */
c28c4a88
MJ
915#undef LTTNG_UST__TP_IP_PARAM
916
917#ifdef LTTNG_UST_TP_IP_PARAM
918#define LTTNG_UST__TP_IP_PARAM(x) (x)
5dadb547 919#else /* TP_IP_PARAM */
97904b41 920
2eba8e39 921#if defined(LTTNG_UST_ARCH_PPC) && !defined(LTTNG_UST_ARCH_PPC64)
c28c4a88 922#define LTTNG_UST__TP_IP_PARAM(x) NULL
2eba8e39 923#else
c28c4a88 924#define LTTNG_UST__TP_IP_PARAM(x) __builtin_return_address(0)
2eba8e39 925#endif
97904b41 926
5dadb547
MD
927#endif /* TP_IP_PARAM */
928
1ddfd641
MD
929/*
930 * Using twice size for filter stack data to hold size and pointer for
931 * each field (worse case). For integers, max size required is 64-bit.
932 * Same for double-precision floats. Those fit within
933 * 2*sizeof(unsigned long) for all supported architectures.
61ce3223 934 * Perform UNION (||) of filter runtime list.
1ddfd641 935 */
7f2f82c3 936#undef LTTNG_UST__TRACEPOINT_EVENT_CLASS
b2e37d27 937#define LTTNG_UST__TRACEPOINT_EVENT_CLASS(_provider, _name, _args, _fields) \
106ff4da 938static \
b2e37d27 939void lttng_ust__event_probe__##_provider##___##_name(LTTNG_UST__TP_ARGS_DATA_PROTO(_args)) \
106ff4da 940 lttng_ust_notrace; \
a8909ba5 941static \
b2e37d27 942void lttng_ust__event_probe__##_provider##___##_name(LTTNG_UST__TP_ARGS_DATA_PROTO(_args)) \
1c324e59 943{ \
ba99fbe2 944 struct lttng_ust_event_common *__event = (struct lttng_ust_event_common *) __tp_data; \
1c324e59 945 size_t __dynamic_len_idx = 0; \
bfcc2759 946 const size_t __num_fields = LTTNG_UST__TP_ARRAY_SIZE(lttng_ust__event_fields___##_provider##___##_name) - 1; \
b2e37d27 947 struct lttng_ust_probe_ctx __probe_ctx; \
d71b57b9 948 union { \
75026e9f 949 size_t __dynamic_len[__num_fields]; \
ba99fbe2 950 char __interpreter_stack_data[2 * sizeof(unsigned long) * __num_fields]; \
d71b57b9 951 } __stackvar; \
1c324e59 952 int __ret; \
a2e4d05e 953 bool __interpreter_stack_prepared = false; \
1c324e59
MD
954 \
955 if (0) \
956 (void) __dynamic_len_idx; /* don't warn if unused */ \
ba99fbe2
MD
957 switch (__event->type) { \
958 case LTTNG_UST_EVENT_TYPE_RECORDER: \
959 { \
26376e52
MD
960 struct lttng_ust_event_recorder *__event_recorder = (struct lttng_ust_event_recorder *) __event->child; \
961 struct lttng_ust_channel_buffer *__chan = __event_recorder->chan; \
e7bc0ef6 962 struct lttng_ust_channel_common *__chan_common = __chan->parent; \
ba99fbe2 963 \
b2e37d27 964 if (!LTTNG_UST__TP_SESSION_CHECK(session, __chan_common->session)) \
ba99fbe2 965 return; \
e7bc0ef6 966 if (caa_unlikely(!CMM_ACCESS_ONCE(__chan_common->session->active))) \
ba99fbe2 967 return; \
e7bc0ef6 968 if (caa_unlikely(!CMM_ACCESS_ONCE(__chan_common->enabled))) \
ba99fbe2
MD
969 return; \
970 break; \
971 } \
972 case LTTNG_UST_EVENT_TYPE_NOTIFIER: \
973 break; \
974 } \
975 if (caa_unlikely(!CMM_ACCESS_ONCE(__event->enabled))) \
1c324e59 976 return; \
b2e37d27 977 if (caa_unlikely(!LTTNG_UST_TP_RCU_LINK_TEST())) \
1b436e01 978 return; \
b2e37d27
MD
979 __probe_ctx.struct_size = sizeof(struct lttng_ust_probe_ctx); \
980 __probe_ctx.ip = LTTNG_UST__TP_IP_PARAM(LTTNG_UST_TP_IP_PARAM); \
981 if (caa_unlikely(CMM_ACCESS_ONCE(__event->eval_filter))) { \
bfcc2759 982 lttng_ust__event_prepare_interpreter_stack__##_provider##___##_name(__stackvar.__interpreter_stack_data, \
b2e37d27 983 LTTNG_UST__TP_ARGS_DATA_VAR(_args)); \
a2e4d05e 984 __interpreter_stack_prepared = true; \
b2e37d27
MD
985 if (caa_likely(__event->run_filter(__event, \
986 __stackvar.__interpreter_stack_data, &__probe_ctx, NULL) != LTTNG_UST_EVENT_FILTER_ACCEPT)) \
61ce3223 987 return; \
1ddfd641 988 } \
ba99fbe2
MD
989 switch (__event->type) { \
990 case LTTNG_UST_EVENT_TYPE_RECORDER: \
991 { \
26376e52
MD
992 size_t __event_len, __event_align; \
993 struct lttng_ust_event_recorder *__event_recorder = (struct lttng_ust_event_recorder *) __event->child; \
994 struct lttng_ust_channel_buffer *__chan = __event_recorder->chan; \
b2e37d27 995 struct lttng_ust_ring_buffer_ctx __ctx; \
ba99fbe2 996 \
bfcc2759 997 __event_len = lttng_ust__event_get_size__##_provider##___##_name(__stackvar.__dynamic_len, \
6eddcb06 998 LTTNG_UST__TP_ARGS_DATA_VAR(_args)); \
26376e52
MD
999 __event_align = lttng_ust__event_get_align__##_provider##___##_name(LTTNG_UST__TP_ARGS_VAR(_args)); \
1000 lttng_ust_ring_buffer_ctx_init(&__ctx, __event_recorder, __event_len, __event_align, \
b2e37d27 1001 &__probe_ctx); \
8936b6c0 1002 __ret = __chan->ops->event_reserve(&__ctx); \
ba99fbe2
MD
1003 if (__ret < 0) \
1004 return; \
1005 _fields \
1006 __chan->ops->event_commit(&__ctx); \
1007 break; \
1008 } \
1009 case LTTNG_UST_EVENT_TYPE_NOTIFIER: \
1010 { \
26376e52 1011 struct lttng_ust_event_notifier *__event_notifier = (struct lttng_ust_event_notifier *) __event->child; \
a2e4d05e
MD
1012 struct lttng_ust_notification_ctx __notif_ctx; \
1013 \
1014 __notif_ctx.struct_size = sizeof(struct lttng_ust_notification_ctx); \
26376e52 1015 __notif_ctx.eval_capture = CMM_ACCESS_ONCE(__event_notifier->eval_capture); \
ba99fbe2 1016 \
a2e4d05e 1017 if (caa_unlikely(!__interpreter_stack_prepared && __notif_ctx.eval_capture)) \
bfcc2759 1018 lttng_ust__event_prepare_interpreter_stack__##_provider##___##_name(__stackvar.__interpreter_stack_data, \
b2e37d27 1019 LTTNG_UST__TP_ARGS_DATA_VAR(_args)); \
ba99fbe2 1020 \
26376e52 1021 __event_notifier->notification_send(__event_notifier, \
a2e4d05e 1022 __stackvar.__interpreter_stack_data, \
b2e37d27 1023 &__probe_ctx, \
a2e4d05e 1024 &__notif_ctx); \
ba99fbe2
MD
1025 break; \
1026 } \
1027 } \
1c324e59
MD
1028}
1029
bb71a8ea 1030#include LTTNG_UST_TRACEPOINT_INCLUDE
1c324e59 1031
bae1f483 1032#undef lttng_ust__get_dynamic_len
1c324e59 1033
05ceaafd 1034/*
882a56d7 1035 * Stage 6 of tracepoint event generation.
1c324e59 1036 *
df854e41
MD
1037 * Tracepoint loglevel mapping definition generation. We generate a
1038 * symbol for each mapping for a provider/event to ensure at most a 1 to
1039 * 1 mapping between events and loglevels. If the symbol is repeated,
1040 * the compiler will complain.
05ceaafd
MD
1041 */
1042
7f2f82c3 1043/* Reset all macros within LTTNG_UST_TRACEPOINT_EVENT */
05ceaafd
MD
1044#include <lttng/ust-tracepoint-event-reset.h>
1045
4ea4f80e
MD
1046/*
1047 * Declare _loglevel___##__provider##___##__name as non-static, with
1048 * hidden visibility for c++ handling of weakref. We do a weakref to the
1049 * symbol in a later stage, which requires that the symbol is not
1050 * mangled.
1051 */
1052#ifdef __cplusplus
fc6d7bef 1053#define LTTNG_UST_TP_EXTERN_C extern "C"
4ea4f80e 1054#else
fc6d7bef 1055#define LTTNG_UST_TP_EXTERN_C
4ea4f80e
MD
1056#endif
1057
612e9ce4
MJ
1058#undef LTTNG_UST_TRACEPOINT_LOGLEVEL
1059#define LTTNG_UST_TRACEPOINT_LOGLEVEL(__provider, __name, __loglevel) \
3d33ca1d
MD
1060static const int _loglevel_value___##__provider##___##__name = __loglevel; \
1061LTTNG_UST_TP_EXTERN_C const int * const _loglevel___##__provider##___##__name \
1062 __attribute__((visibility("hidden"))) = \
457a6b58 1063 &_loglevel_value___##__provider##___##__name;
df854e41 1064
bb71a8ea 1065#include LTTNG_UST_TRACEPOINT_INCLUDE
df854e41 1066
fc6d7bef 1067#undef LTTNG_UST_TP_EXTERN_C
4ea4f80e 1068
6ddc916d
MD
1069/*
1070 * Stage 6.1 of tracepoint event generation.
1071 *
1072 * Tracepoint UML URI info.
1073 */
1074
7f2f82c3 1075/* Reset all macros within LTTNG_UST_TRACEPOINT_EVENT */
6ddc916d
MD
1076#include <lttng/ust-tracepoint-event-reset.h>
1077
4ea4f80e
MD
1078/*
1079 * Declare _model_emf_uri___##__provider##___##__name as non-static,
1080 * with hidden visibility for c++ handling of weakref. We do a weakref
1081 * to the symbol in a later stage, which requires that the symbol is not
1082 * mangled.
1083 */
1084#ifdef __cplusplus
fc6d7bef 1085#define LTTNG_UST_TP_EXTERN_C extern "C"
4ea4f80e 1086#else
fc6d7bef 1087#define LTTNG_UST_TP_EXTERN_C
4ea4f80e
MD
1088#endif
1089
dbcc2f92
MJ
1090#undef LTTNG_UST_TRACEPOINT_MODEL_EMF_URI
1091#define LTTNG_UST_TRACEPOINT_MODEL_EMF_URI(__provider, __name, __uri) \
3d33ca1d 1092LTTNG_UST_TP_EXTERN_C const char * const _model_emf_uri___##__provider##___##__name \
082802f9 1093 __attribute__((visibility("hidden"))) = __uri; \
6ddc916d 1094
bb71a8ea 1095#include LTTNG_UST_TRACEPOINT_INCLUDE
6ddc916d 1096
fc6d7bef 1097#undef LTTNG_UST_TP_EXTERN_C
4ea4f80e 1098
5b4c6da4
MD
1099/*
1100 * Stage 7.0 of tracepoint event generation.
1101 *
df854e41 1102 * Create events description structures. We use a weakref because
3d33ca1d 1103 * loglevels are optional. If not declared, the event will point to
df854e41 1104 * a loglevel that contains NULL.
3d33ca1d
MD
1105 *
1106 * C++ requires that const objects have a user-declared default
1107 * constructor. However, in both C++ and C, weakref cannot be
1108 * initialized because it causes the weakref attribute to be ignored.
1109 * Therefore, the loglevel and model_emf_uri pointers are not const
1110 * to ensure C++ compilers default-initialize them.
df854e41
MD
1111 */
1112
7f2f82c3 1113/* Reset all macros within LTTNG_UST_TRACEPOINT_EVENT */
df854e41
MD
1114#include <lttng/ust-tracepoint-event-reset.h>
1115
7f2f82c3 1116#undef LTTNG_UST__TRACEPOINT_EVENT_INSTANCE
5b675300 1117#define LTTNG_UST__TRACEPOINT_EVENT_INSTANCE(_template_provider, _template_name, _provider, _name, _args) \
882a56d7
MD
1118static const int * \
1119 __ref_loglevel___##_provider##___##_name \
1120 __attribute__((weakref ("_loglevel___" #_provider "___" #_name))); \
6ddc916d
MD
1121static const char * \
1122 __ref_model_emf_uri___##_provider##___##_name \
1123 __attribute__((weakref ("_model_emf_uri___" #_provider "___" #_name)));\
bfcc2759 1124static const struct lttng_ust_event_desc lttng_ust__event_desc___##_provider##_##_name = { \
dc11f93f 1125 .struct_size = sizeof(struct lttng_ust_event_desc), \
5b4c6da4 1126 .event_name = #_name, \
c9201081 1127 .probe_desc = &lttng_ust__probe_desc___##_provider, \
5b675300 1128 .tp_class = &lttng_ust__event_class___##_template_provider##___##_template_name, \
882a56d7 1129 .loglevel = &__ref_loglevel___##_provider##___##_name, \
dc11f93f 1130 .model_emf_uri = &__ref_model_emf_uri___##_provider##___##_name, \
df854e41
MD
1131};
1132
bb71a8ea 1133#include LTTNG_UST_TRACEPOINT_INCLUDE
05ceaafd 1134
df854e41 1135/*
2e7160d2 1136 * Stage 7.1 of tracepoint event generation.
df854e41
MD
1137 *
1138 * Create array of events.
1139 */
1140
7f2f82c3 1141/* Reset all macros within LTTNG_UST_TRACEPOINT_EVENT */
df854e41
MD
1142#include <lttng/ust-tracepoint-event-reset.h>
1143
7f2f82c3 1144#undef LTTNG_UST__TRACEPOINT_EVENT_INSTANCE
5b675300 1145#define LTTNG_UST__TRACEPOINT_EVENT_INSTANCE(_template_provider, _template_name, _provider, _name, _args) \
bfcc2759 1146 &lttng_ust__event_desc___##_provider##_##_name,
df854e41 1147
0997899b 1148static const struct lttng_ust_event_desc * const LTTNG_UST__TP_COMBINE_TOKENS(lttng_ust__provider_event_desc___, LTTNG_UST_TRACEPOINT_PROVIDER)[] = {
bb71a8ea 1149#include LTTNG_UST_TRACEPOINT_INCLUDE
1c80c909 1150 NULL, /* Dummy, C99 forbids 0-len array. */
05ceaafd
MD
1151};
1152
df854e41 1153
05ceaafd 1154/*
882a56d7 1155 * Stage 8 of tracepoint event generation.
05ceaafd
MD
1156 *
1157 * Create a toplevel descriptor for the whole probe.
1158 */
1159
c9201081 1160const struct lttng_ust_probe_desc LTTNG_UST__TP_COMBINE_TOKENS(lttng_ust__probe_desc___, LTTNG_UST_TRACEPOINT_PROVIDER) = {
dc11f93f 1161 .struct_size = sizeof(struct lttng_ust_probe_desc),
061fc37a 1162 .provider_name = lttng_ust__tp_stringify(LTTNG_UST_TRACEPOINT_PROVIDER),
0997899b
MD
1163 .event_desc = LTTNG_UST__TP_COMBINE_TOKENS(lttng_ust__provider_event_desc___, LTTNG_UST_TRACEPOINT_PROVIDER),
1164 .nr_events = LTTNG_UST__TP_ARRAY_SIZE(LTTNG_UST__TP_COMBINE_TOKENS(lttng_ust__provider_event_desc___, LTTNG_UST_TRACEPOINT_PROVIDER)) - 1,
71d31690
MD
1165 .major = LTTNG_UST_PROVIDER_MAJOR,
1166 .minor = LTTNG_UST_PROVIDER_MINOR,
05ceaafd
MD
1167};
1168
03221919 1169static int LTTNG_UST__TP_COMBINE_TOKENS(lttng_ust__probe_register_refcount___, LTTNG_UST_TRACEPOINT_PROVIDER);
f082dde9 1170static struct lttng_ust_registered_probe *LTTNG_UST__TP_COMBINE_TOKENS(lttng_ust__probe_register_cookie___, LTTNG_UST_TRACEPOINT_PROVIDER);
f0cc794d 1171
05ceaafd 1172/*
882a56d7 1173 * Stage 9 of tracepoint event generation.
05ceaafd 1174 *
1c324e59 1175 * Register/unregister probes at module load/unload.
628e1d81
MD
1176 *
1177 * Generate the constructor as an externally visible symbol for use when
1178 * linking the probe statically.
f0cc794d
MD
1179 *
1180 * Register refcount is protected by libc dynamic loader mutex.
05bfa3dc
JG
1181 *
1182 * Note that when building this code as C++, the definition of constructors
1183 * and destructors invoking the registration and unregistration functions
1184 * must be performed _after_ the initialization of the probes.
1185 *
1186 * This is because we rely on the order of initialization of static variables
1187 * and anonymous namespaces (their order of declaration) to ensure probes are
1188 * fully initialized, see
1189 * https://en.cppreference.com/w/cpp/language/initialization. This is especially
1190 * important when LTTNG_UST_ALLOCATE_COMPOUND_LITERAL_ON_HEAP is defined as
1191 * compound literals are then dynamically initialized.
1c324e59
MD
1192 */
1193
7f2f82c3 1194/* Reset all macros within LTTNG_UST_TRACEPOINT_EVENT */
1c324e59 1195#include <lttng/ust-tracepoint-event-reset.h>
05bfa3dc 1196
465a0d04 1197static void
05bfa3dc 1198LTTNG_UST__TP_COMBINE_TOKENS(lttng_ust__events_init__, LTTNG_UST_TRACEPOINT_PROVIDER)(void) lttng_ust_notrace;
a8909ba5 1199static void
11bce056 1200LTTNG_UST__TP_COMBINE_TOKENS(lttng_ust__events_init__, LTTNG_UST_TRACEPOINT_PROVIDER)(void)
1c324e59 1201{
4e48b5d2 1202 struct lttng_ust_registered_probe *reg_probe;
1c324e59 1203
03221919 1204 if (LTTNG_UST__TP_COMBINE_TOKENS(lttng_ust__probe_register_refcount___,
5b393d64 1205 LTTNG_UST_TRACEPOINT_PROVIDER)++) {
f0cc794d
MD
1206 return;
1207 }
e8bd1da7 1208 /*
5b393d64 1209 * lttng_ust_tracepoint_provider_check_ ## LTTNG_UST_TRACEPOINT_PROVIDER() is a
e8bd1da7
MD
1210 * static inline function that ensures every probe PROVIDER
1211 * argument match the provider within which they appear. It
1212 * calls empty static inline functions, and therefore has no
1213 * runtime effect. However, if it detects an error, a linker
1214 * error will appear.
1215 */
5b393d64 1216 LTTNG_UST__TP_COMBINE_TOKENS(lttng_ust_tracepoint_provider_check_, LTTNG_UST_TRACEPOINT_PROVIDER)();
f082dde9 1217 assert(!LTTNG_UST__TP_COMBINE_TOKENS(lttng_ust__probe_register_cookie___, LTTNG_UST_TRACEPOINT_PROVIDER));
c9201081 1218 reg_probe = lttng_ust_probe_register(&LTTNG_UST__TP_COMBINE_TOKENS(lttng_ust__probe_desc___, LTTNG_UST_TRACEPOINT_PROVIDER));
4e48b5d2
MD
1219 if (!reg_probe) {
1220 fprintf(stderr, "LTTng-UST: Error while registering tracepoint probe.\n");
7d381d6e
MD
1221 abort();
1222 }
f082dde9 1223 LTTNG_UST__TP_COMBINE_TOKENS(lttng_ust__probe_register_cookie___, LTTNG_UST_TRACEPOINT_PROVIDER) = reg_probe;
1c324e59
MD
1224}
1225
c589eca2 1226static void
05bfa3dc 1227LTTNG_UST__TP_COMBINE_TOKENS(lttng_ust__events_exit__, LTTNG_UST_TRACEPOINT_PROVIDER)(void) lttng_ust_notrace;
a8909ba5 1228static void
638ce920 1229LTTNG_UST__TP_COMBINE_TOKENS(lttng_ust__events_exit__, LTTNG_UST_TRACEPOINT_PROVIDER)(void)
1c324e59 1230{
03221919 1231 if (--LTTNG_UST__TP_COMBINE_TOKENS(lttng_ust__probe_register_refcount___,
5b393d64 1232 LTTNG_UST_TRACEPOINT_PROVIDER)) {
f0cc794d
MD
1233 return;
1234 }
f082dde9
MJ
1235 lttng_ust_probe_unregister(LTTNG_UST__TP_COMBINE_TOKENS(lttng_ust__probe_register_cookie___, LTTNG_UST_TRACEPOINT_PROVIDER));
1236 LTTNG_UST__TP_COMBINE_TOKENS(lttng_ust__probe_register_cookie___, LTTNG_UST_TRACEPOINT_PROVIDER) = NULL;
1c324e59 1237}
628e1d81 1238
05bfa3dc
JG
1239LTTNG_UST_DECLARE_CONSTRUCTOR_DESTRUCTOR(
1240 LTTNG_UST_TRACEPOINT_PROVIDER,
1241 LTTNG_UST__TP_COMBINE_TOKENS(lttng_ust__events_init__, LTTNG_UST_TRACEPOINT_PROVIDER),
1242 LTTNG_UST__TP_COMBINE_TOKENS(lttng_ust__events_exit__, LTTNG_UST_TRACEPOINT_PROVIDER),
1243 lttng_ust_notrace)
1244
29d6f421
MD
1245/*
1246 * LTTNG_UST_TRACEPOINT_PROVIDER_HIDDEN_DEFINITION: Define this before
1247 * including a tracepoint instrumentation header to hide symbols
1248 * associated with the tracepoint provider. This is useful if the
1249 * tracepoint definition (including the header after defining
1250 * LTTNG_UST_TRACEPOINT_DEFINE) is in the same module as the provider
1251 * (including the header after defining
1252 * LTTNG_UST_TRACEPOINT_CREATE_PROBES).
1253 */
1254#undef LTTNG_UST__TRACEPOINT_PROVIDER_DEFINITION_VISIBILITY
1255#ifdef LTTNG_UST_TRACEPOINT_PROVIDER_HIDDEN_DEFINITION
1256#define LTTNG_UST__TRACEPOINT_PROVIDER_DEFINITION_VISIBILITY __attribute__((visibility("hidden")))
1257#else
1258#define LTTNG_UST__TRACEPOINT_PROVIDER_DEFINITION_VISIBILITY __attribute__((visibility("default")))
1259#endif
1260
5b393d64 1261int LTTNG_UST__TP_COMBINE_TOKENS(lttng_ust_tracepoint_provider_, LTTNG_UST_TRACEPOINT_PROVIDER)
29d6f421 1262 LTTNG_UST__TRACEPOINT_PROVIDER_DEFINITION_VISIBILITY;
This page took 0.142757 seconds and 4 git commands to generate.