Cleanup: tracepoint event: use different prefixes for provider and event descriptors
[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
FD
259
260/*
261 * Stage 0.9.1
262 * Verifying array and sequence elements are of an integer type.
263 */
264
7f2f82c3 265/* Reset all macros within LTTNG_UST_TRACEPOINT_EVENT */
2df82195
FD
266#include <lttng/ust-tracepoint-event-reset.h>
267#include <lttng/ust-tracepoint-event-write.h>
268#include <lttng/ust-tracepoint-event-nowrite.h>
269
10937ee5
MJ
270#undef lttng_ust__field_array_encoded
271#define lttng_ust__field_array_encoded(_type, _item, _src, _byte_order, \
2df82195
FD
272 _length, _encoding, _nowrite, \
273 _elem_type_base) \
10937ee5 274 lttng_ust_field_array_element_type_is_supported(_type, _item);
2df82195 275
1d188af9
MJ
276#undef lttng_ust__field_sequence_encoded
277#define lttng_ust__field_sequence_encoded(_type, _item, _src, _byte_order, \
2df82195
FD
278 _length_type, _src_length, _encoding, _nowrite, \
279 _elem_type_base) \
10937ee5 280 lttng_ust_field_array_element_type_is_supported(_type, _item);
2df82195 281
efa14d16
MJ
282#undef LTTNG_UST_TP_FIELDS
283#define LTTNG_UST_TP_FIELDS(...) __VA_ARGS__ /* Only one used in this phase */
2df82195 284
7f2f82c3
MJ
285#undef LTTNG_UST__TRACEPOINT_EVENT_CLASS
286#define LTTNG_UST__TRACEPOINT_EVENT_CLASS(_provider, _name, _args, _fields) \
2df82195 287 _fields
c785c634 288
bb71a8ea 289#include LTTNG_UST_TRACEPOINT_INCLUDE
c785c634 290
5b675300
MD
291/*
292 * Stage 0.9.2 of tracepoint event generation.
293 *
294 * Create probe signature
295 */
296
297/* Reset all macros within LTTNG_UST_TRACEPOINT_EVENT */
298#include <lttng/ust-tracepoint-event-reset.h>
299
300#undef LTTNG_UST_TP_ARGS
301#define LTTNG_UST_TP_ARGS(...) __VA_ARGS__
302
303#define LTTNG_UST__TP_EXTRACT_STRING2(...) #__VA_ARGS__
304
305#undef LTTNG_UST__TRACEPOINT_EVENT_CLASS
306#define LTTNG_UST__TRACEPOINT_EVENT_CLASS(_provider, _name, _args, _fields) \
307static const char __tp_event_signature___##_provider##___##_name[] = \
308 LTTNG_UST__TP_EXTRACT_STRING2(_args);
309
310#include LTTNG_UST_TRACEPOINT_INCLUDE
311
312#undef LTTNG_UST__TP_EXTRACT_STRING2
313
1c324e59
MD
314/*
315 * Stage 1 of tracepoint event generation.
316 *
5b675300
MD
317 * Create probe callback prototypes.
318 */
319
320/* Reset all macros within LTTNG_UST_TRACEPOINT_EVENT */
321#include <lttng/ust-tracepoint-event-reset.h>
322
323#undef LTTNG_UST_TP_ARGS
324#define LTTNG_UST_TP_ARGS(...) __VA_ARGS__
325
326#undef LTTNG_UST__TRACEPOINT_EVENT_CLASS
327#define LTTNG_UST__TRACEPOINT_EVENT_CLASS(_provider, _name, _args, _fields) \
328static void lttng_ust__event_probe__##_provider##___##_name(LTTNG_UST__TP_ARGS_DATA_PROTO(_args));
329
330#include LTTNG_UST_TRACEPOINT_INCLUDE
331
2e7160d2
MD
332/*
333 * Stage 1.1 of tracepoint event generation.
334 *
335 * Declare toplevel descriptor for the whole probe.
336 * Unlike C, C++ does not allow tentative definitions. Therefore, we
337 * need to explicitly declare the variable with "extern", using hidden
338 * visibility to keep this symbol from being exported to the global
339 * symbol table.
340 */
341
342extern const struct lttng_ust_probe_desc LTTNG_UST__TP_COMBINE_TOKENS(lttng_ust__probe_desc___, LTTNG_UST_TRACEPOINT_PROVIDER)
343 __attribute__((visibility("hidden")));
344
5b675300
MD
345/*
346 * Stage 2 of tracepoint event generation.
347 *
1c324e59
MD
348 * Create event field type metadata section.
349 * Each event produce an array of fields.
350 */
351
7f2f82c3 352/* Reset all macros within LTTNG_UST_TRACEPOINT_EVENT */
1c324e59 353#include <lttng/ust-tracepoint-event-reset.h>
4774c8f3
MD
354#include <lttng/ust-tracepoint-event-write.h>
355#include <lttng/ust-tracepoint-event-nowrite.h>
1c324e59 356
b4064f28
MJ
357#undef lttng_ust__field_integer_ext
358#define lttng_ust__field_integer_ext(_type, _item, _src, _byte_order, _base, _nowrite) \
5defa774 359 LTTNG_UST_COMPOUND_LITERAL(const struct lttng_ust_event_field, { \
25cff019
MD
360 .struct_size = sizeof(struct lttng_ust_event_field), \
361 .name = #_item, \
a084756d 362 .type = lttng_ust_type_integer_define(_type, _byte_order, _base), \
25cff019
MD
363 .nowrite = _nowrite, \
364 .nofilter = 0, \
365 }),
1c324e59 366
891226fc
MJ
367#undef lttng_ust__field_float
368#define lttng_ust__field_float(_type, _item, _src, _nowrite) \
5defa774 369 LTTNG_UST_COMPOUND_LITERAL(const struct lttng_ust_event_field, { \
25cff019
MD
370 .struct_size = sizeof(struct lttng_ust_event_field), \
371 .name = #_item, \
a084756d 372 .type = lttng_ust_type_float_define(_type), \
25cff019
MD
373 .nowrite = _nowrite, \
374 .nofilter = 0, \
375 }),
1c324e59 376
10937ee5
MJ
377#undef lttng_ust__field_array_encoded
378#define lttng_ust__field_array_encoded(_type, _item, _src, _byte_order, \
f3ec4cb5
MD
379 _length, _encoding, _nowrite, \
380 _elem_type_base) \
5defa774 381 LTTNG_UST_COMPOUND_LITERAL(const struct lttng_ust_event_field, { \
25cff019
MD
382 .struct_size = sizeof(struct lttng_ust_event_field), \
383 .name = #_item, \
5defa774 384 .type = (const struct lttng_ust_type_common *) LTTNG_UST_COMPOUND_LITERAL(const struct lttng_ust_type_array, { \
a084756d
MD
385 .parent = { \
386 .type = lttng_ust_type_array, \
387 }, \
388 .struct_size = sizeof(struct lttng_ust_type_array), \
389 .elem_type = lttng_ust_type_integer_define(_type, _byte_order, _elem_type_base), \
390 .length = _length, \
391 .alignment = 0, \
392 .encoding = lttng_ust_string_encoding_##_encoding, \
393 }), \
25cff019
MD
394 .nowrite = _nowrite, \
395 .nofilter = 0, \
396 }),
1c324e59 397
1d188af9
MJ
398#undef lttng_ust__field_sequence_encoded
399#define lttng_ust__field_sequence_encoded(_type, _item, _src, _byte_order, \
f968510a
PP
400 _length_type, _src_length, _encoding, _nowrite, \
401 _elem_type_base) \
5defa774 402 LTTNG_UST_COMPOUND_LITERAL(const struct lttng_ust_event_field, { \
25cff019
MD
403 .struct_size = sizeof(struct lttng_ust_event_field), \
404 .name = "_" #_item "_length", \
baa8acf3 405 .type = lttng_ust_type_integer_define(_length_type, LTTNG_UST_BYTE_ORDER, 10), \
25cff019
MD
406 .nowrite = _nowrite, \
407 .nofilter = 1, \
408 }), \
5defa774 409 LTTNG_UST_COMPOUND_LITERAL(const struct lttng_ust_event_field, { \
25cff019
MD
410 .struct_size = sizeof(struct lttng_ust_event_field), \
411 .name = #_item, \
5defa774 412 .type = (const struct lttng_ust_type_common *) LTTNG_UST_COMPOUND_LITERAL(const struct lttng_ust_type_sequence, { \
a084756d
MD
413 .parent = { \
414 .type = lttng_ust_type_sequence, \
1c324e59 415 }, \
a084756d 416 .struct_size = sizeof(struct lttng_ust_type_sequence), \
28db0827 417 .length_name = NULL, /* Use previous field. */ \
a084756d
MD
418 .elem_type = lttng_ust_type_integer_define(_type, _byte_order, _elem_type_base), \
419 .alignment = 0, \
420 .encoding = lttng_ust_string_encoding_##_encoding, \
421 }), \
25cff019
MD
422 .nowrite = _nowrite, \
423 .nofilter = 0, \
424 }),
1c324e59 425
3202f63a
MJ
426#undef lttng_ust__field_string
427#define lttng_ust__field_string(_item, _src, _nowrite) \
5defa774 428 LTTNG_UST_COMPOUND_LITERAL(const struct lttng_ust_event_field, { \
25cff019
MD
429 .struct_size = sizeof(struct lttng_ust_event_field), \
430 .name = #_item, \
5defa774 431 .type = (const struct lttng_ust_type_common *) LTTNG_UST_COMPOUND_LITERAL(const struct lttng_ust_type_string, { \
a084756d
MD
432 .parent = { \
433 .type = lttng_ust_type_string, \
46d52200 434 }, \
a084756d
MD
435 .struct_size = sizeof(struct lttng_ust_type_string), \
436 .encoding = lttng_ust_string_encoding_UTF8, \
437 }), \
25cff019
MD
438 .nowrite = _nowrite, \
439 .nofilter = 0, \
440 }),
1c324e59 441
ddde62ca
MJ
442#undef lttng_ust__field_unused
443#define lttng_ust__field_unused(_src)
5152f6df 444
78684808
MJ
445#undef lttng_ust__field_enum
446#define lttng_ust__field_enum(_provider, _name, _type, _item, _src, _nowrite) \
5defa774 447 LTTNG_UST_COMPOUND_LITERAL(const struct lttng_ust_event_field, { \
25cff019 448 .struct_size = sizeof(struct lttng_ust_event_field), \
c785c634 449 .name = #_item, \
5defa774 450 .type = (const struct lttng_ust_type_common *) LTTNG_UST_COMPOUND_LITERAL(const struct lttng_ust_type_enum, { \
a084756d
MD
451 .parent = { \
452 .type = lttng_ust_type_enum, \
c785c634 453 }, \
a084756d
MD
454 .struct_size = sizeof(struct lttng_ust_type_enum), \
455 .desc = &__enum_##_provider##_##_name, \
baa8acf3 456 .container_type = lttng_ust_type_integer_define(_type, LTTNG_UST_BYTE_ORDER, 10), \
a084756d 457 }), \
c785c634 458 .nowrite = _nowrite, \
25cff019
MD
459 .nofilter = 0, \
460 }),
c785c634 461
efa14d16
MJ
462#undef LTTNG_UST_TP_FIELDS
463#define LTTNG_UST_TP_FIELDS(...) __VA_ARGS__ /* Only one used in this phase */
1c324e59 464
7f2f82c3
MJ
465#undef LTTNG_UST__TRACEPOINT_EVENT_CLASS
466#define LTTNG_UST__TRACEPOINT_EVENT_CLASS(_provider, _name, _args, _fields) \
bfcc2759 467 static const struct lttng_ust_event_field * const lttng_ust__event_fields___##_provider##___##_name[] = { \
1c324e59 468 _fields \
b4064f28 469 lttng_ust_field_integer(int, dummy, 0) /* Dummy, C99 forbids 0-len array. */ \
5b675300
MD
470 }; \
471 static const struct lttng_ust_tracepoint_class lttng_ust__event_class___##_provider##___##_name = { \
472 .struct_size = sizeof(struct lttng_ust_tracepoint_class), \
473 .fields = lttng_ust__event_fields___##_provider##___##_name, \
474 .nr_fields = LTTNG_UST__TP_ARRAY_SIZE(lttng_ust__event_fields___##_provider##___##_name) - 1, \
475 .probe_callback = (void (*)(void)) &lttng_ust__event_probe__##_provider##___##_name, \
476 .signature = __tp_event_signature___##_provider##___##_name, \
2e7160d2 477 .probe_desc = &lttng_ust__probe_desc___##_provider, \
1c324e59
MD
478 };
479
2ebf164b
MJ
480#undef LTTNG_UST_TRACEPOINT_ENUM
481#define LTTNG_UST_TRACEPOINT_ENUM(_provider, _name, _values) \
4e48b5d2 482 static const struct lttng_ust_enum_desc __enum_##_provider##_##_name = { \
a084756d 483 .struct_size = sizeof(struct lttng_ust_enum_desc), \
c785c634
MD
484 .name = #_provider "_" #_name, \
485 .entries = __enum_values__##_provider##_##_name, \
ca6ed78d 486 .nr_entries = LTTNG_UST__TP_ARRAY_SIZE(__enum_values__##_provider##_##_name) - 1, \
2e7160d2 487 .probe_desc = &lttng_ust__probe_desc___##_provider, \
c785c634
MD
488 };
489
bb71a8ea 490#include LTTNG_UST_TRACEPOINT_INCLUDE
1c324e59 491
1c324e59 492/*
c785c634 493 * Stage 3.0 of tracepoint event generation.
1c324e59 494 *
1c324e59
MD
495 * Create static inline function that calculates event size.
496 */
497
7f2f82c3 498/* Reset all macros within LTTNG_UST_TRACEPOINT_EVENT */
1c324e59 499#include <lttng/ust-tracepoint-event-reset.h>
4774c8f3 500#include <lttng/ust-tracepoint-event-write.h>
1c324e59 501
b4064f28
MJ
502#undef lttng_ust__field_integer_ext
503#define lttng_ust__field_integer_ext(_type, _item, _src, _byte_order, _base, _nowrite) \
5152f6df
MJ
504 if (0) \
505 (void) (_src); /* Unused */ \
b5457df5 506 __event_len += lttng_ust_ring_buffer_align(__event_len, lttng_ust_rb_alignof(_type)); \
1c324e59
MD
507 __event_len += sizeof(_type);
508
891226fc
MJ
509#undef lttng_ust__field_float
510#define lttng_ust__field_float(_type, _item, _src, _nowrite) \
5152f6df
MJ
511 if (0) \
512 (void) (_src); /* Unused */ \
b5457df5 513 __event_len += lttng_ust_ring_buffer_align(__event_len, lttng_ust_rb_alignof(_type)); \
1c324e59
MD
514 __event_len += sizeof(_type);
515
10937ee5
MJ
516#undef lttng_ust__field_array_encoded
517#define lttng_ust__field_array_encoded(_type, _item, _src, _byte_order, _length, _encoding, \
f3ec4cb5 518 _nowrite, _elem_type_base) \
5152f6df
MJ
519 if (0) \
520 (void) (_src); /* Unused */ \
b5457df5 521 __event_len += lttng_ust_ring_buffer_align(__event_len, lttng_ust_rb_alignof(_type)); \
1c324e59
MD
522 __event_len += sizeof(_type) * (_length);
523
1d188af9
MJ
524#undef lttng_ust__field_sequence_encoded
525#define lttng_ust__field_sequence_encoded(_type, _item, _src, _byte_order, _length_type, \
f968510a 526 _src_length, _encoding, _nowrite, _elem_type_base) \
5152f6df
MJ
527 if (0) \
528 (void) (_src); /* Unused */ \
b5457df5 529 __event_len += lttng_ust_ring_buffer_align(__event_len, lttng_ust_rb_alignof(_length_type)); \
1c324e59 530 __event_len += sizeof(_length_type); \
b5457df5 531 __event_len += lttng_ust_ring_buffer_align(__event_len, lttng_ust_rb_alignof(_type)); \
1c324e59
MD
532 __dynamic_len[__dynamic_len_idx] = (_src_length); \
533 __event_len += sizeof(_type) * __dynamic_len[__dynamic_len_idx]; \
534 __dynamic_len_idx++;
535
3202f63a
MJ
536#undef lttng_ust__field_string
537#define lttng_ust__field_string(_item, _src, _nowrite) \
24a39530 538 __event_len += __dynamic_len[__dynamic_len_idx++] = \
ee0889a3 539 strlen((_src) ? (_src) : LTTNG_UST__NULL_STRING) + 1;
1c324e59 540
ddde62ca
MJ
541#undef lttng_ust__field_unused
542#define lttng_ust__field_unused(_src) \
5152f6df
MJ
543 if (0) \
544 (void) (_src); /* Unused */
545
78684808
MJ
546#undef lttng_ust__field_enum
547#define lttng_ust__field_enum(_provider, _name, _type, _item, _src, _nowrite) \
b4064f28 548 lttng_ust__field_integer_ext(_type, _item, _src, LTTNG_UST_BYTE_ORDER, 10, _nowrite)
c785c634 549
cadfcbfc
MJ
550#undef LTTNG_UST_TP_ARGS
551#define LTTNG_UST_TP_ARGS(...) __VA_ARGS__
1c324e59 552
efa14d16
MJ
553#undef LTTNG_UST_TP_FIELDS
554#define LTTNG_UST_TP_FIELDS(...) __VA_ARGS__
1c324e59 555
7f2f82c3
MJ
556#undef LTTNG_UST__TRACEPOINT_EVENT_CLASS
557#define LTTNG_UST__TRACEPOINT_EVENT_CLASS(_provider, _name, _args, _fields) \
106ff4da 558static inline \
bfcc2759 559size_t lttng_ust__event_get_size__##_provider##___##_name(size_t *__dynamic_len, LTTNG_UST__TP_ARGS_DATA_PROTO(_args)) \
106ff4da 560 lttng_ust_notrace; \
a8909ba5 561static inline \
bfcc2759 562size_t lttng_ust__event_get_size__##_provider##___##_name( \
5152f6df 563 size_t *__dynamic_len __attribute__((__unused__)), \
6eddcb06 564 LTTNG_UST__TP_ARGS_DATA_PROTO(_args)) \
1c324e59
MD
565{ \
566 size_t __event_len = 0; \
5152f6df 567 unsigned int __dynamic_len_idx __attribute__((__unused__)) = 0; \
1c324e59
MD
568 \
569 if (0) \
5152f6df
MJ
570 (void) __tp_data; /* don't warn if unused */ \
571 \
1c324e59
MD
572 _fields \
573 return __event_len; \
574}
575
bb71a8ea 576#include LTTNG_UST_TRACEPOINT_INCLUDE
1c324e59 577
1ddfd641
MD
578/*
579 * Stage 3.1 of tracepoint event generation.
580 *
581 * Create static inline function that layout the filter stack data.
4774c8f3 582 * We make both write and nowrite data available to the filter.
1ddfd641
MD
583 */
584
7f2f82c3 585/* Reset all macros within LTTNG_UST_TRACEPOINT_EVENT */
1ddfd641 586#include <lttng/ust-tracepoint-event-reset.h>
4774c8f3
MD
587#include <lttng/ust-tracepoint-event-write.h>
588#include <lttng/ust-tracepoint-event-nowrite.h>
1ddfd641 589
b4064f28
MJ
590#undef lttng_ust__field_integer_ext
591#define lttng_ust__field_integer_ext(_type, _item, _src, _byte_order, _base, _nowrite) \
eae3c729 592 if (lttng_ust_is_signed_type(_type)) { \
3ebeea0d
MD
593 int64_t __ctf_tmp_int64; \
594 switch (sizeof(_type)) { \
595 case 1: \
596 { \
597 union { _type t; int8_t v; } __tmp = { (_type) (_src) }; \
598 __ctf_tmp_int64 = (int64_t) __tmp.v; \
599 break; \
600 } \
601 case 2: \
602 { \
603 union { _type t; int16_t v; } __tmp = { (_type) (_src) }; \
baa8acf3
MJ
604 if (_byte_order != LTTNG_UST_BYTE_ORDER) \
605 __tmp.v = lttng_ust_bswap_16(__tmp.v); \
3ebeea0d
MD
606 __ctf_tmp_int64 = (int64_t) __tmp.v; \
607 break; \
608 } \
609 case 4: \
610 { \
611 union { _type t; int32_t v; } __tmp = { (_type) (_src) }; \
baa8acf3
MJ
612 if (_byte_order != LTTNG_UST_BYTE_ORDER) \
613 __tmp.v = lttng_ust_bswap_32(__tmp.v); \
3ebeea0d
MD
614 __ctf_tmp_int64 = (int64_t) __tmp.v; \
615 break; \
616 } \
617 case 8: \
618 { \
619 union { _type t; int64_t v; } __tmp = { (_type) (_src) }; \
baa8acf3
MJ
620 if (_byte_order != LTTNG_UST_BYTE_ORDER) \
621 __tmp.v = lttng_ust_bswap_64(__tmp.v); \
3ebeea0d
MD
622 __ctf_tmp_int64 = (int64_t) __tmp.v; \
623 break; \
624 } \
625 default: \
626 abort(); \
627 }; \
fa099471
MD
628 memcpy(__stack_data, &__ctf_tmp_int64, sizeof(int64_t)); \
629 } else { \
3ebeea0d
MD
630 uint64_t __ctf_tmp_uint64; \
631 switch (sizeof(_type)) { \
632 case 1: \
633 { \
634 union { _type t; uint8_t v; } __tmp = { (_type) (_src) }; \
635 __ctf_tmp_uint64 = (uint64_t) __tmp.v; \
636 break; \
637 } \
638 case 2: \
639 { \
640 union { _type t; uint16_t v; } __tmp = { (_type) (_src) }; \
baa8acf3
MJ
641 if (_byte_order != LTTNG_UST_BYTE_ORDER) \
642 __tmp.v = lttng_ust_bswap_16(__tmp.v); \
3ebeea0d
MD
643 __ctf_tmp_uint64 = (uint64_t) __tmp.v; \
644 break; \
645 } \
646 case 4: \
647 { \
648 union { _type t; uint32_t v; } __tmp = { (_type) (_src) }; \
baa8acf3
MJ
649 if (_byte_order != LTTNG_UST_BYTE_ORDER) \
650 __tmp.v = lttng_ust_bswap_32(__tmp.v); \
3ebeea0d
MD
651 __ctf_tmp_uint64 = (uint64_t) __tmp.v; \
652 break; \
653 } \
654 case 8: \
655 { \
656 union { _type t; uint64_t v; } __tmp = { (_type) (_src) }; \
baa8acf3
MJ
657 if (_byte_order != LTTNG_UST_BYTE_ORDER) \
658 __tmp.v = lttng_ust_bswap_64(__tmp.v); \
3ebeea0d
MD
659 __ctf_tmp_uint64 = (uint64_t) __tmp.v; \
660 break; \
661 } \
662 default: \
663 abort(); \
664 }; \
fa099471
MD
665 memcpy(__stack_data, &__ctf_tmp_uint64, sizeof(uint64_t)); \
666 } \
1ddfd641
MD
667 __stack_data += sizeof(int64_t);
668
891226fc
MJ
669#undef lttng_ust__field_float
670#define lttng_ust__field_float(_type, _item, _src, _nowrite) \
fa099471
MD
671 { \
672 double __ctf_tmp_double = (double) (_type) (_src); \
673 memcpy(__stack_data, &__ctf_tmp_double, sizeof(double)); \
674 __stack_data += sizeof(double); \
675 }
1ddfd641 676
10937ee5
MJ
677#undef lttng_ust__field_array_encoded
678#define lttng_ust__field_array_encoded(_type, _item, _src, _byte_order, _length, \
f3ec4cb5 679 _encoding, _nowrite, _elem_type_base) \
fa099471
MD
680 { \
681 unsigned long __ctf_tmp_ulong = (unsigned long) (_length); \
59034aab 682 const void *__ctf_tmp_ptr = (_src); \
fa099471
MD
683 memcpy(__stack_data, &__ctf_tmp_ulong, sizeof(unsigned long)); \
684 __stack_data += sizeof(unsigned long); \
b1239ad6
MD
685 memcpy(__stack_data, &__ctf_tmp_ptr, sizeof(void *)); \
686 __stack_data += sizeof(void *); \
fa099471 687 }
1ddfd641 688
1d188af9
MJ
689#undef lttng_ust__field_sequence_encoded
690#define lttng_ust__field_sequence_encoded(_type, _item, _src, _byte_order, _length_type, \
f968510a 691 _src_length, _encoding, _nowrite, _elem_type_base) \
fa099471
MD
692 { \
693 unsigned long __ctf_tmp_ulong = (unsigned long) (_src_length); \
59034aab 694 const void *__ctf_tmp_ptr = (_src); \
fa099471
MD
695 memcpy(__stack_data, &__ctf_tmp_ulong, sizeof(unsigned long)); \
696 __stack_data += sizeof(unsigned long); \
b1239ad6
MD
697 memcpy(__stack_data, &__ctf_tmp_ptr, sizeof(void *)); \
698 __stack_data += sizeof(void *); \
fa099471 699 }
1ddfd641 700
3202f63a
MJ
701#undef lttng_ust__field_string
702#define lttng_ust__field_string(_item, _src, _nowrite) \
fa099471 703 { \
24a39530 704 const void *__ctf_tmp_ptr = \
ee0889a3 705 ((_src) ? (_src) : LTTNG_UST__NULL_STRING); \
b1239ad6
MD
706 memcpy(__stack_data, &__ctf_tmp_ptr, sizeof(void *)); \
707 __stack_data += sizeof(void *); \
fa099471 708 }
1ddfd641 709
ddde62ca
MJ
710#undef lttng_ust__field_unused
711#define lttng_ust__field_unused(_src) \
5152f6df
MJ
712 if (0) \
713 (void) (_src);
714
78684808
MJ
715#undef lttng_ust__field_enum
716#define lttng_ust__field_enum(_provider, _name, _type, _item, _src, _nowrite) \
b4064f28 717 lttng_ust__field_integer_ext(_type, _item, _src, LTTNG_UST_BYTE_ORDER, 10, _nowrite)
c785c634 718
cadfcbfc
MJ
719#undef LTTNG_UST_TP_ARGS
720#define LTTNG_UST_TP_ARGS(...) __VA_ARGS__
1ddfd641 721
efa14d16
MJ
722#undef LTTNG_UST_TP_FIELDS
723#define LTTNG_UST_TP_FIELDS(...) __VA_ARGS__
1ddfd641 724
7f2f82c3
MJ
725#undef LTTNG_UST__TRACEPOINT_EVENT_CLASS
726#define LTTNG_UST__TRACEPOINT_EVENT_CLASS(_provider, _name, _args, _fields) \
1ddfd641 727static inline \
bfcc2759 728void lttng_ust__event_prepare_interpreter_stack__##_provider##___##_name(char *__stack_data,\
6eddcb06 729 LTTNG_UST__TP_ARGS_DATA_PROTO(_args)) \
1ddfd641 730{ \
5152f6df
MJ
731 if (0) { \
732 (void) __tp_data; /* don't warn if unused */ \
733 (void) __stack_data; /* don't warn if unused */ \
734 } \
735 \
1ddfd641
MD
736 _fields \
737}
738
bb71a8ea 739#include LTTNG_UST_TRACEPOINT_INCLUDE
1ddfd641 740
1c324e59 741/*
df854e41 742 * Stage 4 of tracepoint event generation.
1c324e59
MD
743 *
744 * Create static inline function that calculates event payload alignment.
745 */
746
7f2f82c3 747/* Reset all macros within LTTNG_UST_TRACEPOINT_EVENT */
1c324e59 748#include <lttng/ust-tracepoint-event-reset.h>
4774c8f3 749#include <lttng/ust-tracepoint-event-write.h>
1c324e59 750
b4064f28
MJ
751#undef lttng_ust__field_integer_ext
752#define lttng_ust__field_integer_ext(_type, _item, _src, _byte_order, _base, _nowrite) \
5152f6df
MJ
753 if (0) \
754 (void) (_src); /* Unused */ \
26376e52 755 __event_align = lttng_ust__tp_max_t(size_t, __event_align, lttng_ust_rb_alignof(_type));
1c324e59 756
891226fc
MJ
757#undef lttng_ust__field_float
758#define lttng_ust__field_float(_type, _item, _src, _nowrite) \
5152f6df
MJ
759 if (0) \
760 (void) (_src); /* Unused */ \
26376e52 761 __event_align = lttng_ust__tp_max_t(size_t, __event_align, lttng_ust_rb_alignof(_type));
1c324e59 762
10937ee5
MJ
763#undef lttng_ust__field_array_encoded
764#define lttng_ust__field_array_encoded(_type, _item, _src, _byte_order, _length, \
f3ec4cb5 765 _encoding, _nowrite, _elem_type_base) \
5152f6df
MJ
766 if (0) \
767 (void) (_src); /* Unused */ \
26376e52 768 __event_align = lttng_ust__tp_max_t(size_t, __event_align, lttng_ust_rb_alignof(_type));
1c324e59 769
1d188af9
MJ
770#undef lttng_ust__field_sequence_encoded
771#define lttng_ust__field_sequence_encoded(_type, _item, _src, _byte_order, _length_type, \
f968510a 772 _src_length, _encoding, _nowrite, _elem_type_base) \
5152f6df
MJ
773 if (0) \
774 (void) (_src); /* Unused */ \
775 if (0) \
776 (void) (_src_length); /* Unused */ \
26376e52
MD
777 __event_align = lttng_ust__tp_max_t(size_t, __event_align, lttng_ust_rb_alignof(_length_type)); \
778 __event_align = lttng_ust__tp_max_t(size_t, __event_align, lttng_ust_rb_alignof(_type));
1c324e59 779
3202f63a
MJ
780#undef lttng_ust__field_string
781#define lttng_ust__field_string(_item, _src, _nowrite) \
5152f6df
MJ
782 if (0) \
783 (void) (_src); /* Unused */
784
ddde62ca
MJ
785#undef lttng_ust__field_unused
786#define lttng_ust__field_unused(_src) \
5152f6df
MJ
787 if (0) \
788 (void) (_src); /* Unused */
1c324e59 789
78684808
MJ
790#undef lttng_ust__field_enum
791#define lttng_ust__field_enum(_provider, _name, _type, _item, _src, _nowrite) \
b4064f28 792 lttng_ust__field_integer_ext(_type, _item, _src, LTTNG_UST_BYTE_ORDER, 10, _nowrite)
c785c634 793
cadfcbfc
MJ
794#undef LTTNG_UST_TP_ARGS
795#define LTTNG_UST_TP_ARGS(...) __VA_ARGS__
1c324e59 796
efa14d16
MJ
797#undef LTTNG_UST_TP_FIELDS
798#define LTTNG_UST_TP_FIELDS(...) __VA_ARGS__
1c324e59 799
7f2f82c3
MJ
800#undef LTTNG_UST__TRACEPOINT_EVENT_CLASS
801#define LTTNG_UST__TRACEPOINT_EVENT_CLASS(_provider, _name, _args, _fields) \
106ff4da 802static inline \
bfcc2759 803size_t lttng_ust__event_get_align__##_provider##___##_name(LTTNG_UST__TP_ARGS_PROTO(_args)) \
106ff4da 804 lttng_ust_notrace; \
1c324e59 805static inline \
bfcc2759 806size_t lttng_ust__event_get_align__##_provider##___##_name(LTTNG_UST__TP_ARGS_PROTO(_args)) \
1c324e59 807{ \
26376e52 808 size_t __event_align = 1; \
1c324e59 809 _fields \
26376e52 810 return __event_align; \
1c324e59
MD
811}
812
bb71a8ea 813#include LTTNG_UST_TRACEPOINT_INCLUDE
1c324e59
MD
814
815
816/*
df854e41 817 * Stage 5 of tracepoint event generation.
1c324e59
MD
818 *
819 * Create the probe function. This function calls event size calculation
820 * and writes event data into the buffer.
821 */
822
7f2f82c3 823/* Reset all macros within LTTNG_UST_TRACEPOINT_EVENT */
1c324e59 824#include <lttng/ust-tracepoint-event-reset.h>
4774c8f3 825#include <lttng/ust-tracepoint-event-write.h>
1c324e59 826
b4064f28
MJ
827#undef lttng_ust__field_integer_ext
828#define lttng_ust__field_integer_ext(_type, _item, _src, _byte_order, _base, _nowrite) \
1c324e59
MD
829 { \
830 _type __tmp = (_src); \
8936b6c0 831 __chan->ops->event_write(&__ctx, &__tmp, sizeof(__tmp), lttng_ust_rb_alignof(__tmp));\
1c324e59
MD
832 }
833
891226fc
MJ
834#undef lttng_ust__field_float
835#define lttng_ust__field_float(_type, _item, _src, _nowrite) \
1c324e59
MD
836 { \
837 _type __tmp = (_src); \
8936b6c0 838 __chan->ops->event_write(&__ctx, &__tmp, sizeof(__tmp), lttng_ust_rb_alignof(__tmp));\
1c324e59
MD
839 }
840
10937ee5
MJ
841#undef lttng_ust__field_array_encoded
842#define lttng_ust__field_array_encoded(_type, _item, _src, _byte_order, _length, \
f3ec4cb5 843 _encoding, _nowrite, _elem_type_base) \
27927814 844 if (lttng_ust_string_encoding_##_encoding == lttng_ust_string_encoding_none) \
8936b6c0 845 __chan->ops->event_write(&__ctx, _src, sizeof(_type) * (_length), lttng_ust_rb_alignof(_type)); \
27927814 846 else \
879f9b0a 847 __chan->ops->event_pstrcpy_pad(&__ctx, (const char *) (_src), _length); \
1c324e59 848
1d188af9
MJ
849#undef lttng_ust__field_sequence_encoded
850#define lttng_ust__field_sequence_encoded(_type, _item, _src, _byte_order, _length_type, \
f968510a 851 _src_length, _encoding, _nowrite, _elem_type_base) \
1c324e59 852 { \
d71b57b9 853 _length_type __tmpl = __stackvar.__dynamic_len[__dynamic_len_idx]; \
8936b6c0 854 __chan->ops->event_write(&__ctx, &__tmpl, sizeof(_length_type), lttng_ust_rb_alignof(_length_type));\
1c324e59 855 } \
27927814
MD
856 if (lttng_ust_string_encoding_##_encoding == lttng_ust_string_encoding_none) \
857 __chan->ops->event_write(&__ctx, _src, \
bae1f483 858 sizeof(_type) * lttng_ust__get_dynamic_len(dest), lttng_ust_rb_alignof(_type)); \
27927814 859 else \
bae1f483 860 __chan->ops->event_pstrcpy_pad(&__ctx, (const char *) (_src), lttng_ust__get_dynamic_len(dest)); \
1c324e59 861
3202f63a
MJ
862#undef lttng_ust__field_string
863#define lttng_ust__field_string(_item, _src, _nowrite) \
24a39530
PP
864 { \
865 const char *__ctf_tmp_string = \
ee0889a3 866 ((_src) ? (_src) : LTTNG_UST__NULL_STRING); \
f9ec4a97 867 __chan->ops->event_strcpy(&__ctx, __ctf_tmp_string, \
bae1f483 868 lttng_ust__get_dynamic_len(dest)); \
24a39530
PP
869 }
870
ddde62ca
MJ
871#undef lttng_ust__field_unused
872#define lttng_ust__field_unused(_src)
1c324e59 873
78684808
MJ
874#undef lttng_ust__field_enum
875#define lttng_ust__field_enum(_provider, _name, _type, _item, _src, _nowrite) \
b4064f28 876 lttng_ust__field_integer_ext(_type, _item, _src, LTTNG_UST_BYTE_ORDER, 10, _nowrite)
c785c634 877
1c324e59 878/* Beware: this get len actually consumes the len value */
bae1f483
MJ
879#undef lttng_ust__get_dynamic_len
880#define lttng_ust__get_dynamic_len(field) __stackvar.__dynamic_len[__dynamic_len_idx++]
1c324e59 881
cadfcbfc
MJ
882#undef LTTNG_UST_TP_ARGS
883#define LTTNG_UST_TP_ARGS(...) __VA_ARGS__
1c324e59 884
efa14d16
MJ
885#undef LTTNG_UST_TP_FIELDS
886#define LTTNG_UST_TP_FIELDS(...) __VA_ARGS__
1c324e59 887
95c25348
PW
888/*
889 * For state dump, check that "session" argument (mandatory) matches the
890 * session this event belongs to. Ensures that we write state dump data only
891 * into the started session, not into all sessions.
892 */
91fe3e13
MJ
893#undef LTTNG_UST__TP_SESSION_CHECK
894#ifdef LTTNG_UST_TP_SESSION_CHECK
895#define LTTNG_UST__TP_SESSION_CHECK(session, csession) (session == csession)
95c25348 896#else /* TP_SESSION_CHECK */
91fe3e13 897#define LTTNG_UST__TP_SESSION_CHECK(session, csession) 1
95c25348
PW
898#endif /* TP_SESSION_CHECK */
899
97904b41
MD
900/*
901 * Use of __builtin_return_address(0) sometimes seems to cause stack
902 * corruption on 32-bit PowerPC. Disable this feature on that
903 * architecture for now by always using the NULL value for the ip
904 * context.
905 */
c28c4a88
MJ
906#undef LTTNG_UST__TP_IP_PARAM
907
908#ifdef LTTNG_UST_TP_IP_PARAM
909#define LTTNG_UST__TP_IP_PARAM(x) (x)
5dadb547 910#else /* TP_IP_PARAM */
97904b41 911
2eba8e39 912#if defined(LTTNG_UST_ARCH_PPC) && !defined(LTTNG_UST_ARCH_PPC64)
c28c4a88 913#define LTTNG_UST__TP_IP_PARAM(x) NULL
2eba8e39 914#else
c28c4a88 915#define LTTNG_UST__TP_IP_PARAM(x) __builtin_return_address(0)
2eba8e39 916#endif
97904b41 917
5dadb547
MD
918#endif /* TP_IP_PARAM */
919
1ddfd641
MD
920/*
921 * Using twice size for filter stack data to hold size and pointer for
922 * each field (worse case). For integers, max size required is 64-bit.
923 * Same for double-precision floats. Those fit within
924 * 2*sizeof(unsigned long) for all supported architectures.
61ce3223 925 * Perform UNION (||) of filter runtime list.
1ddfd641 926 */
7f2f82c3 927#undef LTTNG_UST__TRACEPOINT_EVENT_CLASS
b2e37d27 928#define LTTNG_UST__TRACEPOINT_EVENT_CLASS(_provider, _name, _args, _fields) \
106ff4da 929static \
b2e37d27 930void lttng_ust__event_probe__##_provider##___##_name(LTTNG_UST__TP_ARGS_DATA_PROTO(_args)) \
106ff4da 931 lttng_ust_notrace; \
a8909ba5 932static \
b2e37d27 933void lttng_ust__event_probe__##_provider##___##_name(LTTNG_UST__TP_ARGS_DATA_PROTO(_args)) \
1c324e59 934{ \
ba99fbe2 935 struct lttng_ust_event_common *__event = (struct lttng_ust_event_common *) __tp_data; \
1c324e59 936 size_t __dynamic_len_idx = 0; \
bfcc2759 937 const size_t __num_fields = LTTNG_UST__TP_ARRAY_SIZE(lttng_ust__event_fields___##_provider##___##_name) - 1; \
b2e37d27 938 struct lttng_ust_probe_ctx __probe_ctx; \
d71b57b9 939 union { \
75026e9f 940 size_t __dynamic_len[__num_fields]; \
ba99fbe2 941 char __interpreter_stack_data[2 * sizeof(unsigned long) * __num_fields]; \
d71b57b9 942 } __stackvar; \
1c324e59 943 int __ret; \
a2e4d05e 944 bool __interpreter_stack_prepared = false; \
1c324e59
MD
945 \
946 if (0) \
947 (void) __dynamic_len_idx; /* don't warn if unused */ \
ba99fbe2
MD
948 switch (__event->type) { \
949 case LTTNG_UST_EVENT_TYPE_RECORDER: \
950 { \
26376e52
MD
951 struct lttng_ust_event_recorder *__event_recorder = (struct lttng_ust_event_recorder *) __event->child; \
952 struct lttng_ust_channel_buffer *__chan = __event_recorder->chan; \
e7bc0ef6 953 struct lttng_ust_channel_common *__chan_common = __chan->parent; \
ba99fbe2 954 \
b2e37d27 955 if (!LTTNG_UST__TP_SESSION_CHECK(session, __chan_common->session)) \
ba99fbe2 956 return; \
e7bc0ef6 957 if (caa_unlikely(!CMM_ACCESS_ONCE(__chan_common->session->active))) \
ba99fbe2 958 return; \
e7bc0ef6 959 if (caa_unlikely(!CMM_ACCESS_ONCE(__chan_common->enabled))) \
ba99fbe2
MD
960 return; \
961 break; \
962 } \
963 case LTTNG_UST_EVENT_TYPE_NOTIFIER: \
964 break; \
965 } \
966 if (caa_unlikely(!CMM_ACCESS_ONCE(__event->enabled))) \
1c324e59 967 return; \
b2e37d27 968 if (caa_unlikely(!LTTNG_UST_TP_RCU_LINK_TEST())) \
1b436e01 969 return; \
b2e37d27
MD
970 __probe_ctx.struct_size = sizeof(struct lttng_ust_probe_ctx); \
971 __probe_ctx.ip = LTTNG_UST__TP_IP_PARAM(LTTNG_UST_TP_IP_PARAM); \
972 if (caa_unlikely(CMM_ACCESS_ONCE(__event->eval_filter))) { \
bfcc2759 973 lttng_ust__event_prepare_interpreter_stack__##_provider##___##_name(__stackvar.__interpreter_stack_data, \
b2e37d27 974 LTTNG_UST__TP_ARGS_DATA_VAR(_args)); \
a2e4d05e 975 __interpreter_stack_prepared = true; \
b2e37d27
MD
976 if (caa_likely(__event->run_filter(__event, \
977 __stackvar.__interpreter_stack_data, &__probe_ctx, NULL) != LTTNG_UST_EVENT_FILTER_ACCEPT)) \
61ce3223 978 return; \
1ddfd641 979 } \
ba99fbe2
MD
980 switch (__event->type) { \
981 case LTTNG_UST_EVENT_TYPE_RECORDER: \
982 { \
26376e52
MD
983 size_t __event_len, __event_align; \
984 struct lttng_ust_event_recorder *__event_recorder = (struct lttng_ust_event_recorder *) __event->child; \
985 struct lttng_ust_channel_buffer *__chan = __event_recorder->chan; \
b2e37d27 986 struct lttng_ust_ring_buffer_ctx __ctx; \
ba99fbe2 987 \
bfcc2759 988 __event_len = lttng_ust__event_get_size__##_provider##___##_name(__stackvar.__dynamic_len, \
6eddcb06 989 LTTNG_UST__TP_ARGS_DATA_VAR(_args)); \
26376e52
MD
990 __event_align = lttng_ust__event_get_align__##_provider##___##_name(LTTNG_UST__TP_ARGS_VAR(_args)); \
991 lttng_ust_ring_buffer_ctx_init(&__ctx, __event_recorder, __event_len, __event_align, \
b2e37d27 992 &__probe_ctx); \
8936b6c0 993 __ret = __chan->ops->event_reserve(&__ctx); \
ba99fbe2
MD
994 if (__ret < 0) \
995 return; \
996 _fields \
997 __chan->ops->event_commit(&__ctx); \
998 break; \
999 } \
1000 case LTTNG_UST_EVENT_TYPE_NOTIFIER: \
1001 { \
26376e52 1002 struct lttng_ust_event_notifier *__event_notifier = (struct lttng_ust_event_notifier *) __event->child; \
a2e4d05e
MD
1003 struct lttng_ust_notification_ctx __notif_ctx; \
1004 \
1005 __notif_ctx.struct_size = sizeof(struct lttng_ust_notification_ctx); \
26376e52 1006 __notif_ctx.eval_capture = CMM_ACCESS_ONCE(__event_notifier->eval_capture); \
ba99fbe2 1007 \
a2e4d05e 1008 if (caa_unlikely(!__interpreter_stack_prepared && __notif_ctx.eval_capture)) \
bfcc2759 1009 lttng_ust__event_prepare_interpreter_stack__##_provider##___##_name(__stackvar.__interpreter_stack_data, \
b2e37d27 1010 LTTNG_UST__TP_ARGS_DATA_VAR(_args)); \
ba99fbe2 1011 \
26376e52 1012 __event_notifier->notification_send(__event_notifier, \
a2e4d05e 1013 __stackvar.__interpreter_stack_data, \
b2e37d27 1014 &__probe_ctx, \
a2e4d05e 1015 &__notif_ctx); \
ba99fbe2
MD
1016 break; \
1017 } \
1018 } \
1c324e59
MD
1019}
1020
bb71a8ea 1021#include LTTNG_UST_TRACEPOINT_INCLUDE
1c324e59 1022
bae1f483 1023#undef lttng_ust__get_dynamic_len
1c324e59 1024
05ceaafd 1025/*
882a56d7 1026 * Stage 6 of tracepoint event generation.
1c324e59 1027 *
df854e41
MD
1028 * Tracepoint loglevel mapping definition generation. We generate a
1029 * symbol for each mapping for a provider/event to ensure at most a 1 to
1030 * 1 mapping between events and loglevels. If the symbol is repeated,
1031 * the compiler will complain.
05ceaafd
MD
1032 */
1033
7f2f82c3 1034/* Reset all macros within LTTNG_UST_TRACEPOINT_EVENT */
05ceaafd
MD
1035#include <lttng/ust-tracepoint-event-reset.h>
1036
4ea4f80e
MD
1037/*
1038 * Declare _loglevel___##__provider##___##__name as non-static, with
1039 * hidden visibility for c++ handling of weakref. We do a weakref to the
1040 * symbol in a later stage, which requires that the symbol is not
1041 * mangled.
1042 */
1043#ifdef __cplusplus
fc6d7bef 1044#define LTTNG_UST_TP_EXTERN_C extern "C"
4ea4f80e 1045#else
fc6d7bef 1046#define LTTNG_UST_TP_EXTERN_C
4ea4f80e
MD
1047#endif
1048
612e9ce4
MJ
1049#undef LTTNG_UST_TRACEPOINT_LOGLEVEL
1050#define LTTNG_UST_TRACEPOINT_LOGLEVEL(__provider, __name, __loglevel) \
3d33ca1d
MD
1051static const int _loglevel_value___##__provider##___##__name = __loglevel; \
1052LTTNG_UST_TP_EXTERN_C const int * const _loglevel___##__provider##___##__name \
1053 __attribute__((visibility("hidden"))) = \
457a6b58 1054 &_loglevel_value___##__provider##___##__name;
df854e41 1055
bb71a8ea 1056#include LTTNG_UST_TRACEPOINT_INCLUDE
df854e41 1057
fc6d7bef 1058#undef LTTNG_UST_TP_EXTERN_C
4ea4f80e 1059
6ddc916d
MD
1060/*
1061 * Stage 6.1 of tracepoint event generation.
1062 *
1063 * Tracepoint UML URI info.
1064 */
1065
7f2f82c3 1066/* Reset all macros within LTTNG_UST_TRACEPOINT_EVENT */
6ddc916d
MD
1067#include <lttng/ust-tracepoint-event-reset.h>
1068
4ea4f80e
MD
1069/*
1070 * Declare _model_emf_uri___##__provider##___##__name as non-static,
1071 * with hidden visibility for c++ handling of weakref. We do a weakref
1072 * to the symbol in a later stage, which requires that the symbol is not
1073 * mangled.
1074 */
1075#ifdef __cplusplus
fc6d7bef 1076#define LTTNG_UST_TP_EXTERN_C extern "C"
4ea4f80e 1077#else
fc6d7bef 1078#define LTTNG_UST_TP_EXTERN_C
4ea4f80e
MD
1079#endif
1080
dbcc2f92
MJ
1081#undef LTTNG_UST_TRACEPOINT_MODEL_EMF_URI
1082#define LTTNG_UST_TRACEPOINT_MODEL_EMF_URI(__provider, __name, __uri) \
3d33ca1d 1083LTTNG_UST_TP_EXTERN_C const char * const _model_emf_uri___##__provider##___##__name \
082802f9 1084 __attribute__((visibility("hidden"))) = __uri; \
6ddc916d 1085
bb71a8ea 1086#include LTTNG_UST_TRACEPOINT_INCLUDE
6ddc916d 1087
fc6d7bef 1088#undef LTTNG_UST_TP_EXTERN_C
4ea4f80e 1089
5b4c6da4
MD
1090/*
1091 * Stage 7.0 of tracepoint event generation.
1092 *
df854e41 1093 * Create events description structures. We use a weakref because
3d33ca1d 1094 * loglevels are optional. If not declared, the event will point to
df854e41 1095 * a loglevel that contains NULL.
3d33ca1d
MD
1096 *
1097 * C++ requires that const objects have a user-declared default
1098 * constructor. However, in both C++ and C, weakref cannot be
1099 * initialized because it causes the weakref attribute to be ignored.
1100 * Therefore, the loglevel and model_emf_uri pointers are not const
1101 * to ensure C++ compilers default-initialize them.
df854e41
MD
1102 */
1103
7f2f82c3 1104/* Reset all macros within LTTNG_UST_TRACEPOINT_EVENT */
df854e41
MD
1105#include <lttng/ust-tracepoint-event-reset.h>
1106
7f2f82c3 1107#undef LTTNG_UST__TRACEPOINT_EVENT_INSTANCE
5b675300 1108#define LTTNG_UST__TRACEPOINT_EVENT_INSTANCE(_template_provider, _template_name, _provider, _name, _args) \
882a56d7
MD
1109static const int * \
1110 __ref_loglevel___##_provider##___##_name \
1111 __attribute__((weakref ("_loglevel___" #_provider "___" #_name))); \
6ddc916d
MD
1112static const char * \
1113 __ref_model_emf_uri___##_provider##___##_name \
1114 __attribute__((weakref ("_model_emf_uri___" #_provider "___" #_name)));\
bfcc2759 1115static const struct lttng_ust_event_desc lttng_ust__event_desc___##_provider##_##_name = { \
dc11f93f 1116 .struct_size = sizeof(struct lttng_ust_event_desc), \
5b4c6da4 1117 .event_name = #_name, \
c9201081 1118 .probe_desc = &lttng_ust__probe_desc___##_provider, \
5b675300 1119 .tp_class = &lttng_ust__event_class___##_template_provider##___##_template_name, \
882a56d7 1120 .loglevel = &__ref_loglevel___##_provider##___##_name, \
dc11f93f 1121 .model_emf_uri = &__ref_model_emf_uri___##_provider##___##_name, \
df854e41
MD
1122};
1123
bb71a8ea 1124#include LTTNG_UST_TRACEPOINT_INCLUDE
05ceaafd 1125
df854e41 1126/*
2e7160d2 1127 * Stage 7.1 of tracepoint event generation.
df854e41
MD
1128 *
1129 * Create array of events.
1130 */
1131
7f2f82c3 1132/* Reset all macros within LTTNG_UST_TRACEPOINT_EVENT */
df854e41
MD
1133#include <lttng/ust-tracepoint-event-reset.h>
1134
7f2f82c3 1135#undef LTTNG_UST__TRACEPOINT_EVENT_INSTANCE
5b675300 1136#define LTTNG_UST__TRACEPOINT_EVENT_INSTANCE(_template_provider, _template_name, _provider, _name, _args) \
bfcc2759 1137 &lttng_ust__event_desc___##_provider##_##_name,
df854e41 1138
0997899b 1139static const struct lttng_ust_event_desc * const LTTNG_UST__TP_COMBINE_TOKENS(lttng_ust__provider_event_desc___, LTTNG_UST_TRACEPOINT_PROVIDER)[] = {
bb71a8ea 1140#include LTTNG_UST_TRACEPOINT_INCLUDE
1c80c909 1141 NULL, /* Dummy, C99 forbids 0-len array. */
05ceaafd
MD
1142};
1143
df854e41 1144
05ceaafd 1145/*
882a56d7 1146 * Stage 8 of tracepoint event generation.
05ceaafd
MD
1147 *
1148 * Create a toplevel descriptor for the whole probe.
1149 */
1150
c9201081 1151const struct lttng_ust_probe_desc LTTNG_UST__TP_COMBINE_TOKENS(lttng_ust__probe_desc___, LTTNG_UST_TRACEPOINT_PROVIDER) = {
dc11f93f 1152 .struct_size = sizeof(struct lttng_ust_probe_desc),
061fc37a 1153 .provider_name = lttng_ust__tp_stringify(LTTNG_UST_TRACEPOINT_PROVIDER),
0997899b
MD
1154 .event_desc = LTTNG_UST__TP_COMBINE_TOKENS(lttng_ust__provider_event_desc___, LTTNG_UST_TRACEPOINT_PROVIDER),
1155 .nr_events = LTTNG_UST__TP_ARRAY_SIZE(LTTNG_UST__TP_COMBINE_TOKENS(lttng_ust__provider_event_desc___, LTTNG_UST_TRACEPOINT_PROVIDER)) - 1,
71d31690
MD
1156 .major = LTTNG_UST_PROVIDER_MAJOR,
1157 .minor = LTTNG_UST_PROVIDER_MINOR,
05ceaafd
MD
1158};
1159
03221919 1160static int LTTNG_UST__TP_COMBINE_TOKENS(lttng_ust__probe_register_refcount___, LTTNG_UST_TRACEPOINT_PROVIDER);
f082dde9 1161static struct lttng_ust_registered_probe *LTTNG_UST__TP_COMBINE_TOKENS(lttng_ust__probe_register_cookie___, LTTNG_UST_TRACEPOINT_PROVIDER);
f0cc794d 1162
05ceaafd 1163/*
882a56d7 1164 * Stage 9 of tracepoint event generation.
05ceaafd 1165 *
1c324e59 1166 * Register/unregister probes at module load/unload.
628e1d81
MD
1167 *
1168 * Generate the constructor as an externally visible symbol for use when
1169 * linking the probe statically.
f0cc794d
MD
1170 *
1171 * Register refcount is protected by libc dynamic loader mutex.
05bfa3dc
JG
1172 *
1173 * Note that when building this code as C++, the definition of constructors
1174 * and destructors invoking the registration and unregistration functions
1175 * must be performed _after_ the initialization of the probes.
1176 *
1177 * This is because we rely on the order of initialization of static variables
1178 * and anonymous namespaces (their order of declaration) to ensure probes are
1179 * fully initialized, see
1180 * https://en.cppreference.com/w/cpp/language/initialization. This is especially
1181 * important when LTTNG_UST_ALLOCATE_COMPOUND_LITERAL_ON_HEAP is defined as
1182 * compound literals are then dynamically initialized.
1c324e59
MD
1183 */
1184
7f2f82c3 1185/* Reset all macros within LTTNG_UST_TRACEPOINT_EVENT */
1c324e59 1186#include <lttng/ust-tracepoint-event-reset.h>
05bfa3dc 1187
465a0d04 1188static void
05bfa3dc 1189LTTNG_UST__TP_COMBINE_TOKENS(lttng_ust__events_init__, LTTNG_UST_TRACEPOINT_PROVIDER)(void) lttng_ust_notrace;
a8909ba5 1190static void
11bce056 1191LTTNG_UST__TP_COMBINE_TOKENS(lttng_ust__events_init__, LTTNG_UST_TRACEPOINT_PROVIDER)(void)
1c324e59 1192{
4e48b5d2 1193 struct lttng_ust_registered_probe *reg_probe;
1c324e59 1194
03221919 1195 if (LTTNG_UST__TP_COMBINE_TOKENS(lttng_ust__probe_register_refcount___,
5b393d64 1196 LTTNG_UST_TRACEPOINT_PROVIDER)++) {
f0cc794d
MD
1197 return;
1198 }
e8bd1da7 1199 /*
5b393d64 1200 * lttng_ust_tracepoint_provider_check_ ## LTTNG_UST_TRACEPOINT_PROVIDER() is a
e8bd1da7
MD
1201 * static inline function that ensures every probe PROVIDER
1202 * argument match the provider within which they appear. It
1203 * calls empty static inline functions, and therefore has no
1204 * runtime effect. However, if it detects an error, a linker
1205 * error will appear.
1206 */
5b393d64 1207 LTTNG_UST__TP_COMBINE_TOKENS(lttng_ust_tracepoint_provider_check_, LTTNG_UST_TRACEPOINT_PROVIDER)();
f082dde9 1208 assert(!LTTNG_UST__TP_COMBINE_TOKENS(lttng_ust__probe_register_cookie___, LTTNG_UST_TRACEPOINT_PROVIDER));
c9201081 1209 reg_probe = lttng_ust_probe_register(&LTTNG_UST__TP_COMBINE_TOKENS(lttng_ust__probe_desc___, LTTNG_UST_TRACEPOINT_PROVIDER));
4e48b5d2
MD
1210 if (!reg_probe) {
1211 fprintf(stderr, "LTTng-UST: Error while registering tracepoint probe.\n");
7d381d6e
MD
1212 abort();
1213 }
f082dde9 1214 LTTNG_UST__TP_COMBINE_TOKENS(lttng_ust__probe_register_cookie___, LTTNG_UST_TRACEPOINT_PROVIDER) = reg_probe;
1c324e59
MD
1215}
1216
c589eca2 1217static void
05bfa3dc 1218LTTNG_UST__TP_COMBINE_TOKENS(lttng_ust__events_exit__, LTTNG_UST_TRACEPOINT_PROVIDER)(void) lttng_ust_notrace;
a8909ba5 1219static void
638ce920 1220LTTNG_UST__TP_COMBINE_TOKENS(lttng_ust__events_exit__, LTTNG_UST_TRACEPOINT_PROVIDER)(void)
1c324e59 1221{
03221919 1222 if (--LTTNG_UST__TP_COMBINE_TOKENS(lttng_ust__probe_register_refcount___,
5b393d64 1223 LTTNG_UST_TRACEPOINT_PROVIDER)) {
f0cc794d
MD
1224 return;
1225 }
f082dde9
MJ
1226 lttng_ust_probe_unregister(LTTNG_UST__TP_COMBINE_TOKENS(lttng_ust__probe_register_cookie___, LTTNG_UST_TRACEPOINT_PROVIDER));
1227 LTTNG_UST__TP_COMBINE_TOKENS(lttng_ust__probe_register_cookie___, LTTNG_UST_TRACEPOINT_PROVIDER) = NULL;
1c324e59 1228}
628e1d81 1229
05bfa3dc
JG
1230LTTNG_UST_DECLARE_CONSTRUCTOR_DESTRUCTOR(
1231 LTTNG_UST_TRACEPOINT_PROVIDER,
1232 LTTNG_UST__TP_COMBINE_TOKENS(lttng_ust__events_init__, LTTNG_UST_TRACEPOINT_PROVIDER),
1233 LTTNG_UST__TP_COMBINE_TOKENS(lttng_ust__events_exit__, LTTNG_UST_TRACEPOINT_PROVIDER),
1234 lttng_ust_notrace)
1235
29d6f421
MD
1236/*
1237 * LTTNG_UST_TRACEPOINT_PROVIDER_HIDDEN_DEFINITION: Define this before
1238 * including a tracepoint instrumentation header to hide symbols
1239 * associated with the tracepoint provider. This is useful if the
1240 * tracepoint definition (including the header after defining
1241 * LTTNG_UST_TRACEPOINT_DEFINE) is in the same module as the provider
1242 * (including the header after defining
1243 * LTTNG_UST_TRACEPOINT_CREATE_PROBES).
1244 */
1245#undef LTTNG_UST__TRACEPOINT_PROVIDER_DEFINITION_VISIBILITY
1246#ifdef LTTNG_UST_TRACEPOINT_PROVIDER_HIDDEN_DEFINITION
1247#define LTTNG_UST__TRACEPOINT_PROVIDER_DEFINITION_VISIBILITY __attribute__((visibility("hidden")))
1248#else
1249#define LTTNG_UST__TRACEPOINT_PROVIDER_DEFINITION_VISIBILITY __attribute__((visibility("default")))
1250#endif
1251
5b393d64 1252int LTTNG_UST__TP_COMBINE_TOKENS(lttng_ust_tracepoint_provider_, LTTNG_UST_TRACEPOINT_PROVIDER)
29d6f421 1253 LTTNG_UST__TRACEPOINT_PROVIDER_DEFINITION_VISIBILITY;
This page took 0.119257 seconds and 4 git commands to generate.