Commit | Line | Data |
---|---|---|
f611d0c3 MD |
1 | // SPDX-License-Identifier: MIT |
2 | /* | |
3 | * Copyright 2022 Mathieu Desnoyers <mathieu.desnoyers@efficios.com> | |
4 | */ | |
5 | ||
6 | #include <stdint.h> | |
7 | #include <inttypes.h> | |
8 | #include <stdlib.h> | |
9 | #include <stdio.h> | |
4f40d951 | 10 | #include <stdbool.h> |
7a1cb105 | 11 | #include <stddef.h> |
f611d0c3 | 12 | |
67337c4a | 13 | #include <side/trace.h> |
f611d0c3 MD |
14 | |
15 | /* User code example */ | |
16 | ||
67337c4a MD |
17 | side_static_event(my_provider_event, "myprovider", "myevent", SIDE_LOGLEVEL_DEBUG, |
18 | side_field_list( | |
19 | side_field_u32("abc", side_attr_list()), | |
20 | side_field_s64("def", side_attr_list()), | |
21 | side_field_pointer("ptr", side_attr_list()), | |
22 | side_field_dynamic("dynamic"), | |
23 | side_field_dynamic("dynamic_pointer"), | |
24 | side_field_null("null", side_attr_list()), | |
399c836b | 25 | ), |
67337c4a | 26 | side_attr_list() |
f611d0c3 MD |
27 | ); |
28 | ||
29 | static | |
30 | void test_fields(void) | |
31 | { | |
32 | uint32_t uw = 42; | |
33 | int64_t sdw = -500; | |
34 | ||
67337c4a MD |
35 | side_event(my_provider_event, |
36 | side_arg_list( | |
37 | side_arg_u32(uw), | |
38 | side_arg_s64(sdw), | |
39 | side_arg_pointer((void *) 0x1), | |
40 | side_arg_dynamic_string("zzz", side_attr_list()), | |
41 | side_arg_dynamic_pointer((void *) 0x1, side_attr_list()), | |
42 | side_arg_null(), | |
f5e650d7 MD |
43 | ) |
44 | ); | |
f611d0c3 MD |
45 | } |
46 | ||
67337c4a MD |
47 | side_hidden_event(my_provider_event_hidden, "myprovider", "myeventhidden", SIDE_LOGLEVEL_DEBUG, |
48 | side_field_list( | |
49 | side_field_u32("abc", side_attr_list()), | |
89747802 | 50 | ), |
67337c4a | 51 | side_attr_list() |
89747802 MD |
52 | ); |
53 | ||
54 | static | |
55 | void test_event_hidden(void) | |
56 | { | |
67337c4a | 57 | side_event(my_provider_event_hidden, side_arg_list(side_arg_u32(2))); |
89747802 MD |
58 | } |
59 | ||
67337c4a | 60 | side_declare_event(my_provider_event_export); |
89747802 | 61 | |
67337c4a MD |
62 | side_export_event(my_provider_event_export, "myprovider", "myeventexport", SIDE_LOGLEVEL_DEBUG, |
63 | side_field_list( | |
64 | side_field_u32("abc", side_attr_list()), | |
89747802 | 65 | ), |
67337c4a | 66 | side_attr_list() |
89747802 MD |
67 | ); |
68 | ||
69 | static | |
70 | void test_event_export(void) | |
71 | { | |
67337c4a | 72 | side_event(my_provider_event_export, side_arg_list(side_arg_u32(2))); |
89747802 MD |
73 | } |
74 | ||
67337c4a MD |
75 | side_static_event(my_provider_event_struct_literal, "myprovider", "myeventstructliteral", SIDE_LOGLEVEL_DEBUG, |
76 | side_field_list( | |
77 | side_field_struct("structliteral", | |
78 | side_struct_literal( | |
79 | side_field_list( | |
80 | side_field_u32("x", side_attr_list()), | |
81 | side_field_s64("y", side_attr_list()), | |
c7a14585 | 82 | ), |
67337c4a | 83 | side_attr_list() |
c7a14585 | 84 | ) |
f611d0c3 | 85 | ), |
67337c4a | 86 | side_field_u8("z", side_attr_list()), |
399c836b | 87 | ), |
67337c4a | 88 | side_attr_list() |
f611d0c3 MD |
89 | ); |
90 | ||
c7a14585 MD |
91 | static |
92 | void test_struct_literal(void) | |
93 | { | |
67337c4a MD |
94 | side_event_cond(my_provider_event_struct_literal) { |
95 | side_arg_define_vec(mystruct, side_arg_list(side_arg_u32(21), side_arg_s64(22))); | |
96 | side_event_call(my_provider_event_struct_literal, side_arg_list(side_arg_struct(&mystruct), side_arg_u8(55))); | |
c7a14585 MD |
97 | } |
98 | } | |
99 | ||
67337c4a MD |
100 | static side_define_struct(mystructdef, |
101 | side_field_list( | |
102 | side_field_u32("x", side_attr_list()), | |
103 | side_field_s64("y", side_attr_list()), | |
c7a14585 | 104 | ), |
67337c4a | 105 | side_attr_list() |
c7a14585 MD |
106 | ); |
107 | ||
67337c4a MD |
108 | side_static_event(my_provider_event_struct, "myprovider", "myeventstruct", SIDE_LOGLEVEL_DEBUG, |
109 | side_field_list( | |
110 | side_field_struct("struct", &mystructdef), | |
111 | side_field_u8("z", side_attr_list()), | |
c7a14585 | 112 | ), |
67337c4a | 113 | side_attr_list() |
c7a14585 MD |
114 | ); |
115 | ||
f611d0c3 MD |
116 | static |
117 | void test_struct(void) | |
118 | { | |
67337c4a MD |
119 | side_event_cond(my_provider_event_struct) { |
120 | side_arg_define_vec(mystruct, side_arg_list(side_arg_u32(21), side_arg_s64(22))); | |
121 | side_event_call(my_provider_event_struct, side_arg_list(side_arg_struct(&mystruct), side_arg_u8(55))); | |
f611d0c3 MD |
122 | } |
123 | } | |
124 | ||
67337c4a MD |
125 | side_static_event(my_provider_event_array, "myprovider", "myarray", SIDE_LOGLEVEL_DEBUG, |
126 | side_field_list( | |
127 | side_field_array("arr", side_elem(side_type_u32(side_attr_list())), 3, side_attr_list()), | |
128 | side_field_s64("v", side_attr_list()), | |
399c836b | 129 | ), |
67337c4a | 130 | side_attr_list() |
f611d0c3 MD |
131 | ); |
132 | ||
133 | static | |
134 | void test_array(void) | |
135 | { | |
67337c4a MD |
136 | side_event_cond(my_provider_event_array) { |
137 | side_arg_define_vec(myarray, side_arg_list(side_arg_u32(1), side_arg_u32(2), side_arg_u32(3))); | |
138 | side_event_call(my_provider_event_array, side_arg_list(side_arg_array(&myarray), side_arg_s64(42))); | |
f611d0c3 MD |
139 | } |
140 | } | |
141 | ||
67337c4a MD |
142 | side_static_event(my_provider_event_vla, "myprovider", "myvla", SIDE_LOGLEVEL_DEBUG, |
143 | side_field_list( | |
144 | side_field_vla("vla", side_elem(side_type_u32(side_attr_list())), side_attr_list()), | |
145 | side_field_s64("v", side_attr_list()), | |
399c836b | 146 | ), |
67337c4a | 147 | side_attr_list() |
f611d0c3 MD |
148 | ); |
149 | ||
150 | static | |
151 | void test_vla(void) | |
152 | { | |
67337c4a MD |
153 | side_event_cond(my_provider_event_vla) { |
154 | side_arg_define_vec(myvla, side_arg_list(side_arg_u32(1), side_arg_u32(2), side_arg_u32(3))); | |
155 | side_event_call(my_provider_event_vla, side_arg_list(side_arg_vla(&myvla), side_arg_s64(42))); | |
f611d0c3 MD |
156 | } |
157 | } | |
158 | ||
cdd6e858 MD |
159 | /* 1D array visitor */ |
160 | ||
f611d0c3 MD |
161 | struct app_visitor_ctx { |
162 | const uint32_t *ptr; | |
352a4b77 | 163 | uint32_t length; |
f611d0c3 MD |
164 | }; |
165 | ||
352a4b77 | 166 | static |
67337c4a | 167 | enum side_visitor_status test_visitor(const struct side_tracer_visitor_ctx *tracer_ctx, void *_ctx) |
f611d0c3 MD |
168 | { |
169 | struct app_visitor_ctx *ctx = (struct app_visitor_ctx *) _ctx; | |
352a4b77 MD |
170 | uint32_t length = ctx->length, i; |
171 | ||
172 | for (i = 0; i < length; i++) { | |
67337c4a | 173 | const struct side_arg elem = side_arg_u32(ctx->ptr[i]); |
ffb5c809 | 174 | |
67337c4a MD |
175 | if (tracer_ctx->write_elem(tracer_ctx, &elem) != SIDE_VISITOR_STATUS_OK) |
176 | return SIDE_VISITOR_STATUS_ERROR; | |
352a4b77 | 177 | } |
67337c4a | 178 | return SIDE_VISITOR_STATUS_OK; |
f611d0c3 MD |
179 | } |
180 | ||
181 | static uint32_t testarray[] = { 1, 2, 3, 4, 5, 6, 7, 8 }; | |
182 | ||
67337c4a MD |
183 | side_static_event(my_provider_event_vla_visitor, "myprovider", "myvlavisit", SIDE_LOGLEVEL_DEBUG, |
184 | side_field_list( | |
185 | side_field_vla_visitor("vlavisit", side_elem(side_type_u32(side_attr_list())), test_visitor, side_attr_list()), | |
186 | side_field_s64("v", side_attr_list()), | |
399c836b | 187 | ), |
67337c4a | 188 | side_attr_list() |
f611d0c3 MD |
189 | ); |
190 | ||
191 | static | |
192 | void test_vla_visitor(void) | |
193 | { | |
67337c4a | 194 | side_event_cond(my_provider_event_vla_visitor) { |
f611d0c3 MD |
195 | struct app_visitor_ctx ctx = { |
196 | .ptr = testarray, | |
67337c4a | 197 | .length = SIDE_ARRAY_SIZE(testarray), |
f611d0c3 | 198 | }; |
67337c4a | 199 | side_event_call(my_provider_event_vla_visitor, side_arg_list(side_arg_vla_visitor(&ctx), side_arg_s64(42))); |
f611d0c3 MD |
200 | } |
201 | } | |
202 | ||
cdd6e858 MD |
203 | /* 2D array visitor */ |
204 | ||
205 | struct app_visitor_2d_inner_ctx { | |
206 | const uint32_t *ptr; | |
207 | uint32_t length; | |
208 | }; | |
209 | ||
210 | static | |
67337c4a | 211 | enum side_visitor_status test_inner_visitor(const struct side_tracer_visitor_ctx *tracer_ctx, void *_ctx) |
cdd6e858 MD |
212 | { |
213 | struct app_visitor_2d_inner_ctx *ctx = (struct app_visitor_2d_inner_ctx *) _ctx; | |
214 | uint32_t length = ctx->length, i; | |
215 | ||
216 | for (i = 0; i < length; i++) { | |
67337c4a | 217 | const struct side_arg elem = side_arg_u32(ctx->ptr[i]); |
ffb5c809 | 218 | |
67337c4a MD |
219 | if (tracer_ctx->write_elem(tracer_ctx, &elem) != SIDE_VISITOR_STATUS_OK) |
220 | return SIDE_VISITOR_STATUS_ERROR; | |
cdd6e858 | 221 | } |
67337c4a | 222 | return SIDE_VISITOR_STATUS_OK; |
cdd6e858 MD |
223 | } |
224 | ||
225 | struct app_visitor_2d_outer_ctx { | |
226 | const uint32_t (*ptr)[2]; | |
227 | uint32_t length; | |
228 | }; | |
229 | ||
230 | static | |
67337c4a | 231 | enum side_visitor_status test_outer_visitor(const struct side_tracer_visitor_ctx *tracer_ctx, void *_ctx) |
cdd6e858 MD |
232 | { |
233 | struct app_visitor_2d_outer_ctx *ctx = (struct app_visitor_2d_outer_ctx *) _ctx; | |
234 | uint32_t length = ctx->length, i; | |
235 | ||
236 | for (i = 0; i < length; i++) { | |
237 | struct app_visitor_2d_inner_ctx inner_ctx = { | |
238 | .ptr = ctx->ptr[i], | |
239 | .length = 2, | |
240 | }; | |
67337c4a MD |
241 | const struct side_arg elem = side_arg_vla_visitor(&inner_ctx); |
242 | if (tracer_ctx->write_elem(tracer_ctx, &elem) != SIDE_VISITOR_STATUS_OK) | |
243 | return SIDE_VISITOR_STATUS_ERROR; | |
cdd6e858 | 244 | } |
67337c4a | 245 | return SIDE_VISITOR_STATUS_OK; |
cdd6e858 MD |
246 | } |
247 | ||
248 | static uint32_t testarray2d[][2] = { | |
249 | { 1, 2 }, | |
250 | { 33, 44 }, | |
251 | { 55, 66 }, | |
252 | }; | |
253 | ||
67337c4a MD |
254 | side_static_event(my_provider_event_vla_visitor2d, "myprovider", "myvlavisit2d", SIDE_LOGLEVEL_DEBUG, |
255 | side_field_list( | |
256 | side_field_vla_visitor("vlavisit2d", | |
257 | side_elem( | |
258 | side_type_vla_visitor( | |
259 | side_elem(side_type_u32(side_attr_list())), | |
f37a556f | 260 | test_inner_visitor, |
67337c4a MD |
261 | side_attr_list()) |
262 | ), test_outer_visitor, side_attr_list()), | |
263 | side_field_s64("v", side_attr_list()), | |
399c836b | 264 | ), |
67337c4a | 265 | side_attr_list() |
cdd6e858 MD |
266 | ); |
267 | ||
268 | static | |
269 | void test_vla_visitor_2d(void) | |
270 | { | |
67337c4a | 271 | side_event_cond(my_provider_event_vla_visitor2d) { |
cdd6e858 MD |
272 | struct app_visitor_2d_outer_ctx ctx = { |
273 | .ptr = testarray2d, | |
67337c4a | 274 | .length = SIDE_ARRAY_SIZE(testarray2d), |
cdd6e858 | 275 | }; |
67337c4a | 276 | side_event_call(my_provider_event_vla_visitor2d, side_arg_list(side_arg_vla_visitor(&ctx), side_arg_s64(42))); |
cdd6e858 MD |
277 | } |
278 | } | |
279 | ||
67337c4a MD |
280 | side_static_event(my_provider_event_dynamic_basic, |
281 | "myprovider", "mydynamicbasic", SIDE_LOGLEVEL_DEBUG, | |
282 | side_field_list( | |
283 | side_field_dynamic("dynamic"), | |
399c836b | 284 | ), |
67337c4a | 285 | side_attr_list() |
a2e2357e MD |
286 | ); |
287 | ||
288 | static | |
289 | void test_dynamic_basic_type(void) | |
290 | { | |
67337c4a MD |
291 | side_event(my_provider_event_dynamic_basic, |
292 | side_arg_list(side_arg_dynamic_s16(-33, side_attr_list()))); | |
a2e2357e MD |
293 | } |
294 | ||
67337c4a MD |
295 | side_static_event(my_provider_event_dynamic_vla, |
296 | "myprovider", "mydynamicvla", SIDE_LOGLEVEL_DEBUG, | |
297 | side_field_list( | |
298 | side_field_dynamic("dynamic"), | |
399c836b | 299 | ), |
67337c4a | 300 | side_attr_list() |
a2e2357e MD |
301 | ); |
302 | ||
303 | static | |
304 | void test_dynamic_vla(void) | |
305 | { | |
67337c4a MD |
306 | side_arg_dynamic_define_vec(myvla, |
307 | side_arg_list( | |
308 | side_arg_dynamic_u32(1, side_attr_list()), | |
309 | side_arg_dynamic_u32(2, side_attr_list()), | |
310 | side_arg_dynamic_u32(3, side_attr_list()), | |
8d20e708 | 311 | ), |
67337c4a | 312 | side_attr_list() |
df075fa5 | 313 | ); |
67337c4a MD |
314 | side_event(my_provider_event_dynamic_vla, |
315 | side_arg_list(side_arg_dynamic_vla(&myvla))); | |
a2e2357e MD |
316 | } |
317 | ||
67337c4a MD |
318 | side_static_event(my_provider_event_dynamic_null, |
319 | "myprovider", "mydynamicnull", SIDE_LOGLEVEL_DEBUG, | |
320 | side_field_list( | |
321 | side_field_dynamic("dynamic"), | |
399c836b | 322 | ), |
67337c4a | 323 | side_attr_list() |
465e5e7e MD |
324 | ); |
325 | ||
326 | static | |
327 | void test_dynamic_null(void) | |
328 | { | |
67337c4a MD |
329 | side_event(my_provider_event_dynamic_null, |
330 | side_arg_list(side_arg_dynamic_null(side_attr_list()))); | |
465e5e7e MD |
331 | } |
332 | ||
67337c4a MD |
333 | side_static_event(my_provider_event_dynamic_struct, |
334 | "myprovider", "mydynamicstruct", SIDE_LOGLEVEL_DEBUG, | |
335 | side_field_list( | |
336 | side_field_dynamic("dynamic"), | |
399c836b | 337 | ), |
67337c4a | 338 | side_attr_list() |
465e5e7e MD |
339 | ); |
340 | ||
341 | static | |
c208889e | 342 | void test_dynamic_struct(void) |
465e5e7e | 343 | { |
67337c4a MD |
344 | side_arg_dynamic_define_struct(mystruct, |
345 | side_arg_list( | |
346 | side_arg_dynamic_field("a", side_arg_dynamic_u32(43, side_attr_list())), | |
347 | side_arg_dynamic_field("b", side_arg_dynamic_string("zzz", side_attr_list())), | |
348 | side_arg_dynamic_field("c", side_arg_dynamic_null(side_attr_list())), | |
8d20e708 | 349 | ), |
67337c4a | 350 | side_attr_list() |
465e5e7e MD |
351 | ); |
352 | ||
67337c4a MD |
353 | side_event(my_provider_event_dynamic_struct, |
354 | side_arg_list(side_arg_dynamic_struct(&mystruct))); | |
465e5e7e MD |
355 | } |
356 | ||
67337c4a MD |
357 | side_static_event(my_provider_event_dynamic_nested_struct, |
358 | "myprovider", "mydynamicnestedstruct", SIDE_LOGLEVEL_DEBUG, | |
359 | side_field_list( | |
360 | side_field_dynamic("dynamic"), | |
399c836b | 361 | ), |
67337c4a | 362 | side_attr_list() |
3222d397 MD |
363 | ); |
364 | ||
365 | static | |
c208889e | 366 | void test_dynamic_nested_struct(void) |
3222d397 | 367 | { |
67337c4a MD |
368 | side_arg_dynamic_define_struct(nested, |
369 | side_arg_list( | |
370 | side_arg_dynamic_field("a", side_arg_dynamic_u32(43, side_attr_list())), | |
371 | side_arg_dynamic_field("b", side_arg_dynamic_u8(55, side_attr_list())), | |
8d20e708 | 372 | ), |
67337c4a | 373 | side_attr_list() |
3222d397 | 374 | ); |
67337c4a MD |
375 | side_arg_dynamic_define_struct(nested2, |
376 | side_arg_list( | |
377 | side_arg_dynamic_field("aa", side_arg_dynamic_u64(128, side_attr_list())), | |
378 | side_arg_dynamic_field("bb", side_arg_dynamic_u16(1, side_attr_list())), | |
8d20e708 | 379 | ), |
67337c4a | 380 | side_attr_list() |
3222d397 | 381 | ); |
67337c4a MD |
382 | side_arg_dynamic_define_struct(mystruct, |
383 | side_arg_list( | |
384 | side_arg_dynamic_field("nested", side_arg_dynamic_struct(&nested)), | |
385 | side_arg_dynamic_field("nested2", side_arg_dynamic_struct(&nested2)), | |
8d20e708 | 386 | ), |
67337c4a | 387 | side_attr_list() |
3222d397 | 388 | ); |
67337c4a MD |
389 | side_event(my_provider_event_dynamic_nested_struct, |
390 | side_arg_list(side_arg_dynamic_struct(&mystruct))); | |
3222d397 MD |
391 | } |
392 | ||
67337c4a MD |
393 | side_static_event(my_provider_event_dynamic_vla_struct, |
394 | "myprovider", "mydynamicvlastruct", SIDE_LOGLEVEL_DEBUG, | |
395 | side_field_list( | |
396 | side_field_dynamic("dynamic"), | |
399c836b | 397 | ), |
67337c4a | 398 | side_attr_list() |
7ce1b78f MD |
399 | ); |
400 | ||
401 | static | |
c208889e | 402 | void test_dynamic_vla_struct(void) |
7ce1b78f | 403 | { |
67337c4a MD |
404 | side_arg_dynamic_define_struct(nested, |
405 | side_arg_list( | |
406 | side_arg_dynamic_field("a", side_arg_dynamic_u32(43, side_attr_list())), | |
407 | side_arg_dynamic_field("b", side_arg_dynamic_u8(55, side_attr_list())), | |
8d20e708 | 408 | ), |
67337c4a | 409 | side_attr_list() |
7ce1b78f | 410 | ); |
67337c4a MD |
411 | side_arg_dynamic_define_vec(myvla, |
412 | side_arg_list( | |
413 | side_arg_dynamic_struct(&nested), | |
414 | side_arg_dynamic_struct(&nested), | |
415 | side_arg_dynamic_struct(&nested), | |
416 | side_arg_dynamic_struct(&nested), | |
8d20e708 | 417 | ), |
67337c4a | 418 | side_attr_list() |
7ce1b78f | 419 | ); |
67337c4a MD |
420 | side_event(my_provider_event_dynamic_vla_struct, |
421 | side_arg_list(side_arg_dynamic_vla(&myvla))); | |
7ce1b78f MD |
422 | } |
423 | ||
67337c4a MD |
424 | side_static_event(my_provider_event_dynamic_struct_vla, |
425 | "myprovider", "mydynamicstructvla", SIDE_LOGLEVEL_DEBUG, | |
426 | side_field_list( | |
427 | side_field_dynamic("dynamic"), | |
399c836b | 428 | ), |
67337c4a | 429 | side_attr_list() |
980bfdc4 MD |
430 | ); |
431 | ||
432 | static | |
c208889e | 433 | void test_dynamic_struct_vla(void) |
980bfdc4 | 434 | { |
67337c4a MD |
435 | side_arg_dynamic_define_vec(myvla, |
436 | side_arg_list( | |
437 | side_arg_dynamic_u32(1, side_attr_list()), | |
438 | side_arg_dynamic_u32(2, side_attr_list()), | |
439 | side_arg_dynamic_u32(3, side_attr_list()), | |
8d20e708 | 440 | ), |
67337c4a | 441 | side_attr_list() |
df075fa5 | 442 | ); |
67337c4a MD |
443 | side_arg_dynamic_define_vec(myvla2, |
444 | side_arg_list( | |
445 | side_arg_dynamic_u32(4, side_attr_list()), | |
446 | side_arg_dynamic_u64(5, side_attr_list()), | |
447 | side_arg_dynamic_u32(6, side_attr_list()), | |
8d20e708 | 448 | ), |
67337c4a | 449 | side_attr_list() |
df075fa5 | 450 | ); |
67337c4a MD |
451 | side_arg_dynamic_define_struct(mystruct, |
452 | side_arg_list( | |
453 | side_arg_dynamic_field("a", side_arg_dynamic_vla(&myvla)), | |
454 | side_arg_dynamic_field("b", side_arg_dynamic_vla(&myvla2)), | |
8d20e708 | 455 | ), |
67337c4a | 456 | side_attr_list() |
980bfdc4 | 457 | ); |
67337c4a MD |
458 | side_event(my_provider_event_dynamic_struct_vla, |
459 | side_arg_list(side_arg_dynamic_struct(&mystruct))); | |
980bfdc4 MD |
460 | } |
461 | ||
67337c4a MD |
462 | side_static_event(my_provider_event_dynamic_nested_vla, |
463 | "myprovider", "mydynamicnestedvla", SIDE_LOGLEVEL_DEBUG, | |
464 | side_field_list( | |
465 | side_field_dynamic("dynamic"), | |
399c836b | 466 | ), |
67337c4a | 467 | side_attr_list() |
948e3e72 MD |
468 | ); |
469 | ||
470 | static | |
471 | void test_dynamic_nested_vla(void) | |
472 | { | |
67337c4a MD |
473 | side_arg_dynamic_define_vec(nestedvla, |
474 | side_arg_list( | |
475 | side_arg_dynamic_u32(1, side_attr_list()), | |
476 | side_arg_dynamic_u16(2, side_attr_list()), | |
477 | side_arg_dynamic_u32(3, side_attr_list()), | |
8d20e708 | 478 | ), |
67337c4a | 479 | side_attr_list() |
948e3e72 | 480 | ); |
67337c4a MD |
481 | side_arg_dynamic_define_vec(nestedvla2, |
482 | side_arg_list( | |
483 | side_arg_dynamic_u8(4, side_attr_list()), | |
484 | side_arg_dynamic_u32(5, side_attr_list()), | |
485 | side_arg_dynamic_u32(6, side_attr_list()), | |
8d20e708 | 486 | ), |
67337c4a | 487 | side_attr_list() |
948e3e72 | 488 | ); |
67337c4a MD |
489 | side_arg_dynamic_define_vec(myvla, |
490 | side_arg_list( | |
491 | side_arg_dynamic_vla(&nestedvla), | |
492 | side_arg_dynamic_vla(&nestedvla2), | |
8d20e708 | 493 | ), |
67337c4a | 494 | side_attr_list() |
948e3e72 | 495 | ); |
67337c4a MD |
496 | side_event(my_provider_event_dynamic_nested_vla, |
497 | side_arg_list(side_arg_dynamic_vla(&myvla))); | |
948e3e72 MD |
498 | } |
499 | ||
67337c4a MD |
500 | side_static_event_variadic(my_provider_event_variadic, |
501 | "myprovider", "myvariadicevent", SIDE_LOGLEVEL_DEBUG, | |
502 | side_field_list(), | |
503 | side_attr_list() | |
19fa6aa2 MD |
504 | ); |
505 | ||
506 | static | |
507 | void test_variadic(void) | |
508 | { | |
67337c4a MD |
509 | side_event_variadic(my_provider_event_variadic, |
510 | side_arg_list(), | |
511 | side_arg_list( | |
512 | side_arg_dynamic_field("a", side_arg_dynamic_u32(55, side_attr_list())), | |
513 | side_arg_dynamic_field("b", side_arg_dynamic_s8(-4, side_attr_list())), | |
8d20e708 | 514 | ), |
67337c4a | 515 | side_attr_list() |
19fa6aa2 MD |
516 | ); |
517 | } | |
518 | ||
67337c4a MD |
519 | side_static_event_variadic(my_provider_event_static_variadic, |
520 | "myprovider", "mystaticvariadicevent", SIDE_LOGLEVEL_DEBUG, | |
521 | side_field_list( | |
522 | side_field_u32("abc", side_attr_list()), | |
523 | side_field_u16("def", side_attr_list()), | |
399c836b | 524 | ), |
67337c4a | 525 | side_attr_list() |
41c4d119 MD |
526 | ); |
527 | ||
528 | static | |
529 | void test_static_variadic(void) | |
530 | { | |
67337c4a MD |
531 | side_event_variadic(my_provider_event_static_variadic, |
532 | side_arg_list( | |
533 | side_arg_u32(1), | |
534 | side_arg_u16(2), | |
41c4d119 | 535 | ), |
67337c4a MD |
536 | side_arg_list( |
537 | side_arg_dynamic_field("a", side_arg_dynamic_u32(55, side_attr_list())), | |
538 | side_arg_dynamic_field("b", side_arg_dynamic_s8(-4, side_attr_list())), | |
8d20e708 | 539 | ), |
67337c4a | 540 | side_attr_list() |
41c4d119 MD |
541 | ); |
542 | } | |
543 | ||
67337c4a MD |
544 | side_static_event(my_provider_event_bool, "myprovider", "myeventbool", SIDE_LOGLEVEL_DEBUG, |
545 | side_field_list( | |
546 | side_field_bool("a_false", side_attr_list()), | |
547 | side_field_bool("b_true", side_attr_list()), | |
548 | side_field_bool("c_true", side_attr_list()), | |
549 | side_field_bool("d_true", side_attr_list()), | |
550 | side_field_bool("e_true", side_attr_list()), | |
551 | side_field_bool("f_false", side_attr_list()), | |
552 | side_field_bool("g_true", side_attr_list()), | |
399c836b | 553 | ), |
67337c4a | 554 | side_attr_list() |
4f40d951 MD |
555 | ); |
556 | ||
557 | static | |
558 | void test_bool(void) | |
559 | { | |
560 | uint32_t a = 0; | |
561 | uint32_t b = 1; | |
562 | uint64_t c = 0x12345678; | |
563 | int16_t d = -32768; | |
564 | bool e = true; | |
565 | bool f = false; | |
566 | uint32_t g = 256; | |
567 | ||
67337c4a MD |
568 | side_event(my_provider_event_bool, |
569 | side_arg_list( | |
570 | side_arg_bool(a), | |
571 | side_arg_bool(b), | |
572 | side_arg_bool(c), | |
573 | side_arg_bool(d), | |
574 | side_arg_bool(e), | |
575 | side_arg_bool(f), | |
576 | side_arg_bool(g), | |
4f40d951 MD |
577 | ) |
578 | ); | |
579 | } | |
580 | ||
67337c4a MD |
581 | side_static_event_variadic(my_provider_event_dynamic_bool, |
582 | "myprovider", "mydynamicbool", SIDE_LOGLEVEL_DEBUG, | |
583 | side_field_list(), | |
584 | side_attr_list() | |
4f40d951 MD |
585 | ); |
586 | ||
587 | static | |
588 | void test_dynamic_bool(void) | |
589 | { | |
67337c4a MD |
590 | side_event_variadic(my_provider_event_dynamic_bool, |
591 | side_arg_list(), | |
592 | side_arg_list( | |
593 | side_arg_dynamic_field("a_true", side_arg_dynamic_bool(55, side_attr_list())), | |
594 | side_arg_dynamic_field("b_true", side_arg_dynamic_bool(-4, side_attr_list())), | |
595 | side_arg_dynamic_field("c_false", side_arg_dynamic_bool(0, side_attr_list())), | |
596 | side_arg_dynamic_field("d_true", side_arg_dynamic_bool(256, side_attr_list())), | |
8d20e708 | 597 | ), |
67337c4a | 598 | side_attr_list() |
4f40d951 MD |
599 | ); |
600 | } | |
601 | ||
67337c4a MD |
602 | side_static_event(my_provider_event_dynamic_vla_visitor, |
603 | "myprovider", "mydynamicvlavisitor", SIDE_LOGLEVEL_DEBUG, | |
604 | side_field_list( | |
605 | side_field_dynamic("dynamic"), | |
399c836b | 606 | ), |
67337c4a | 607 | side_attr_list() |
8ceca0cd MD |
608 | ); |
609 | ||
610 | struct app_dynamic_vla_visitor_ctx { | |
611 | const uint32_t *ptr; | |
612 | uint32_t length; | |
613 | }; | |
614 | ||
615 | static | |
67337c4a | 616 | enum side_visitor_status test_dynamic_vla_visitor(const struct side_tracer_visitor_ctx *tracer_ctx, void *_ctx) |
8ceca0cd MD |
617 | { |
618 | struct app_dynamic_vla_visitor_ctx *ctx = (struct app_dynamic_vla_visitor_ctx *) _ctx; | |
619 | uint32_t length = ctx->length, i; | |
620 | ||
621 | for (i = 0; i < length; i++) { | |
67337c4a MD |
622 | const struct side_arg elem = side_arg_dynamic_u32(ctx->ptr[i], side_attr_list()); |
623 | if (tracer_ctx->write_elem(tracer_ctx, &elem) != SIDE_VISITOR_STATUS_OK) | |
624 | return SIDE_VISITOR_STATUS_ERROR; | |
8ceca0cd | 625 | } |
67337c4a | 626 | return SIDE_VISITOR_STATUS_OK; |
8ceca0cd MD |
627 | } |
628 | ||
629 | static uint32_t testarray_dynamic_vla[] = { 1, 2, 3, 4, 5, 6, 7, 8 }; | |
630 | ||
631 | static | |
632 | void test_dynamic_vla_with_visitor(void) | |
633 | { | |
67337c4a | 634 | side_event_cond(my_provider_event_dynamic_vla_visitor) { |
8ceca0cd MD |
635 | struct app_dynamic_vla_visitor_ctx ctx = { |
636 | .ptr = testarray_dynamic_vla, | |
67337c4a | 637 | .length = SIDE_ARRAY_SIZE(testarray_dynamic_vla), |
8ceca0cd | 638 | }; |
67337c4a MD |
639 | side_event_call(my_provider_event_dynamic_vla_visitor, |
640 | side_arg_list( | |
641 | side_arg_dynamic_vla_visitor(test_dynamic_vla_visitor, &ctx, side_attr_list()) | |
8ceca0cd MD |
642 | ) |
643 | ); | |
644 | } | |
645 | } | |
646 | ||
67337c4a MD |
647 | side_static_event(my_provider_event_dynamic_struct_visitor, |
648 | "myprovider", "mydynamicstructvisitor", SIDE_LOGLEVEL_DEBUG, | |
649 | side_field_list( | |
650 | side_field_dynamic("dynamic"), | |
399c836b | 651 | ), |
67337c4a | 652 | side_attr_list() |
2b359235 MD |
653 | ); |
654 | ||
655 | struct struct_visitor_pair { | |
656 | const char *name; | |
657 | uint32_t value; | |
658 | }; | |
659 | ||
660 | struct app_dynamic_struct_visitor_ctx { | |
661 | const struct struct_visitor_pair *ptr; | |
662 | uint32_t length; | |
663 | }; | |
664 | ||
665 | static | |
67337c4a | 666 | enum side_visitor_status test_dynamic_struct_visitor(const struct side_tracer_dynamic_struct_visitor_ctx *tracer_ctx, void *_ctx) |
2b359235 MD |
667 | { |
668 | struct app_dynamic_struct_visitor_ctx *ctx = (struct app_dynamic_struct_visitor_ctx *) _ctx; | |
669 | uint32_t length = ctx->length, i; | |
670 | ||
671 | for (i = 0; i < length; i++) { | |
67337c4a | 672 | struct side_arg_dynamic_field dynamic_field = { |
2b359235 | 673 | .field_name = ctx->ptr[i].name, |
67337c4a | 674 | .elem = side_arg_dynamic_u32(ctx->ptr[i].value, side_attr_list()), |
2b359235 | 675 | }; |
67337c4a MD |
676 | if (tracer_ctx->write_field(tracer_ctx, &dynamic_field) != SIDE_VISITOR_STATUS_OK) |
677 | return SIDE_VISITOR_STATUS_ERROR; | |
2b359235 | 678 | } |
67337c4a | 679 | return SIDE_VISITOR_STATUS_OK; |
2b359235 MD |
680 | } |
681 | ||
682 | static struct struct_visitor_pair testarray_dynamic_struct[] = { | |
683 | { "a", 1, }, | |
684 | { "b", 2, }, | |
685 | { "c", 3, }, | |
686 | { "d", 4, }, | |
687 | }; | |
688 | ||
689 | static | |
690 | void test_dynamic_struct_with_visitor(void) | |
691 | { | |
67337c4a | 692 | side_event_cond(my_provider_event_dynamic_struct_visitor) { |
2b359235 MD |
693 | struct app_dynamic_struct_visitor_ctx ctx = { |
694 | .ptr = testarray_dynamic_struct, | |
67337c4a | 695 | .length = SIDE_ARRAY_SIZE(testarray_dynamic_struct), |
2b359235 | 696 | }; |
67337c4a MD |
697 | side_event_call(my_provider_event_dynamic_struct_visitor, |
698 | side_arg_list( | |
699 | side_arg_dynamic_struct_visitor(test_dynamic_struct_visitor, &ctx, side_attr_list()) | |
2b359235 MD |
700 | ) |
701 | ); | |
702 | } | |
703 | } | |
704 | ||
67337c4a MD |
705 | side_static_event(my_provider_event_user_attribute, "myprovider", "myevent_user_attribute", SIDE_LOGLEVEL_DEBUG, |
706 | side_field_list( | |
707 | side_field_u32("abc", side_attr_list()), | |
708 | side_field_s64("def", side_attr_list()), | |
399c836b | 709 | ), |
67337c4a MD |
710 | side_attr_list( |
711 | side_attr("user_attribute_a", side_attr_string("val1")), | |
712 | side_attr("user_attribute_b", side_attr_string("val2")), | |
65010f43 MD |
713 | ) |
714 | ); | |
715 | ||
716 | static | |
717 | void test_event_user_attribute(void) | |
718 | { | |
67337c4a | 719 | side_event(my_provider_event_user_attribute, side_arg_list(side_arg_u32(1), side_arg_s64(2))); |
65010f43 MD |
720 | } |
721 | ||
67337c4a MD |
722 | side_static_event(my_provider_field_user_attribute, "myprovider", "myevent_field_attribute", SIDE_LOGLEVEL_DEBUG, |
723 | side_field_list( | |
724 | side_field_u32("abc", | |
725 | side_attr_list( | |
726 | side_attr("user_attribute_a", side_attr_string("val1")), | |
727 | side_attr("user_attribute_b", side_attr_u32(2)), | |
a848763d MD |
728 | ) |
729 | ), | |
67337c4a MD |
730 | side_field_s64("def", |
731 | side_attr_list( | |
732 | side_attr("user_attribute_c", side_attr_string("val3")), | |
733 | side_attr("user_attribute_d", side_attr_s64(-5)), | |
a848763d MD |
734 | ) |
735 | ), | |
736 | ), | |
67337c4a | 737 | side_attr_list() |
a848763d MD |
738 | ); |
739 | ||
740 | static | |
741 | void test_field_user_attribute(void) | |
742 | { | |
67337c4a | 743 | side_event(my_provider_field_user_attribute, side_arg_list(side_arg_u32(1), side_arg_s64(2))); |
a848763d MD |
744 | } |
745 | ||
67337c4a MD |
746 | side_static_event_variadic(my_provider_event_variadic_attr, |
747 | "myprovider", "myvariadiceventattr", SIDE_LOGLEVEL_DEBUG, | |
748 | side_field_list(), | |
749 | side_attr_list() | |
808bd9bf MD |
750 | ); |
751 | ||
752 | static | |
753 | void test_variadic_attr(void) | |
754 | { | |
67337c4a MD |
755 | side_event_variadic(my_provider_event_variadic_attr, |
756 | side_arg_list(), | |
757 | side_arg_list( | |
758 | side_arg_dynamic_field("a", | |
759 | side_arg_dynamic_u32(55, | |
760 | side_attr_list( | |
761 | side_attr("user_attribute_c", side_attr_string("valX")), | |
762 | side_attr("user_attribute_d", side_attr_u8(55)), | |
808bd9bf MD |
763 | ) |
764 | ) | |
765 | ), | |
67337c4a MD |
766 | side_arg_dynamic_field("b", |
767 | side_arg_dynamic_s8(-4, | |
768 | side_attr_list( | |
769 | side_attr("X", side_attr_u8(1)), | |
770 | side_attr("Y", side_attr_s8(2)), | |
808bd9bf MD |
771 | ) |
772 | ) | |
773 | ), | |
8d20e708 | 774 | ), |
67337c4a | 775 | side_attr_list() |
808bd9bf MD |
776 | ); |
777 | } | |
778 | ||
67337c4a MD |
779 | side_static_event_variadic(my_provider_event_variadic_vla_attr, |
780 | "myprovider", "myvariadiceventvlaattr", SIDE_LOGLEVEL_DEBUG, | |
781 | side_field_list(), | |
782 | side_attr_list() | |
808bd9bf MD |
783 | ); |
784 | ||
785 | static | |
786 | void test_variadic_vla_attr(void) | |
787 | { | |
67337c4a MD |
788 | side_arg_dynamic_define_vec(myvla, |
789 | side_arg_list( | |
790 | side_arg_dynamic_u32(1, | |
791 | side_attr_list( | |
792 | side_attr("Z", side_attr_u8(0)), | |
793 | side_attr("A", side_attr_u8(123)), | |
808bd9bf MD |
794 | ) |
795 | ), | |
67337c4a MD |
796 | side_arg_dynamic_u32(2, side_attr_list()), |
797 | side_arg_dynamic_u32(3, side_attr_list()), | |
8d20e708 | 798 | ), |
67337c4a MD |
799 | side_attr_list( |
800 | side_attr("X", side_attr_u8(1)), | |
801 | side_attr("Y", side_attr_u8(2)), | |
808bd9bf MD |
802 | ) |
803 | ); | |
67337c4a MD |
804 | side_event_variadic(my_provider_event_variadic_vla_attr, |
805 | side_arg_list(), | |
806 | side_arg_list( | |
807 | side_arg_dynamic_field("a", side_arg_dynamic_vla(&myvla)), | |
8d20e708 | 808 | ), |
67337c4a | 809 | side_attr_list() |
808bd9bf MD |
810 | ); |
811 | } | |
812 | ||
67337c4a MD |
813 | side_static_event_variadic(my_provider_event_variadic_struct_attr, |
814 | "myprovider", "myvariadiceventstructattr", SIDE_LOGLEVEL_DEBUG, | |
815 | side_field_list(), | |
816 | side_attr_list() | |
808bd9bf MD |
817 | ); |
818 | ||
819 | static | |
820 | void test_variadic_struct_attr(void) | |
821 | { | |
67337c4a MD |
822 | side_event_cond(my_provider_event_variadic_struct_attr) { |
823 | side_arg_dynamic_define_struct(mystruct, | |
824 | side_arg_list( | |
825 | side_arg_dynamic_field("a", | |
826 | side_arg_dynamic_u32(43, | |
827 | side_attr_list( | |
828 | side_attr("A", side_attr_bool(true)), | |
808bd9bf MD |
829 | ) |
830 | ) | |
831 | ), | |
67337c4a | 832 | side_arg_dynamic_field("b", side_arg_dynamic_u8(55, side_attr_list())), |
8d20e708 | 833 | ), |
67337c4a MD |
834 | side_attr_list( |
835 | side_attr("X", side_attr_u8(1)), | |
836 | side_attr("Y", side_attr_u8(2)), | |
808bd9bf MD |
837 | ) |
838 | ); | |
67337c4a MD |
839 | side_event_call_variadic(my_provider_event_variadic_struct_attr, |
840 | side_arg_list(), | |
841 | side_arg_list( | |
842 | side_arg_dynamic_field("a", side_arg_dynamic_struct(&mystruct)), | |
8d20e708 | 843 | ), |
67337c4a | 844 | side_attr_list() |
808bd9bf MD |
845 | ); |
846 | } | |
847 | } | |
848 | ||
67337c4a MD |
849 | side_static_event(my_provider_event_float, "myprovider", "myeventfloat", SIDE_LOGLEVEL_DEBUG, |
850 | side_field_list( | |
fb25b355 | 851 | #if __HAVE_FLOAT16 |
67337c4a MD |
852 | side_field_float_binary16("binary16", side_attr_list()), |
853 | side_field_float_binary16_le("binary16_le", side_attr_list()), | |
854 | side_field_float_binary16_be("binary16_be", side_attr_list()), | |
fb25b355 MD |
855 | #endif |
856 | #if __HAVE_FLOAT32 | |
67337c4a MD |
857 | side_field_float_binary32("binary32", side_attr_list()), |
858 | side_field_float_binary32_le("binary32_le", side_attr_list()), | |
859 | side_field_float_binary32_be("binary32_be", side_attr_list()), | |
fb25b355 MD |
860 | #endif |
861 | #if __HAVE_FLOAT64 | |
67337c4a MD |
862 | side_field_float_binary64("binary64", side_attr_list()), |
863 | side_field_float_binary64_le("binary64_le", side_attr_list()), | |
864 | side_field_float_binary64_be("binary64_be", side_attr_list()), | |
fb25b355 MD |
865 | #endif |
866 | #if __HAVE_FLOAT128 | |
67337c4a MD |
867 | side_field_float_binary128("binary128", side_attr_list()), |
868 | side_field_float_binary128_le("binary128_le", side_attr_list()), | |
869 | side_field_float_binary128_be("binary128_be", side_attr_list()), | |
fb25b355 MD |
870 | #endif |
871 | ), | |
67337c4a | 872 | side_attr_list() |
fb25b355 MD |
873 | ); |
874 | ||
875 | static | |
876 | void test_float(void) | |
877 | { | |
8bdd5c12 MD |
878 | #if __HAVE_FLOAT16 |
879 | union { | |
880 | _Float16 f; | |
881 | uint16_t u; | |
882 | } float16 = { | |
883 | .f = 1.1, | |
884 | }; | |
885 | #endif | |
886 | #if __HAVE_FLOAT32 | |
887 | union { | |
888 | _Float32 f; | |
889 | uint32_t u; | |
890 | } float32 = { | |
891 | .f = 2.2, | |
892 | }; | |
893 | #endif | |
894 | #if __HAVE_FLOAT64 | |
895 | union { | |
896 | _Float64 f; | |
897 | uint64_t u; | |
898 | } float64 = { | |
899 | .f = 3.3, | |
900 | }; | |
901 | #endif | |
902 | #if __HAVE_FLOAT128 | |
903 | union { | |
904 | _Float128 f; | |
905 | char arr[16]; | |
906 | } float128 = { | |
907 | .f = 4.4, | |
908 | }; | |
909 | #endif | |
910 | ||
911 | #if __HAVE_FLOAT16 | |
67337c4a | 912 | float16.u = side_bswap_16(float16.u); |
8bdd5c12 MD |
913 | #endif |
914 | #if __HAVE_FLOAT32 | |
67337c4a | 915 | float32.u = side_bswap_32(float32.u); |
8bdd5c12 MD |
916 | #endif |
917 | #if __HAVE_FLOAT64 | |
67337c4a | 918 | float64.u = side_bswap_64(float64.u); |
8bdd5c12 MD |
919 | #endif |
920 | #if __HAVE_FLOAT128 | |
67337c4a | 921 | side_bswap_128p(float128.arr); |
8bdd5c12 MD |
922 | #endif |
923 | ||
67337c4a MD |
924 | side_event(my_provider_event_float, |
925 | side_arg_list( | |
fb25b355 | 926 | #if __HAVE_FLOAT16 |
67337c4a MD |
927 | side_arg_float_binary16(1.1), |
928 | # if SIDE_FLOAT_WORD_ORDER == SIDE_LITTLE_ENDIAN | |
929 | side_arg_float_binary16(1.1), | |
930 | side_arg_float_binary16(float16.f), | |
8bdd5c12 | 931 | # else |
67337c4a MD |
932 | side_arg_float_binary16(float16.f), |
933 | side_arg_float_binary16(1.1), | |
8bdd5c12 | 934 | # endif |
fb25b355 MD |
935 | #endif |
936 | #if __HAVE_FLOAT32 | |
67337c4a MD |
937 | side_arg_float_binary32(2.2), |
938 | # if SIDE_FLOAT_WORD_ORDER == SIDE_LITTLE_ENDIAN | |
939 | side_arg_float_binary32(2.2), | |
940 | side_arg_float_binary32(float32.f), | |
8bdd5c12 | 941 | # else |
67337c4a MD |
942 | side_arg_float_binary32(float32.f), |
943 | side_arg_float_binary32(2.2), | |
8bdd5c12 | 944 | # endif |
fb25b355 MD |
945 | #endif |
946 | #if __HAVE_FLOAT64 | |
67337c4a MD |
947 | side_arg_float_binary64(3.3), |
948 | # if SIDE_FLOAT_WORD_ORDER == SIDE_LITTLE_ENDIAN | |
949 | side_arg_float_binary64(3.3), | |
950 | side_arg_float_binary64(float64.f), | |
8bdd5c12 | 951 | # else |
67337c4a MD |
952 | side_arg_float_binary64(float64.f), |
953 | side_arg_float_binary64(3.3), | |
8bdd5c12 | 954 | # endif |
fb25b355 MD |
955 | #endif |
956 | #if __HAVE_FLOAT128 | |
67337c4a MD |
957 | side_arg_float_binary128(4.4), |
958 | # if SIDE_FLOAT_WORD_ORDER == SIDE_LITTLE_ENDIAN | |
959 | side_arg_float_binary128(4.4), | |
960 | side_arg_float_binary128(float128.f), | |
8bdd5c12 | 961 | # else |
67337c4a MD |
962 | side_arg_float_binary128(float128.f), |
963 | side_arg_float_binary128(4.4), | |
8bdd5c12 | 964 | # endif |
fb25b355 MD |
965 | #endif |
966 | ) | |
967 | ); | |
968 | } | |
969 | ||
67337c4a MD |
970 | side_static_event_variadic(my_provider_event_variadic_float, |
971 | "myprovider", "myvariadicfloat", SIDE_LOGLEVEL_DEBUG, | |
972 | side_field_list(), | |
973 | side_attr_list() | |
fb25b355 MD |
974 | ); |
975 | ||
976 | static | |
977 | void test_variadic_float(void) | |
978 | { | |
8bdd5c12 MD |
979 | #if __HAVE_FLOAT16 |
980 | union { | |
981 | _Float16 f; | |
982 | uint16_t u; | |
983 | } float16 = { | |
984 | .f = 1.1, | |
985 | }; | |
986 | #endif | |
987 | #if __HAVE_FLOAT32 | |
988 | union { | |
989 | _Float32 f; | |
990 | uint32_t u; | |
991 | } float32 = { | |
992 | .f = 2.2, | |
993 | }; | |
994 | #endif | |
995 | #if __HAVE_FLOAT64 | |
996 | union { | |
997 | _Float64 f; | |
998 | uint64_t u; | |
999 | } float64 = { | |
1000 | .f = 3.3, | |
1001 | }; | |
1002 | #endif | |
1003 | #if __HAVE_FLOAT128 | |
1004 | union { | |
1005 | _Float128 f; | |
1006 | char arr[16]; | |
1007 | } float128 = { | |
1008 | .f = 4.4, | |
1009 | }; | |
1010 | #endif | |
1011 | ||
1012 | #if __HAVE_FLOAT16 | |
67337c4a | 1013 | float16.u = side_bswap_16(float16.u); |
8bdd5c12 MD |
1014 | #endif |
1015 | #if __HAVE_FLOAT32 | |
67337c4a | 1016 | float32.u = side_bswap_32(float32.u); |
8bdd5c12 MD |
1017 | #endif |
1018 | #if __HAVE_FLOAT64 | |
67337c4a | 1019 | float64.u = side_bswap_64(float64.u); |
8bdd5c12 MD |
1020 | #endif |
1021 | #if __HAVE_FLOAT128 | |
67337c4a | 1022 | side_bswap_128p(float128.arr); |
8bdd5c12 MD |
1023 | #endif |
1024 | ||
67337c4a MD |
1025 | side_event_variadic(my_provider_event_variadic_float, |
1026 | side_arg_list(), | |
1027 | side_arg_list( | |
fb25b355 | 1028 | #if __HAVE_FLOAT16 |
67337c4a MD |
1029 | side_arg_dynamic_field("binary16", side_arg_dynamic_float_binary16(1.1, side_attr_list())), |
1030 | # if SIDE_FLOAT_WORD_ORDER == SIDE_LITTLE_ENDIAN | |
1031 | side_arg_dynamic_field("binary16_le", side_arg_dynamic_float_binary16_le(1.1, side_attr_list())), | |
1032 | side_arg_dynamic_field("binary16_be", side_arg_dynamic_float_binary16_be(float16.f, side_attr_list())), | |
8bdd5c12 | 1033 | # else |
67337c4a MD |
1034 | side_arg_dynamic_field("binary16_le", side_arg_dynamic_float_binary16_le(float16.f, side_attr_list())), |
1035 | side_arg_dynamic_field("binary16_be", side_arg_dynamic_float_binary16_be(1.1, side_attr_list())), | |
8bdd5c12 | 1036 | # endif |
fb25b355 MD |
1037 | #endif |
1038 | #if __HAVE_FLOAT32 | |
67337c4a MD |
1039 | side_arg_dynamic_field("binary32", side_arg_dynamic_float_binary32(2.2, side_attr_list())), |
1040 | # if SIDE_FLOAT_WORD_ORDER == SIDE_LITTLE_ENDIAN | |
1041 | side_arg_dynamic_field("binary32_le", side_arg_dynamic_float_binary32_le(2.2, side_attr_list())), | |
1042 | side_arg_dynamic_field("binary32_be", side_arg_dynamic_float_binary32_be(float32.f, side_attr_list())), | |
8bdd5c12 | 1043 | # else |
67337c4a MD |
1044 | side_arg_dynamic_field("binary32_le", side_arg_dynamic_float_binary32_le(float32.f, side_attr_list())), |
1045 | side_arg_dynamic_field("binary32_be", side_arg_dynamic_float_binary32_be(2.2, side_attr_list())), | |
8bdd5c12 | 1046 | # endif |
fb25b355 MD |
1047 | #endif |
1048 | #if __HAVE_FLOAT64 | |
67337c4a MD |
1049 | side_arg_dynamic_field("binary64", side_arg_dynamic_float_binary64(3.3, side_attr_list())), |
1050 | # if SIDE_FLOAT_WORD_ORDER == SIDE_LITTLE_ENDIAN | |
1051 | side_arg_dynamic_field("binary64_le", side_arg_dynamic_float_binary64_le(3.3, side_attr_list())), | |
1052 | side_arg_dynamic_field("binary64_be", side_arg_dynamic_float_binary64_be(float64.f, side_attr_list())), | |
8bdd5c12 | 1053 | # else |
67337c4a MD |
1054 | side_arg_dynamic_field("binary64_le", side_arg_dynamic_float_binary64_le(float64.f, side_attr_list())), |
1055 | side_arg_dynamic_field("binary64_be", side_arg_dynamic_float_binary64_be(3.3, side_attr_list())), | |
8bdd5c12 | 1056 | # endif |
fb25b355 MD |
1057 | #endif |
1058 | #if __HAVE_FLOAT128 | |
67337c4a MD |
1059 | side_arg_dynamic_field("binary128", side_arg_dynamic_float_binary128(4.4, side_attr_list())), |
1060 | # if SIDE_FLOAT_WORD_ORDER == SIDE_LITTLE_ENDIAN | |
1061 | side_arg_dynamic_field("binary128_le", side_arg_dynamic_float_binary128_le(4.4, side_attr_list())), | |
1062 | side_arg_dynamic_field("binary128_be", side_arg_dynamic_float_binary128_be(float128.f, side_attr_list())), | |
8bdd5c12 | 1063 | # else |
67337c4a MD |
1064 | side_arg_dynamic_field("binary128_le", side_arg_dynamic_float_binary128_le(float128.f, side_attr_list())), |
1065 | side_arg_dynamic_field("binary128_be", side_arg_dynamic_float_binary128_be(4.4, side_attr_list())), | |
8bdd5c12 | 1066 | # endif |
fb25b355 | 1067 | #endif |
8d20e708 | 1068 | ), |
67337c4a | 1069 | side_attr_list() |
fb25b355 MD |
1070 | ); |
1071 | } | |
1072 | ||
67337c4a MD |
1073 | static side_define_enum(myenum, |
1074 | side_enum_mapping_list( | |
1075 | side_enum_mapping_range("one-ten", 1, 10), | |
1076 | side_enum_mapping_range("100-200", 100, 200), | |
1077 | side_enum_mapping_value("200", 200), | |
1078 | side_enum_mapping_value("300", 300), | |
d4328528 | 1079 | ), |
67337c4a | 1080 | side_attr_list() |
79f677ba MD |
1081 | ); |
1082 | ||
67337c4a MD |
1083 | side_static_event(my_provider_event_enum, "myprovider", "myeventenum", SIDE_LOGLEVEL_DEBUG, |
1084 | side_field_list( | |
1085 | side_field_enum("5", &myenum, side_elem(side_type_u32(side_attr_list()))), | |
1086 | side_field_enum("400", &myenum, side_elem(side_type_u64(side_attr_list()))), | |
1087 | side_field_enum("200", &myenum, side_elem(side_type_u8(side_attr_list()))), | |
1088 | side_field_enum("-100", &myenum, side_elem(side_type_s8(side_attr_list()))), | |
1089 | side_field_enum("6_be", &myenum, side_elem(side_type_u32_be(side_attr_list()))), | |
1090 | side_field_enum("6_le", &myenum, side_elem(side_type_u32_le(side_attr_list()))), | |
79f677ba | 1091 | ), |
67337c4a | 1092 | side_attr_list() |
79f677ba MD |
1093 | ); |
1094 | ||
1095 | static | |
1096 | void test_enum(void) | |
1097 | { | |
67337c4a MD |
1098 | side_event(my_provider_event_enum, |
1099 | side_arg_list( | |
1100 | side_arg_u32(5), | |
1101 | side_arg_u64(400), | |
1102 | side_arg_u8(200), | |
1103 | side_arg_s8(-100), | |
1104 | #if SIDE_BYTE_ORDER == SIDE_LITTLE_ENDIAN | |
1105 | side_arg_u32(side_bswap_32(6)), | |
1106 | side_arg_u32(6), | |
8bdd5c12 | 1107 | #else |
67337c4a MD |
1108 | side_arg_u32(6), |
1109 | side_arg_u32(side_bswap_32(6)), | |
8bdd5c12 | 1110 | #endif |
79f677ba MD |
1111 | ) |
1112 | ); | |
1113 | } | |
1114 | ||
ea32e5fc | 1115 | /* A bitmap enum maps bits to labels. */ |
67337c4a MD |
1116 | static side_define_enum_bitmap(myenum_bitmap, |
1117 | side_enum_bitmap_mapping_list( | |
1118 | side_enum_bitmap_mapping_value("0", 0), | |
1119 | side_enum_bitmap_mapping_range("1-2", 1, 2), | |
1120 | side_enum_bitmap_mapping_range("2-4", 2, 4), | |
1121 | side_enum_bitmap_mapping_value("3", 3), | |
1122 | side_enum_bitmap_mapping_value("30", 30), | |
1123 | side_enum_bitmap_mapping_value("63", 63), | |
1124 | side_enum_bitmap_mapping_range("158-160", 158, 160), | |
1125 | side_enum_bitmap_mapping_value("159", 159), | |
1126 | side_enum_bitmap_mapping_range("500-700", 500, 700), | |
d4328528 | 1127 | ), |
67337c4a | 1128 | side_attr_list() |
ea32e5fc MD |
1129 | ); |
1130 | ||
67337c4a MD |
1131 | side_static_event(my_provider_event_enum_bitmap, "myprovider", "myeventenumbitmap", SIDE_LOGLEVEL_DEBUG, |
1132 | side_field_list( | |
1133 | side_field_enum_bitmap("bit_0", &myenum_bitmap, side_elem(side_type_u32(side_attr_list()))), | |
1134 | side_field_enum_bitmap("bit_1", &myenum_bitmap, side_elem(side_type_u32(side_attr_list()))), | |
1135 | side_field_enum_bitmap("bit_2", &myenum_bitmap, side_elem(side_type_u8(side_attr_list()))), | |
1136 | side_field_enum_bitmap("bit_3", &myenum_bitmap, side_elem(side_type_u8(side_attr_list()))), | |
1137 | side_field_enum_bitmap("bit_30", &myenum_bitmap, side_elem(side_type_u32(side_attr_list()))), | |
1138 | side_field_enum_bitmap("bit_31", &myenum_bitmap, side_elem(side_type_u32(side_attr_list()))), | |
1139 | side_field_enum_bitmap("bit_63", &myenum_bitmap, side_elem(side_type_u64(side_attr_list()))), | |
1140 | side_field_enum_bitmap("bits_1+63", &myenum_bitmap, side_elem(side_type_u64(side_attr_list()))), | |
1141 | side_field_enum_bitmap("byte_bit_2", &myenum_bitmap, side_elem(side_type_byte(side_attr_list()))), | |
1142 | side_field_enum_bitmap("bit_159", &myenum_bitmap, | |
1143 | side_elem(side_type_array(side_elem(side_type_u32(side_attr_list())), 5, side_attr_list()))), | |
1144 | side_field_enum_bitmap("bit_159", &myenum_bitmap, | |
1145 | side_elem(side_type_vla(side_elem(side_type_u32(side_attr_list())), side_attr_list()))), | |
1146 | side_field_enum_bitmap("bit_2_be", &myenum_bitmap, side_elem(side_type_u32_be(side_attr_list()))), | |
1147 | side_field_enum_bitmap("bit_2_le", &myenum_bitmap, side_elem(side_type_u32_le(side_attr_list()))), | |
ea32e5fc | 1148 | ), |
67337c4a | 1149 | side_attr_list() |
ea32e5fc MD |
1150 | ); |
1151 | ||
1152 | static | |
1153 | void test_enum_bitmap(void) | |
1154 | { | |
67337c4a MD |
1155 | side_event_cond(my_provider_event_enum_bitmap) { |
1156 | side_arg_define_vec(myarray, | |
1157 | side_arg_list( | |
1158 | side_arg_u32(0), | |
1159 | side_arg_u32(0), | |
1160 | side_arg_u32(0), | |
1161 | side_arg_u32(0), | |
1162 | side_arg_u32(0x80000000), /* bit 159 */ | |
af6aa6e1 MD |
1163 | ) |
1164 | ); | |
67337c4a MD |
1165 | side_event_call(my_provider_event_enum_bitmap, |
1166 | side_arg_list( | |
1167 | side_arg_u32(1U << 0), | |
1168 | side_arg_u32(1U << 1), | |
1169 | side_arg_u8(1U << 2), | |
1170 | side_arg_u8(1U << 3), | |
1171 | side_arg_u32(1U << 30), | |
1172 | side_arg_u32(1U << 31), | |
1173 | side_arg_u64(1ULL << 63), | |
1174 | side_arg_u64((1ULL << 1) | (1ULL << 63)), | |
1175 | side_arg_byte(1U << 2), | |
1176 | side_arg_array(&myarray), | |
1177 | side_arg_vla(&myarray), | |
1178 | #if SIDE_BYTE_ORDER == SIDE_LITTLE_ENDIAN | |
1179 | side_arg_u32(side_bswap_32(1U << 2)), | |
1180 | side_arg_u32(1U << 2), | |
8bdd5c12 | 1181 | #else |
67337c4a MD |
1182 | side_arg_u32(1U << 2), |
1183 | side_arg_u32(side_bswap_32(1U << 2)), | |
8bdd5c12 | 1184 | #endif |
af6aa6e1 MD |
1185 | ) |
1186 | ); | |
1187 | } | |
ea32e5fc MD |
1188 | } |
1189 | ||
67337c4a MD |
1190 | side_static_event_variadic(my_provider_event_blob, "myprovider", "myeventblob", SIDE_LOGLEVEL_DEBUG, |
1191 | side_field_list( | |
1192 | side_field_byte("blobfield", side_attr_list()), | |
1193 | side_field_array("arrayblob", side_elem(side_type_byte(side_attr_list())), 3, side_attr_list()), | |
7aec0d09 | 1194 | ), |
67337c4a | 1195 | side_attr_list() |
7aec0d09 MD |
1196 | ); |
1197 | ||
1198 | static | |
1199 | void test_blob(void) | |
1200 | { | |
67337c4a MD |
1201 | side_event_cond(my_provider_event_blob) { |
1202 | side_arg_define_vec(myarray, side_arg_list(side_arg_byte(1), side_arg_byte(2), side_arg_byte(3))); | |
1203 | side_arg_dynamic_define_vec(myvla, | |
1204 | side_arg_list( | |
1205 | side_arg_dynamic_byte(0x22, side_attr_list()), | |
1206 | side_arg_dynamic_byte(0x33, side_attr_list()), | |
8d20e708 | 1207 | ), |
67337c4a | 1208 | side_attr_list() |
199e7aa9 | 1209 | ); |
67337c4a MD |
1210 | side_event_call_variadic(my_provider_event_blob, |
1211 | side_arg_list( | |
1212 | side_arg_byte(0x55), | |
1213 | side_arg_array(&myarray), | |
199e7aa9 | 1214 | ), |
67337c4a MD |
1215 | side_arg_list( |
1216 | side_arg_dynamic_field("varblobfield", | |
1217 | side_arg_dynamic_byte(0x55, side_attr_list()) | |
199e7aa9 | 1218 | ), |
67337c4a | 1219 | side_arg_dynamic_field("varblobvla", side_arg_dynamic_vla(&myvla)), |
8d20e708 | 1220 | ), |
67337c4a | 1221 | side_attr_list() |
7aec0d09 MD |
1222 | ); |
1223 | } | |
1224 | } | |
ea32e5fc | 1225 | |
67337c4a MD |
1226 | side_static_event_variadic(my_provider_event_format_string, |
1227 | "myprovider", "myeventformatstring", SIDE_LOGLEVEL_DEBUG, | |
1228 | side_field_list( | |
1229 | side_field_string("fmt", side_attr_list()), | |
71aa8975 | 1230 | ), |
67337c4a MD |
1231 | side_attr_list( |
1232 | side_attr("lang.c.format_string", side_attr_bool(true)), | |
71aa8975 MD |
1233 | ) |
1234 | ); | |
1235 | ||
1236 | static | |
1237 | void test_fmt_string(void) | |
1238 | { | |
67337c4a MD |
1239 | side_event_cond(my_provider_event_format_string) { |
1240 | side_arg_dynamic_define_vec(args, | |
1241 | side_arg_list( | |
1242 | side_arg_dynamic_string("blah", side_attr_list()), | |
1243 | side_arg_dynamic_s32(123, side_attr_list()), | |
71aa8975 | 1244 | ), |
67337c4a | 1245 | side_attr_list() |
71aa8975 | 1246 | ); |
67337c4a MD |
1247 | side_event_call_variadic(my_provider_event_format_string, |
1248 | side_arg_list( | |
1249 | side_arg_string("This is a formatted string with str: %s int: %d"), | |
71aa8975 | 1250 | ), |
67337c4a MD |
1251 | side_arg_list( |
1252 | side_arg_dynamic_field("arguments", side_arg_dynamic_vla(&args)), | |
71aa8975 | 1253 | ), |
67337c4a | 1254 | side_attr_list() |
71aa8975 MD |
1255 | ); |
1256 | } | |
1257 | } | |
1258 | ||
67337c4a MD |
1259 | side_static_event_variadic(my_provider_event_endian, "myprovider", "myevent_endian", SIDE_LOGLEVEL_DEBUG, |
1260 | side_field_list( | |
1261 | side_field_u16_le("u16_le", side_attr_list()), | |
1262 | side_field_u32_le("u32_le", side_attr_list()), | |
1263 | side_field_u64_le("u64_le", side_attr_list()), | |
1264 | side_field_s16_le("s16_le", side_attr_list()), | |
1265 | side_field_s32_le("s32_le", side_attr_list()), | |
1266 | side_field_s64_le("s64_le", side_attr_list()), | |
1267 | side_field_u16_be("u16_be", side_attr_list()), | |
1268 | side_field_u32_be("u32_be", side_attr_list()), | |
1269 | side_field_u64_be("u64_be", side_attr_list()), | |
1270 | side_field_s16_be("s16_be", side_attr_list()), | |
1271 | side_field_s32_be("s32_be", side_attr_list()), | |
1272 | side_field_s64_be("s64_be", side_attr_list()), | |
8bdd5c12 | 1273 | ), |
67337c4a | 1274 | side_attr_list() |
8bdd5c12 MD |
1275 | ); |
1276 | ||
1277 | static | |
1278 | void test_endian(void) | |
1279 | { | |
67337c4a MD |
1280 | side_event_variadic(my_provider_event_endian, |
1281 | side_arg_list( | |
1282 | #if SIDE_BYTE_ORDER == SIDE_LITTLE_ENDIAN | |
1283 | side_arg_u16(1), | |
1284 | side_arg_u32(1), | |
1285 | side_arg_u64(1), | |
1286 | side_arg_s16(1), | |
1287 | side_arg_s32(1), | |
1288 | side_arg_s64(1), | |
1289 | side_arg_u16(side_bswap_16(1)), | |
1290 | side_arg_u32(side_bswap_32(1)), | |
1291 | side_arg_u64(side_bswap_64(1)), | |
1292 | side_arg_s16(side_bswap_16(1)), | |
1293 | side_arg_s32(side_bswap_32(1)), | |
1294 | side_arg_s64(side_bswap_64(1)), | |
8bdd5c12 | 1295 | #else |
67337c4a MD |
1296 | side_arg_u16(side_bswap_16(1)), |
1297 | side_arg_u32(side_bswap_32(1)), | |
1298 | side_arg_u64(side_bswap_64(1)), | |
1299 | side_arg_s16(side_bswap_16(1)), | |
1300 | side_arg_s32(side_bswap_32(1)), | |
1301 | side_arg_s64(side_bswap_64(1)), | |
1302 | side_arg_u16(1), | |
1303 | side_arg_u32(1), | |
1304 | side_arg_u64(1), | |
1305 | side_arg_s16(1), | |
1306 | side_arg_s32(1), | |
1307 | side_arg_s64(1), | |
8bdd5c12 MD |
1308 | #endif |
1309 | ), | |
67337c4a MD |
1310 | side_arg_list( |
1311 | #if SIDE_BYTE_ORDER == SIDE_LITTLE_ENDIAN | |
1312 | side_arg_dynamic_field("u16_le", side_arg_dynamic_u16_le(1, side_attr_list())), | |
1313 | side_arg_dynamic_field("u32_le", side_arg_dynamic_u32_le(1, side_attr_list())), | |
1314 | side_arg_dynamic_field("u64_le", side_arg_dynamic_u64_le(1, side_attr_list())), | |
1315 | side_arg_dynamic_field("s16_le", side_arg_dynamic_s16_le(1, side_attr_list())), | |
1316 | side_arg_dynamic_field("s32_le", side_arg_dynamic_s32_le(1, side_attr_list())), | |
1317 | side_arg_dynamic_field("s64_le", side_arg_dynamic_s64_le(1, side_attr_list())), | |
1318 | side_arg_dynamic_field("u16_be", side_arg_dynamic_u16_be(side_bswap_16(1), side_attr_list())), | |
1319 | side_arg_dynamic_field("u32_be", side_arg_dynamic_u32_be(side_bswap_32(1), side_attr_list())), | |
1320 | side_arg_dynamic_field("u64_be", side_arg_dynamic_u64_be(side_bswap_64(1), side_attr_list())), | |
1321 | side_arg_dynamic_field("s16_be", side_arg_dynamic_s16_be(side_bswap_16(1), side_attr_list())), | |
1322 | side_arg_dynamic_field("s32_be", side_arg_dynamic_s32_be(side_bswap_32(1), side_attr_list())), | |
1323 | side_arg_dynamic_field("s64_be", side_arg_dynamic_s64_be(side_bswap_64(1), side_attr_list())), | |
8bdd5c12 | 1324 | #else |
67337c4a MD |
1325 | side_arg_dynamic_field("u16_le", side_arg_dynamic_u16_le(side_bswap_16(1), side_attr_list())), |
1326 | side_arg_dynamic_field("u32_le", side_arg_dynamic_u32_le(side_bswap_32(1), side_attr_list())), | |
1327 | side_arg_dynamic_field("u64_le", side_arg_dynamic_u64_le(side_bswap_64(1), side_attr_list())), | |
1328 | side_arg_dynamic_field("s16_le", side_arg_dynamic_s16_le(side_bswap_16(1), side_attr_list())), | |
1329 | side_arg_dynamic_field("s32_le", side_arg_dynamic_s32_le(side_bswap_32(1), side_attr_list())), | |
1330 | side_arg_dynamic_field("s64_le", side_arg_dynamic_s64_le(side_bswap_64(1), side_attr_list())), | |
1331 | side_arg_dynamic_field("u16_be", side_arg_dynamic_u16_be(1, side_attr_list())), | |
1332 | side_arg_dynamic_field("u32_be", side_arg_dynamic_u32_be(1, side_attr_list())), | |
1333 | side_arg_dynamic_field("u64_be", side_arg_dynamic_u64_be(1, side_attr_list())), | |
1334 | side_arg_dynamic_field("s16_be", side_arg_dynamic_s16_be(1, side_attr_list())), | |
1335 | side_arg_dynamic_field("s32_be", side_arg_dynamic_s32_be(1, side_attr_list())), | |
1336 | side_arg_dynamic_field("s64_be", side_arg_dynamic_s64_be(1, side_attr_list())), | |
8bdd5c12 MD |
1337 | #endif |
1338 | ), | |
67337c4a | 1339 | side_attr_list() |
8bdd5c12 MD |
1340 | ); |
1341 | } | |
1342 | ||
67337c4a MD |
1343 | side_static_event(my_provider_event_base, "myprovider", "myevent_base", SIDE_LOGLEVEL_DEBUG, |
1344 | side_field_list( | |
1345 | side_field_u8("u8base2", side_attr_list(side_attr("std.integer.base", side_attr_u8(2)))), | |
1346 | side_field_u8("u8base8", side_attr_list(side_attr("std.integer.base", side_attr_u8(8)))), | |
1347 | side_field_u8("u8base10", side_attr_list(side_attr("std.integer.base", side_attr_u8(10)))), | |
1348 | side_field_u8("u8base16", side_attr_list(side_attr("std.integer.base", side_attr_u8(16)))), | |
1349 | side_field_u16("u16base2", side_attr_list(side_attr("std.integer.base", side_attr_u8(2)))), | |
1350 | side_field_u16("u16base8", side_attr_list(side_attr("std.integer.base", side_attr_u8(8)))), | |
1351 | side_field_u16("u16base10", side_attr_list(side_attr("std.integer.base", side_attr_u8(10)))), | |
1352 | side_field_u16("u16base16", side_attr_list(side_attr("std.integer.base", side_attr_u8(16)))), | |
1353 | side_field_u32("u32base2", side_attr_list(side_attr("std.integer.base", side_attr_u8(2)))), | |
1354 | side_field_u32("u32base8", side_attr_list(side_attr("std.integer.base", side_attr_u8(8)))), | |
1355 | side_field_u32("u32base10", side_attr_list(side_attr("std.integer.base", side_attr_u8(10)))), | |
1356 | side_field_u32("u32base16", side_attr_list(side_attr("std.integer.base", side_attr_u8(16)))), | |
1357 | side_field_u64("u64base2", side_attr_list(side_attr("std.integer.base", side_attr_u8(2)))), | |
1358 | side_field_u64("u64base8", side_attr_list(side_attr("std.integer.base", side_attr_u8(8)))), | |
1359 | side_field_u64("u64base10", side_attr_list(side_attr("std.integer.base", side_attr_u8(10)))), | |
1360 | side_field_u64("u64base16", side_attr_list(side_attr("std.integer.base", side_attr_u8(16)))), | |
1361 | side_field_s8("s8base2", side_attr_list(side_attr("std.integer.base", side_attr_u8(2)))), | |
1362 | side_field_s8("s8base8", side_attr_list(side_attr("std.integer.base", side_attr_u8(8)))), | |
1363 | side_field_s8("s8base10", side_attr_list(side_attr("std.integer.base", side_attr_u8(10)))), | |
1364 | side_field_s8("s8base16", side_attr_list(side_attr("std.integer.base", side_attr_u8(16)))), | |
1365 | side_field_s16("s16base2", side_attr_list(side_attr("std.integer.base", side_attr_u8(2)))), | |
1366 | side_field_s16("s16base8", side_attr_list(side_attr("std.integer.base", side_attr_u8(8)))), | |
1367 | side_field_s16("s16base10", side_attr_list(side_attr("std.integer.base", side_attr_u8(10)))), | |
1368 | side_field_s16("s16base16", side_attr_list(side_attr("std.integer.base", side_attr_u8(16)))), | |
1369 | side_field_s32("s32base2", side_attr_list(side_attr("std.integer.base", side_attr_u8(2)))), | |
1370 | side_field_s32("s32base8", side_attr_list(side_attr("std.integer.base", side_attr_u8(8)))), | |
1371 | side_field_s32("s32base10", side_attr_list(side_attr("std.integer.base", side_attr_u8(10)))), | |
1372 | side_field_s32("s32base16", side_attr_list(side_attr("std.integer.base", side_attr_u8(16)))), | |
1373 | side_field_s64("s64base2", side_attr_list(side_attr("std.integer.base", side_attr_u8(2)))), | |
1374 | side_field_s64("s64base8", side_attr_list(side_attr("std.integer.base", side_attr_u8(8)))), | |
1375 | side_field_s64("s64base10", side_attr_list(side_attr("std.integer.base", side_attr_u8(10)))), | |
1376 | side_field_s64("s64base16", side_attr_list(side_attr("std.integer.base", side_attr_u8(16)))), | |
1d9c515c | 1377 | ), |
67337c4a | 1378 | side_attr_list() |
1d9c515c MD |
1379 | ); |
1380 | ||
1381 | static | |
1382 | void test_base(void) | |
1383 | { | |
67337c4a MD |
1384 | side_event(my_provider_event_base, |
1385 | side_arg_list( | |
1386 | side_arg_u8(55), | |
1387 | side_arg_u8(55), | |
1388 | side_arg_u8(55), | |
1389 | side_arg_u8(55), | |
1390 | side_arg_u16(55), | |
1391 | side_arg_u16(55), | |
1392 | side_arg_u16(55), | |
1393 | side_arg_u16(55), | |
1394 | side_arg_u32(55), | |
1395 | side_arg_u32(55), | |
1396 | side_arg_u32(55), | |
1397 | side_arg_u32(55), | |
1398 | side_arg_u64(55), | |
1399 | side_arg_u64(55), | |
1400 | side_arg_u64(55), | |
1401 | side_arg_u64(55), | |
1402 | side_arg_s8(-55), | |
1403 | side_arg_s8(-55), | |
1404 | side_arg_s8(-55), | |
1405 | side_arg_s8(-55), | |
1406 | side_arg_s16(-55), | |
1407 | side_arg_s16(-55), | |
1408 | side_arg_s16(-55), | |
1409 | side_arg_s16(-55), | |
1410 | side_arg_s32(-55), | |
1411 | side_arg_s32(-55), | |
1412 | side_arg_s32(-55), | |
1413 | side_arg_s32(-55), | |
1414 | side_arg_s64(-55), | |
1415 | side_arg_s64(-55), | |
1416 | side_arg_s64(-55), | |
1417 | side_arg_s64(-55), | |
1d9c515c MD |
1418 | ) |
1419 | ); | |
1420 | } | |
1421 | ||
7a1cb105 MD |
1422 | struct test { |
1423 | uint32_t a; | |
1424 | uint64_t b; | |
1425 | uint8_t c; | |
1426 | int32_t d; | |
1427 | uint16_t e; | |
bc0b21eb MD |
1428 | int8_t f; |
1429 | int16_t g; | |
1430 | int32_t h; | |
1431 | int64_t i; | |
1432 | int64_t j; | |
1433 | int64_t k; | |
c1723f3c | 1434 | uint64_t test; |
7a1cb105 MD |
1435 | }; |
1436 | ||
67337c4a MD |
1437 | static side_define_struct(mystructgatherdef, |
1438 | side_field_list( | |
1439 | side_field_gather_unsigned_integer("a", offsetof(struct test, a), | |
1440 | side_struct_field_sizeof(struct test, a), 0, 0, | |
1441 | SIDE_TYPE_GATHER_ACCESS_DIRECT, side_attr_list()), | |
1442 | side_field_gather_signed_integer("d", offsetof(struct test, d), | |
1443 | side_struct_field_sizeof(struct test, d), 0, 0, | |
1444 | SIDE_TYPE_GATHER_ACCESS_DIRECT, side_attr_list()), | |
1445 | side_field_gather_unsigned_integer("e", offsetof(struct test, e), | |
1446 | side_struct_field_sizeof(struct test, e), 8, 4, | |
1447 | SIDE_TYPE_GATHER_ACCESS_DIRECT, side_attr_list(side_attr("std.integer.base", side_attr_u8(16)))), | |
1448 | side_field_gather_signed_integer("f", offsetof(struct test, f), | |
1449 | side_struct_field_sizeof(struct test, f), 1, 4, | |
1450 | SIDE_TYPE_GATHER_ACCESS_DIRECT, side_attr_list(side_attr("std.integer.base", side_attr_u8(10)))), | |
1451 | side_field_gather_signed_integer("g", offsetof(struct test, g), | |
1452 | side_struct_field_sizeof(struct test, g), 11, 4, | |
1453 | SIDE_TYPE_GATHER_ACCESS_DIRECT, side_attr_list(side_attr("std.integer.base", side_attr_u8(10)))), | |
1454 | side_field_gather_signed_integer("h", offsetof(struct test, h), | |
1455 | side_struct_field_sizeof(struct test, h), 1, 31, | |
1456 | SIDE_TYPE_GATHER_ACCESS_DIRECT, side_attr_list(side_attr("std.integer.base", side_attr_u8(10)))), | |
1457 | side_field_gather_signed_integer("i", offsetof(struct test, i), | |
1458 | side_struct_field_sizeof(struct test, i), 33, 20, | |
1459 | SIDE_TYPE_GATHER_ACCESS_DIRECT, side_attr_list(side_attr("std.integer.base", side_attr_u8(10)))), | |
1460 | side_field_gather_signed_integer("j", offsetof(struct test, j), | |
1461 | side_struct_field_sizeof(struct test, j), 63, 1, | |
1462 | SIDE_TYPE_GATHER_ACCESS_DIRECT, side_attr_list(side_attr("std.integer.base", side_attr_u8(10)))), | |
1463 | side_field_gather_signed_integer("k", offsetof(struct test, k), | |
1464 | side_struct_field_sizeof(struct test, k), 1, 63, | |
1465 | SIDE_TYPE_GATHER_ACCESS_DIRECT, side_attr_list(side_attr("std.integer.base", side_attr_u8(10)))), | |
1466 | side_field_gather_unsigned_integer_le("test", offsetof(struct test, test), | |
1467 | side_struct_field_sizeof(struct test, test), 0, 64, | |
1468 | SIDE_TYPE_GATHER_ACCESS_DIRECT, side_attr_list(side_attr("std.integer.base", side_attr_u8(16)))), | |
1469 | side_field_gather_unsigned_integer_le("test_le", offsetof(struct test, test), | |
1470 | side_struct_field_sizeof(struct test, test), 0, 64, | |
1471 | SIDE_TYPE_GATHER_ACCESS_DIRECT, side_attr_list(side_attr("std.integer.base", side_attr_u8(16)))), | |
1472 | side_field_gather_unsigned_integer_be("test_be", offsetof(struct test, test), | |
1473 | side_struct_field_sizeof(struct test, test), 0, 64, | |
1474 | SIDE_TYPE_GATHER_ACCESS_DIRECT, side_attr_list(side_attr("std.integer.base", side_attr_u8(16)))), | |
7a1cb105 | 1475 | ), |
67337c4a | 1476 | side_attr_list() |
7a1cb105 MD |
1477 | ); |
1478 | ||
67337c4a MD |
1479 | side_static_event(my_provider_event_structgather, "myprovider", "myeventstructgather", SIDE_LOGLEVEL_DEBUG, |
1480 | side_field_list( | |
1481 | side_field_gather_struct("structgather", &mystructgatherdef, 0, sizeof(struct test), | |
1482 | SIDE_TYPE_GATHER_ACCESS_DIRECT), | |
1483 | side_field_gather_signed_integer("intgather", 0, sizeof(int32_t), 0, 0, SIDE_TYPE_GATHER_ACCESS_DIRECT, | |
1484 | side_attr_list(side_attr("std.integer.base", side_attr_u8(10)))), | |
13d97eca | 1485 | #if __HAVE_FLOAT32 |
67337c4a | 1486 | side_field_gather_float("f32", 0, sizeof(_Float32), SIDE_TYPE_GATHER_ACCESS_DIRECT, side_attr_list()), |
13d97eca | 1487 | #endif |
7a1cb105 | 1488 | ), |
67337c4a | 1489 | side_attr_list() |
7a1cb105 MD |
1490 | ); |
1491 | ||
1492 | static | |
d41cb7ee | 1493 | void test_struct_gather(void) |
7a1cb105 | 1494 | { |
67337c4a | 1495 | side_event_cond(my_provider_event_structgather) { |
7a1cb105 MD |
1496 | struct test mystruct = { |
1497 | .a = 55, | |
1498 | .b = 123, | |
1499 | .c = 2, | |
1500 | .d = -55, | |
1501 | .e = 0xABCD, | |
bc0b21eb MD |
1502 | .f = -1, |
1503 | .g = -1, | |
1504 | .h = -1, | |
1505 | .i = -1, | |
1506 | .j = -1, | |
1507 | .k = -1, | |
c1723f3c | 1508 | .test = 0xFF, |
7a1cb105 | 1509 | }; |
33956c71 | 1510 | int32_t val = -66; |
13d97eca MD |
1511 | #if __HAVE_FLOAT32 |
1512 | _Float32 f32 = 1.1; | |
1513 | #endif | |
67337c4a MD |
1514 | side_event_call(my_provider_event_structgather, |
1515 | side_arg_list( | |
1516 | side_arg_gather_struct(&mystruct), | |
1517 | side_arg_gather_integer(&val), | |
13d97eca | 1518 | #if __HAVE_FLOAT32 |
67337c4a | 1519 | side_arg_gather_float(&f32), |
13d97eca | 1520 | #endif |
33956c71 MD |
1521 | ) |
1522 | ); | |
7a1cb105 MD |
1523 | } |
1524 | } | |
1525 | ||
7394a8b8 MD |
1526 | struct testnest2 { |
1527 | uint8_t c; | |
1528 | }; | |
1529 | ||
1530 | struct testnest1 { | |
1531 | uint64_t b; | |
1532 | struct testnest2 *nest; | |
1533 | }; | |
1534 | ||
1535 | struct testnest0 { | |
1536 | uint32_t a; | |
1537 | struct testnest1 *nest; | |
1538 | }; | |
1539 | ||
67337c4a MD |
1540 | static side_define_struct(mystructgathernest2, |
1541 | side_field_list( | |
1542 | side_field_gather_unsigned_integer("c", offsetof(struct testnest2, c), | |
1543 | side_struct_field_sizeof(struct testnest2, c), 0, 0, | |
1544 | SIDE_TYPE_GATHER_ACCESS_DIRECT, side_attr_list()), | |
7394a8b8 | 1545 | ), |
67337c4a | 1546 | side_attr_list() |
7394a8b8 MD |
1547 | ); |
1548 | ||
67337c4a MD |
1549 | static side_define_struct(mystructgathernest1, |
1550 | side_field_list( | |
1551 | side_field_gather_unsigned_integer("b", offsetof(struct testnest1, b), | |
1552 | side_struct_field_sizeof(struct testnest1, b), 0, 0, | |
1553 | SIDE_TYPE_GATHER_ACCESS_DIRECT, side_attr_list()), | |
1554 | side_field_gather_struct("nest2", &mystructgathernest2, | |
dd7947bf | 1555 | offsetof(struct testnest1, nest), sizeof(struct testnest2), |
67337c4a | 1556 | SIDE_TYPE_GATHER_ACCESS_POINTER), |
7394a8b8 | 1557 | ), |
67337c4a | 1558 | side_attr_list() |
7394a8b8 MD |
1559 | ); |
1560 | ||
67337c4a MD |
1561 | static side_define_struct(mystructgathernest0, |
1562 | side_field_list( | |
1563 | side_field_gather_unsigned_integer("a", offsetof(struct testnest0, a), | |
1564 | side_struct_field_sizeof(struct testnest0, a), 0, 0, | |
1565 | SIDE_TYPE_GATHER_ACCESS_DIRECT, side_attr_list()), | |
1566 | side_field_gather_struct("nest1", &mystructgathernest1, | |
dd7947bf | 1567 | offsetof(struct testnest0, nest), sizeof(struct testnest1), |
67337c4a | 1568 | SIDE_TYPE_GATHER_ACCESS_POINTER), |
7394a8b8 | 1569 | ), |
67337c4a | 1570 | side_attr_list() |
7394a8b8 MD |
1571 | ); |
1572 | ||
67337c4a MD |
1573 | side_static_event(my_provider_event_structgather_nest, |
1574 | "myprovider", "myeventstructgathernest", SIDE_LOGLEVEL_DEBUG, | |
1575 | side_field_list( | |
1576 | side_field_gather_struct("nest0", &mystructgathernest0, 0, | |
1577 | sizeof(struct testnest0), SIDE_TYPE_GATHER_ACCESS_DIRECT), | |
7394a8b8 | 1578 | ), |
67337c4a | 1579 | side_attr_list() |
7394a8b8 MD |
1580 | ); |
1581 | ||
1582 | static | |
d41cb7ee | 1583 | void test_struct_gather_nest_ptr(void) |
7394a8b8 | 1584 | { |
67337c4a | 1585 | side_event_cond(my_provider_event_structgather_nest) { |
7394a8b8 MD |
1586 | struct testnest2 mystruct2 = { |
1587 | .c = 77, | |
1588 | }; | |
1589 | struct testnest1 mystruct1 = { | |
1590 | .b = 66, | |
1591 | .nest = &mystruct2, | |
1592 | }; | |
1593 | struct testnest0 mystruct = { | |
1594 | .a = 55, | |
1595 | .nest = &mystruct1, | |
1596 | }; | |
67337c4a MD |
1597 | side_event_call(my_provider_event_structgather_nest, |
1598 | side_arg_list( | |
1599 | side_arg_gather_struct(&mystruct), | |
7394a8b8 MD |
1600 | ) |
1601 | ); | |
1602 | } | |
1603 | } | |
1604 | ||
905f68e3 MD |
1605 | struct testfloat { |
1606 | #if __HAVE_FLOAT16 | |
1607 | _Float16 f16; | |
1608 | #endif | |
1609 | #if __HAVE_FLOAT32 | |
1610 | _Float32 f32; | |
1611 | #endif | |
1612 | #if __HAVE_FLOAT64 | |
1613 | _Float64 f64; | |
1614 | #endif | |
1615 | #if __HAVE_FLOAT128 | |
1616 | _Float128 f128; | |
1617 | #endif | |
1618 | }; | |
1619 | ||
67337c4a MD |
1620 | static side_define_struct(mystructgatherfloat, |
1621 | side_field_list( | |
905f68e3 | 1622 | #if __HAVE_FLOAT16 |
67337c4a MD |
1623 | side_field_gather_float("f16", offsetof(struct testfloat, f16), side_struct_field_sizeof(struct testfloat, f16), |
1624 | SIDE_TYPE_GATHER_ACCESS_DIRECT, | |
1625 | side_attr_list()), | |
905f68e3 MD |
1626 | #endif |
1627 | #if __HAVE_FLOAT32 | |
67337c4a MD |
1628 | side_field_gather_float("f32", offsetof(struct testfloat, f32), side_struct_field_sizeof(struct testfloat, f32), |
1629 | SIDE_TYPE_GATHER_ACCESS_DIRECT, | |
1630 | side_attr_list()), | |
905f68e3 MD |
1631 | #endif |
1632 | #if __HAVE_FLOAT64 | |
67337c4a MD |
1633 | side_field_gather_float("f64", offsetof(struct testfloat, f64), side_struct_field_sizeof(struct testfloat, f64), |
1634 | SIDE_TYPE_GATHER_ACCESS_DIRECT, | |
1635 | side_attr_list()), | |
905f68e3 MD |
1636 | #endif |
1637 | #if __HAVE_FLOAT128 | |
67337c4a MD |
1638 | side_field_gather_float("f128", offsetof(struct testfloat, f128), side_struct_field_sizeof(struct testfloat, f128), |
1639 | SIDE_TYPE_GATHER_ACCESS_DIRECT, | |
1640 | side_attr_list()), | |
905f68e3 MD |
1641 | #endif |
1642 | ), | |
67337c4a | 1643 | side_attr_list() |
905f68e3 MD |
1644 | ); |
1645 | ||
67337c4a MD |
1646 | side_static_event(my_provider_event_structgatherfloat, |
1647 | "myprovider", "myeventstructgatherfloat", SIDE_LOGLEVEL_DEBUG, | |
1648 | side_field_list( | |
1649 | side_field_gather_struct("structgatherfloat", &mystructgatherfloat, 0, | |
1650 | sizeof(struct testfloat), SIDE_TYPE_GATHER_ACCESS_DIRECT), | |
905f68e3 | 1651 | ), |
67337c4a | 1652 | side_attr_list() |
905f68e3 MD |
1653 | ); |
1654 | ||
1655 | static | |
d41cb7ee | 1656 | void test_struct_gather_float(void) |
905f68e3 | 1657 | { |
67337c4a | 1658 | side_event_cond(my_provider_event_structgatherfloat) { |
905f68e3 MD |
1659 | struct testfloat mystruct = { |
1660 | #if __HAVE_FLOAT16 | |
1661 | .f16 = 1.1, | |
1662 | #endif | |
1663 | #if __HAVE_FLOAT32 | |
1664 | .f32 = 2.2, | |
1665 | #endif | |
1666 | #if __HAVE_FLOAT64 | |
1667 | .f64 = 3.3, | |
1668 | #endif | |
1669 | #if __HAVE_FLOAT128 | |
1670 | .f128 = 4.4, | |
1671 | #endif | |
1672 | }; | |
67337c4a MD |
1673 | side_event_call(my_provider_event_structgatherfloat, |
1674 | side_arg_list( | |
1675 | side_arg_gather_struct(&mystruct), | |
905f68e3 MD |
1676 | ) |
1677 | ); | |
1678 | } | |
1679 | } | |
1680 | ||
d41cb7ee | 1681 | uint32_t mygatherarray[] = { 1, 2, 3, 4, 5 }; |
d9359cfa | 1682 | |
d41cb7ee | 1683 | uint16_t mygatherarray2[] = { 6, 7, 8, 9 }; |
d9359cfa MD |
1684 | |
1685 | struct testarray { | |
1686 | int a; | |
1687 | uint32_t *ptr; | |
1688 | }; | |
1689 | ||
67337c4a MD |
1690 | static side_define_struct(mystructgatherarray, |
1691 | side_field_list( | |
1692 | side_field_gather_array("array", | |
1693 | side_elem(side_type_gather_unsigned_integer(0, sizeof(uint32_t), 0, 0, SIDE_TYPE_GATHER_ACCESS_DIRECT, side_attr_list())), | |
1694 | SIDE_ARRAY_SIZE(mygatherarray), | |
d9359cfa | 1695 | offsetof(struct testarray, ptr), |
67337c4a MD |
1696 | SIDE_TYPE_GATHER_ACCESS_POINTER, |
1697 | side_attr_list()), | |
d9359cfa | 1698 | ), |
67337c4a | 1699 | side_attr_list() |
d9359cfa MD |
1700 | ); |
1701 | ||
67337c4a MD |
1702 | side_static_event(my_provider_event_structgatherarray, |
1703 | "myprovider", "myeventstructgatherarray", SIDE_LOGLEVEL_DEBUG, | |
1704 | side_field_list( | |
1705 | side_field_gather_struct("structgatherarray", &mystructgatherarray, 0, | |
1706 | sizeof(struct testarray), SIDE_TYPE_GATHER_ACCESS_DIRECT), | |
1707 | side_field_gather_array("array2", | |
1708 | side_elem(side_type_gather_unsigned_integer(0, sizeof(uint16_t), 0, 0, SIDE_TYPE_GATHER_ACCESS_DIRECT, side_attr_list())), | |
1709 | SIDE_ARRAY_SIZE(mygatherarray2), 0, | |
1710 | SIDE_TYPE_GATHER_ACCESS_DIRECT, | |
1711 | side_attr_list() | |
d9359cfa MD |
1712 | ), |
1713 | ), | |
67337c4a | 1714 | side_attr_list() |
d9359cfa MD |
1715 | ); |
1716 | ||
1717 | static | |
d41cb7ee | 1718 | void test_array_gather(void) |
d9359cfa | 1719 | { |
67337c4a | 1720 | side_event_cond(my_provider_event_structgatherarray) { |
d9359cfa MD |
1721 | struct testarray mystruct = { |
1722 | .a = 55, | |
d41cb7ee | 1723 | .ptr = mygatherarray, |
d9359cfa | 1724 | }; |
67337c4a MD |
1725 | side_event_call(my_provider_event_structgatherarray, |
1726 | side_arg_list( | |
1727 | side_arg_gather_struct(&mystruct), | |
1728 | side_arg_gather_array(&mygatherarray2), | |
d9359cfa MD |
1729 | ) |
1730 | ); | |
1731 | } | |
1732 | } | |
1733 | ||
dd7947bf | 1734 | #define TESTSGNESTARRAY_LEN 4 |
d41cb7ee | 1735 | struct testgatherstructnest1 { |
dd7947bf MD |
1736 | int b; |
1737 | int c[TESTSGNESTARRAY_LEN]; | |
1738 | }; | |
1739 | ||
d41cb7ee MD |
1740 | struct testgatherstructnest0 { |
1741 | struct testgatherstructnest1 nest; | |
1742 | struct testgatherstructnest1 nestarray[2]; | |
dd7947bf MD |
1743 | int a; |
1744 | }; | |
1745 | ||
67337c4a MD |
1746 | static side_define_struct(mystructgatherstructnest1, |
1747 | side_field_list( | |
1748 | side_field_gather_signed_integer("b", offsetof(struct testgatherstructnest1, b), | |
1749 | side_struct_field_sizeof(struct testgatherstructnest1, b), 0, 0, | |
1750 | SIDE_TYPE_GATHER_ACCESS_DIRECT, side_attr_list()), | |
1751 | side_field_gather_array("c", | |
1752 | side_elem( | |
1753 | side_type_gather_signed_integer(0, sizeof(uint32_t), 0, 0, | |
1754 | SIDE_TYPE_GATHER_ACCESS_DIRECT, side_attr_list()), | |
dd7947bf MD |
1755 | ), |
1756 | TESTSGNESTARRAY_LEN, | |
d41cb7ee | 1757 | offsetof(struct testgatherstructnest1, c), |
67337c4a MD |
1758 | SIDE_TYPE_GATHER_ACCESS_DIRECT, |
1759 | side_attr_list()), | |
dd7947bf | 1760 | ), |
67337c4a | 1761 | side_attr_list() |
dd7947bf MD |
1762 | ); |
1763 | ||
67337c4a MD |
1764 | static side_define_struct(mystructgatherstructnest0, |
1765 | side_field_list( | |
1766 | side_field_gather_signed_integer("a", offsetof(struct testgatherstructnest0, a), | |
1767 | side_struct_field_sizeof(struct testgatherstructnest0, a), 0, 0, | |
1768 | SIDE_TYPE_GATHER_ACCESS_DIRECT, side_attr_list()), | |
1769 | side_field_gather_struct("structnest0", &mystructgatherstructnest1, | |
d41cb7ee MD |
1770 | offsetof(struct testgatherstructnest0, nest), |
1771 | sizeof(struct testgatherstructnest1), | |
67337c4a MD |
1772 | SIDE_TYPE_GATHER_ACCESS_DIRECT), |
1773 | side_field_gather_array("nestarray", | |
1774 | side_elem( | |
1775 | side_type_gather_struct(&mystructgatherstructnest1, | |
dd7947bf | 1776 | 0, |
d41cb7ee | 1777 | sizeof(struct testgatherstructnest1), |
67337c4a | 1778 | SIDE_TYPE_GATHER_ACCESS_DIRECT), |
dd7947bf MD |
1779 | ), |
1780 | 2, | |
d41cb7ee | 1781 | offsetof(struct testgatherstructnest0, nestarray), |
67337c4a MD |
1782 | SIDE_TYPE_GATHER_ACCESS_DIRECT, |
1783 | side_attr_list()), | |
dd7947bf | 1784 | ), |
67337c4a | 1785 | side_attr_list() |
dd7947bf MD |
1786 | ); |
1787 | ||
67337c4a MD |
1788 | side_static_event(my_provider_event_gatherstructnest, |
1789 | "myprovider", "myeventgatherstructnest", SIDE_LOGLEVEL_DEBUG, | |
1790 | side_field_list( | |
1791 | side_field_gather_struct("structgather", &mystructgatherstructnest0, 0, | |
1792 | sizeof(struct testgatherstructnest0), SIDE_TYPE_GATHER_ACCESS_DIRECT), | |
dd7947bf | 1793 | ), |
67337c4a | 1794 | side_attr_list() |
dd7947bf MD |
1795 | ); |
1796 | ||
1797 | static | |
d41cb7ee | 1798 | void test_gather_structnest(void) |
dd7947bf | 1799 | { |
67337c4a | 1800 | side_event_cond(my_provider_event_gatherstructnest) { |
d41cb7ee | 1801 | struct testgatherstructnest0 mystruct = { |
dd7947bf MD |
1802 | .nest = { |
1803 | .b = 66, | |
1804 | .c = { 0, 1, 2, 3 }, | |
1805 | }, | |
1806 | .nestarray = { | |
1807 | [0] = { | |
1808 | .b = 77, | |
1809 | .c = { 11, 12, 13, 14 }, | |
1810 | }, | |
1811 | [1] = { | |
1812 | .b = 88, | |
1813 | .c = { 15, 16, 17, 18 }, | |
1814 | }, | |
1815 | }, | |
1816 | .a = 55, | |
1817 | }; | |
67337c4a MD |
1818 | side_event_call(my_provider_event_gatherstructnest, |
1819 | side_arg_list( | |
1820 | side_arg_gather_struct(&mystruct), | |
dd7947bf MD |
1821 | ) |
1822 | ); | |
1823 | } | |
1824 | } | |
1825 | ||
d41cb7ee | 1826 | uint32_t gathervla[] = { 1, 2, 3, 4 }; |
80429681 | 1827 | uint32_t gathervla2[] = { 5, 6, 7, 8, 9 }; |
65b8734a | 1828 | |
d41cb7ee | 1829 | struct testgathervla { |
65b8734a MD |
1830 | int a; |
1831 | uint16_t len; | |
1832 | uint32_t *p; | |
1833 | }; | |
1834 | ||
67337c4a MD |
1835 | static side_define_struct(mystructgathervla, |
1836 | side_field_list( | |
1837 | side_field_gather_signed_integer("a", offsetof(struct testgathervla, a), | |
1838 | side_struct_field_sizeof(struct testgathervla, a), 0, 0, | |
1839 | SIDE_TYPE_GATHER_ACCESS_DIRECT, side_attr_list() | |
65b8734a | 1840 | ), |
67337c4a MD |
1841 | side_field_gather_vla("nestvla", |
1842 | side_elem(side_type_gather_unsigned_integer(0, sizeof(uint32_t), 0, 0, SIDE_TYPE_GATHER_ACCESS_DIRECT, side_attr_list())), | |
d41cb7ee | 1843 | offsetof(struct testgathervla, p), |
67337c4a MD |
1844 | SIDE_TYPE_GATHER_ACCESS_POINTER, |
1845 | side_length(side_type_gather_unsigned_integer(offsetof(struct testgathervla, len), | |
1846 | sizeof(uint16_t), 0, 0, SIDE_TYPE_GATHER_ACCESS_DIRECT, side_attr_list())), | |
1847 | side_attr_list() | |
65b8734a MD |
1848 | ), |
1849 | ), | |
67337c4a | 1850 | side_attr_list() |
65b8734a MD |
1851 | ); |
1852 | ||
67337c4a MD |
1853 | side_static_event(my_provider_event_gathervla, |
1854 | "myprovider", "myeventgathervla", SIDE_LOGLEVEL_DEBUG, | |
1855 | side_field_list( | |
1856 | side_field_gather_struct("structgathervla", &mystructgathervla, 0, | |
1857 | sizeof(struct testgathervla), SIDE_TYPE_GATHER_ACCESS_DIRECT), | |
1858 | side_field_gather_vla("vla", | |
1859 | side_elem(side_type_gather_unsigned_integer(0, sizeof(uint32_t), 0, 0, SIDE_TYPE_GATHER_ACCESS_DIRECT, side_attr_list())), | |
1860 | 0, SIDE_TYPE_GATHER_ACCESS_DIRECT, | |
1861 | side_length(side_type_gather_unsigned_integer(0, sizeof(uint16_t), 0, 0, SIDE_TYPE_GATHER_ACCESS_DIRECT, side_attr_list())), | |
1862 | side_attr_list() | |
80429681 | 1863 | ), |
65b8734a | 1864 | ), |
67337c4a | 1865 | side_attr_list() |
65b8734a MD |
1866 | ); |
1867 | ||
1868 | static | |
d41cb7ee | 1869 | void test_gather_vla(void) |
65b8734a | 1870 | { |
67337c4a | 1871 | side_event_cond(my_provider_event_gathervla) { |
d41cb7ee | 1872 | struct testgathervla mystruct = { |
65b8734a | 1873 | .a = 55, |
67337c4a | 1874 | .len = SIDE_ARRAY_SIZE(gathervla), |
d41cb7ee | 1875 | .p = gathervla, |
65b8734a | 1876 | }; |
80429681 | 1877 | uint16_t vla2_len = 5; |
67337c4a MD |
1878 | side_event_call(my_provider_event_gathervla, |
1879 | side_arg_list( | |
1880 | side_arg_gather_struct(&mystruct), | |
1881 | side_arg_gather_vla(gathervla2, &vla2_len), | |
65b8734a MD |
1882 | ) |
1883 | ); | |
1884 | } | |
1885 | } | |
1886 | ||
d41cb7ee | 1887 | struct testgathervlaflex { |
65b8734a MD |
1888 | uint8_t len; |
1889 | uint32_t otherfield; | |
1890 | uint64_t array[]; | |
1891 | }; | |
1892 | ||
67337c4a MD |
1893 | static side_define_struct(mystructgathervlaflex, |
1894 | side_field_list( | |
1895 | side_field_gather_vla("vlaflex", | |
1896 | side_elem(side_type_gather_unsigned_integer(0, sizeof(uint64_t), 0, 0, SIDE_TYPE_GATHER_ACCESS_DIRECT, side_attr_list())), | |
d41cb7ee | 1897 | offsetof(struct testgathervlaflex, array), |
67337c4a MD |
1898 | SIDE_TYPE_GATHER_ACCESS_DIRECT, |
1899 | side_length(side_type_gather_unsigned_integer(offsetof(struct testgathervlaflex, len), | |
1900 | side_struct_field_sizeof(struct testgathervlaflex, len), 0, 0, SIDE_TYPE_GATHER_ACCESS_DIRECT, side_attr_list())), | |
1901 | side_attr_list() | |
65b8734a MD |
1902 | ), |
1903 | ), | |
67337c4a | 1904 | side_attr_list() |
65b8734a MD |
1905 | ); |
1906 | ||
67337c4a MD |
1907 | side_static_event(my_provider_event_gathervlaflex, |
1908 | "myprovider", "myeventgathervlaflex", SIDE_LOGLEVEL_DEBUG, | |
1909 | side_field_list( | |
1910 | side_field_gather_struct("structgathervlaflex", &mystructgathervlaflex, 0, | |
1911 | sizeof(struct testgathervlaflex), SIDE_TYPE_GATHER_ACCESS_DIRECT), | |
65b8734a | 1912 | ), |
67337c4a | 1913 | side_attr_list() |
65b8734a MD |
1914 | ); |
1915 | ||
1916 | #define VLAFLEXLEN 6 | |
1917 | static | |
d41cb7ee | 1918 | void test_gather_vla_flex(void) |
65b8734a | 1919 | { |
67337c4a | 1920 | side_event_cond(my_provider_event_gathervlaflex) { |
358281a1 | 1921 | struct testgathervlaflex *mystruct = |
150b5c1d | 1922 | (struct testgathervlaflex *) malloc(sizeof(*mystruct) + VLAFLEXLEN * sizeof(uint64_t)); |
65b8734a MD |
1923 | |
1924 | mystruct->len = VLAFLEXLEN; | |
1925 | mystruct->otherfield = 0; | |
1926 | mystruct->array[0] = 1; | |
1927 | mystruct->array[1] = 2; | |
1928 | mystruct->array[2] = 3; | |
1929 | mystruct->array[3] = 4; | |
1930 | mystruct->array[4] = 5; | |
1931 | mystruct->array[5] = 6; | |
67337c4a MD |
1932 | side_event_call(my_provider_event_gathervlaflex, |
1933 | side_arg_list( | |
1934 | side_arg_gather_struct(mystruct), | |
65b8734a MD |
1935 | ) |
1936 | ); | |
1937 | free(mystruct); | |
1938 | } | |
1939 | } | |
1940 | ||
67337c4a MD |
1941 | side_static_event(my_provider_event_gatherbyte, |
1942 | "myprovider", "myeventgatherbyte", SIDE_LOGLEVEL_DEBUG, | |
1943 | side_field_list( | |
1944 | side_field_gather_byte("byte", 0, SIDE_TYPE_GATHER_ACCESS_DIRECT, side_attr_list()), | |
1945 | side_field_gather_array("array", | |
1946 | side_elem(side_type_gather_byte(0, SIDE_TYPE_GATHER_ACCESS_DIRECT, side_attr_list())), | |
1947 | 3, 0, SIDE_TYPE_GATHER_ACCESS_DIRECT, side_attr_list() | |
d69918cc MD |
1948 | ), |
1949 | ), | |
67337c4a | 1950 | side_attr_list() |
d69918cc MD |
1951 | ); |
1952 | ||
1953 | static | |
1954 | void test_gather_byte(void) | |
1955 | { | |
67337c4a | 1956 | side_event_cond(my_provider_event_gatherbyte) { |
d69918cc MD |
1957 | uint8_t v = 0x44; |
1958 | uint8_t array[3] = { 0x1, 0x2, 0x3 }; | |
1959 | ||
67337c4a MD |
1960 | side_event_call(my_provider_event_gatherbyte, |
1961 | side_arg_list( | |
1962 | side_arg_gather_byte(&v), | |
1963 | side_arg_gather_array(array), | |
d69918cc MD |
1964 | ) |
1965 | ); | |
1966 | } | |
1967 | } | |
1968 | ||
8ad2f385 MD |
1969 | #define ARRAYBOOLLEN 4 |
1970 | static bool arraybool[ARRAYBOOLLEN] = { false, true, false, true }; | |
1971 | ||
67337c4a MD |
1972 | side_static_event(my_provider_event_gatherbool, |
1973 | "myprovider", "myeventgatherbool", SIDE_LOGLEVEL_DEBUG, | |
1974 | side_field_list( | |
1975 | side_field_gather_bool("v1_true", 0, sizeof(bool), 0, 0, | |
1976 | SIDE_TYPE_GATHER_ACCESS_DIRECT, side_attr_list()), | |
1977 | side_field_gather_bool("v2_false", 0, sizeof(bool), 0, 0, | |
1978 | SIDE_TYPE_GATHER_ACCESS_DIRECT, side_attr_list()), | |
1979 | side_field_gather_bool("v3_true", 0, sizeof(uint16_t), 1, 1, | |
1980 | SIDE_TYPE_GATHER_ACCESS_DIRECT, side_attr_list()), | |
1981 | side_field_gather_bool("v4_false", 0, sizeof(uint16_t), 1, 1, | |
1982 | SIDE_TYPE_GATHER_ACCESS_DIRECT, side_attr_list()), | |
1983 | side_field_gather_array("arraybool", | |
1984 | side_elem(side_type_gather_bool(0, sizeof(bool), 0, 0, | |
1985 | SIDE_TYPE_GATHER_ACCESS_DIRECT, side_attr_list())), | |
1986 | ARRAYBOOLLEN, 0, SIDE_TYPE_GATHER_ACCESS_DIRECT, side_attr_list() | |
8ad2f385 MD |
1987 | ), |
1988 | ), | |
67337c4a | 1989 | side_attr_list() |
8ad2f385 MD |
1990 | ); |
1991 | ||
1992 | static | |
1993 | void test_gather_bool(void) | |
1994 | { | |
67337c4a | 1995 | side_event_cond(my_provider_event_structgatherarray) { |
8ad2f385 MD |
1996 | bool v1 = true; |
1997 | bool v2 = false; | |
1998 | uint16_t v3 = 1U << 1; | |
1999 | uint16_t v4 = 1U << 2; | |
2000 | ||
67337c4a MD |
2001 | side_event_call(my_provider_event_gatherbool, |
2002 | side_arg_list( | |
2003 | side_arg_gather_bool(&v1), | |
2004 | side_arg_gather_bool(&v2), | |
2005 | side_arg_gather_bool(&v3), | |
2006 | side_arg_gather_bool(&v4), | |
2007 | side_arg_gather_array(arraybool), | |
8ad2f385 MD |
2008 | ) |
2009 | ); | |
2010 | } | |
2011 | } | |
2012 | ||
67337c4a MD |
2013 | side_static_event(my_provider_event_gatherpointer, |
2014 | "myprovider", "myeventgatherpointer", SIDE_LOGLEVEL_DEBUG, | |
2015 | side_field_list( | |
2016 | side_field_gather_pointer("ptr", 0, SIDE_TYPE_GATHER_ACCESS_DIRECT, side_attr_list()), | |
2017 | side_field_gather_array("array", | |
2018 | side_elem(side_type_gather_pointer(0, SIDE_TYPE_GATHER_ACCESS_DIRECT, side_attr_list())), | |
2019 | 3, 0, SIDE_TYPE_GATHER_ACCESS_DIRECT, side_attr_list() | |
4e1b0e0e MD |
2020 | ), |
2021 | ), | |
67337c4a | 2022 | side_attr_list() |
4e1b0e0e MD |
2023 | ); |
2024 | ||
2025 | static | |
2026 | void test_gather_pointer(void) | |
2027 | { | |
67337c4a | 2028 | side_event_cond(my_provider_event_structgatherarray) { |
4e1b0e0e MD |
2029 | void *v = (void *)0x44; |
2030 | void *array[3] = { (void *)0x1, (void *)0x2, (void *)0x3 }; | |
2031 | ||
67337c4a MD |
2032 | side_event_call(my_provider_event_gatherpointer, |
2033 | side_arg_list( | |
2034 | side_arg_gather_pointer(&v), | |
2035 | side_arg_gather_array(array), | |
4e1b0e0e MD |
2036 | ) |
2037 | ); | |
2038 | } | |
2039 | } | |
0519cb86 | 2040 | |
67337c4a MD |
2041 | static side_define_enum(myenumgather, |
2042 | side_enum_mapping_list( | |
2043 | side_enum_mapping_range("one-ten", 1, 10), | |
2044 | side_enum_mapping_range("100-200", 100, 200), | |
2045 | side_enum_mapping_value("200", 200), | |
2046 | side_enum_mapping_value("300", 300), | |
0519cb86 | 2047 | ), |
67337c4a | 2048 | side_attr_list() |
0519cb86 MD |
2049 | ); |
2050 | ||
67337c4a MD |
2051 | side_static_event(my_provider_event_enum_gather, "myprovider", "myeventenumgather", SIDE_LOGLEVEL_DEBUG, |
2052 | side_field_list( | |
2053 | side_field_gather_enum("5", &myenumgather, | |
2054 | side_elem( | |
2055 | side_type_gather_unsigned_integer(0, sizeof(uint32_t), 0, 0, | |
2056 | SIDE_TYPE_GATHER_ACCESS_DIRECT, side_attr_list()) | |
0519cb86 MD |
2057 | ) |
2058 | ), | |
67337c4a MD |
2059 | side_field_gather_enum("400", &myenumgather, |
2060 | side_elem( | |
2061 | side_type_gather_unsigned_integer(0, sizeof(uint64_t), 0, 0, | |
2062 | SIDE_TYPE_GATHER_ACCESS_DIRECT, side_attr_list()) | |
0519cb86 MD |
2063 | ) |
2064 | ), | |
67337c4a MD |
2065 | side_field_gather_enum("200", &myenumgather, |
2066 | side_elem( | |
2067 | side_type_gather_unsigned_integer(0, sizeof(uint8_t), 0, 0, | |
2068 | SIDE_TYPE_GATHER_ACCESS_DIRECT, side_attr_list()) | |
0519cb86 MD |
2069 | ) |
2070 | ), | |
67337c4a MD |
2071 | side_field_gather_enum("-100", &myenumgather, |
2072 | side_elem( | |
2073 | side_type_gather_signed_integer(0, sizeof(int8_t), 0, 0, | |
2074 | SIDE_TYPE_GATHER_ACCESS_DIRECT, side_attr_list()) | |
0519cb86 MD |
2075 | ) |
2076 | ), | |
67337c4a MD |
2077 | side_field_gather_enum("6_be", &myenumgather, |
2078 | side_elem( | |
2079 | side_type_gather_unsigned_integer_be(0, sizeof(uint32_t), 0, 0, | |
2080 | SIDE_TYPE_GATHER_ACCESS_DIRECT, side_attr_list()) | |
0519cb86 MD |
2081 | ) |
2082 | ), | |
67337c4a MD |
2083 | side_field_gather_enum("6_le", &myenumgather, |
2084 | side_elem( | |
2085 | side_type_gather_unsigned_integer_le(0, sizeof(uint32_t), 0, 0, | |
2086 | SIDE_TYPE_GATHER_ACCESS_DIRECT, side_attr_list()) | |
0519cb86 MD |
2087 | ) |
2088 | ), | |
2089 | ), | |
67337c4a | 2090 | side_attr_list() |
0519cb86 MD |
2091 | ); |
2092 | ||
2093 | static | |
2094 | void test_gather_enum(void) | |
2095 | { | |
2096 | uint32_t v1 = 5; | |
2097 | uint64_t v2 = 400; | |
2098 | uint8_t v3 = 200; | |
2099 | int8_t v4 = -100; | |
67337c4a MD |
2100 | #if SIDE_BYTE_ORDER == SIDE_LITTLE_ENDIAN |
2101 | uint32_t v5 = side_bswap_32(6); | |
0519cb86 MD |
2102 | uint32_t v6 = 6; |
2103 | #else | |
2104 | uint32_t v5 = 6; | |
67337c4a | 2105 | uint32_t v6 = side_bswap_32(6); |
0519cb86 MD |
2106 | #endif |
2107 | ||
67337c4a MD |
2108 | side_event(my_provider_event_enum_gather, |
2109 | side_arg_list( | |
2110 | side_arg_gather_integer(&v1), | |
2111 | side_arg_gather_integer(&v2), | |
2112 | side_arg_gather_integer(&v3), | |
2113 | side_arg_gather_integer(&v4), | |
2114 | side_arg_gather_integer(&v5), | |
2115 | side_arg_gather_integer(&v6), | |
0519cb86 MD |
2116 | ) |
2117 | ); | |
2118 | } | |
2119 | ||
67337c4a MD |
2120 | side_static_event(my_provider_event_gatherstring, |
2121 | "myprovider", "myeventgatherstring", SIDE_LOGLEVEL_DEBUG, | |
2122 | side_field_list( | |
2123 | side_field_gather_string("string", 0, SIDE_TYPE_GATHER_ACCESS_DIRECT, side_attr_list()), | |
2124 | side_field_gather_array("arrayptr", | |
2125 | side_elem(side_type_gather_string(0, SIDE_TYPE_GATHER_ACCESS_POINTER, side_attr_list())), | |
2126 | 3, 0, SIDE_TYPE_GATHER_ACCESS_DIRECT, side_attr_list() | |
7d34edfc | 2127 | ), |
67337c4a MD |
2128 | side_field_gather_array("array", |
2129 | side_elem(side_type_gather_string(0, SIDE_TYPE_GATHER_ACCESS_DIRECT, side_attr_list())), | |
2130 | 3, 0, SIDE_TYPE_GATHER_ACCESS_DIRECT, side_attr_list() | |
7d34edfc MD |
2131 | ), |
2132 | ), | |
67337c4a | 2133 | side_attr_list() |
7d34edfc MD |
2134 | ); |
2135 | ||
2136 | static | |
2137 | void test_gather_string(void) | |
2138 | { | |
67337c4a | 2139 | side_event_cond(my_provider_event_gatherstring) { |
9365e936 MJ |
2140 | const char *str1 = "abcdef"; |
2141 | const char *ptrarray[3] = { | |
7d34edfc MD |
2142 | "abc", |
2143 | "def", | |
2144 | "ghi", | |
2145 | }; | |
2146 | char flatarray[] = { 'a', 'b', '\0', 'c', 'd', '\0', 'e', 'f', '\0' }; | |
2147 | ||
67337c4a MD |
2148 | side_event_call(my_provider_event_gatherstring, |
2149 | side_arg_list( | |
2150 | side_arg_gather_string(str1), | |
2151 | side_arg_gather_array(ptrarray), | |
2152 | side_arg_gather_array(flatarray), | |
7d34edfc MD |
2153 | ) |
2154 | ); | |
2155 | } | |
2156 | } | |
2157 | ||
67337c4a MD |
2158 | side_static_event(my_provider_event_str_utf, "myprovider", "myevent_str_utf", SIDE_LOGLEVEL_DEBUG, |
2159 | side_field_list( | |
2160 | side_field_string("utf8", side_attr_list()), | |
2161 | side_field_string32("utf32", side_attr_list()), | |
2162 | side_field_string16("utf16", side_attr_list()), | |
2163 | side_field_string32_le("utf32_le", side_attr_list()), | |
2164 | side_field_string16_le("utf16_le", side_attr_list()), | |
2165 | side_field_string32_be("utf32_be", side_attr_list()), | |
2166 | side_field_string16_be("utf16_be", side_attr_list()), | |
2167 | side_field_dynamic("dynamic_utf32"), | |
2168 | side_field_gather_string32("gather_utf32", 0, SIDE_TYPE_GATHER_ACCESS_DIRECT, side_attr_list()), | |
52990f65 | 2169 | ), |
67337c4a | 2170 | side_attr_list() |
52990f65 MD |
2171 | ); |
2172 | ||
2173 | static | |
2174 | void test_string_utf(void) | |
2175 | { | |
2176 | /* | |
2177 | * Character '®' is: | |
2178 | * UTF-8: \c2 \ae | |
2179 | * UTF-16: U+00ae | |
2180 | * UTF-32: U+000000ae | |
2181 | */ | |
2182 | uint8_t str8[] = { 0xc2, 0xae, 'a', 'b', 'c', 0 }; | |
2183 | uint32_t str32[] = { 0x000000ae, 'a', 'b', 'c', 0 }; | |
2184 | uint16_t str16[] = { 0x00ae, 'a', 'b', 'c', 0 }; | |
67337c4a | 2185 | #if SIDE_BYTE_ORDER == SIDE_LITTLE_ENDIAN |
52990f65 MD |
2186 | uint32_t str32_le[] = { 0x000000ae, 'a', 'b', 'c', 0 }; |
2187 | uint16_t str16_le[] = { 0x00ae, 'a', 'b', 'c', 0 }; | |
67337c4a MD |
2188 | uint32_t str32_be[] = { side_bswap_32(0x000000ae), side_bswap_32('a'), side_bswap_32('b'), side_bswap_32('c'), 0 }; |
2189 | uint16_t str16_be[] = { side_bswap_16(0x00ae), side_bswap_16('a'), side_bswap_16('b'), side_bswap_16('c'), 0 }; | |
52990f65 | 2190 | #else |
67337c4a MD |
2191 | uint32_t str32_le[] = { side_bswap_32(0x000000ae), side_bswap_32('a'), side_bswap_32('b'), side_bswap_32('c'), 0 }; |
2192 | uint16_t str16_le[] = { side_bswap_16(0x00ae), side_bswap_16('a'), side_bswap_16('b'), side_bswap_16('c'), 0 }; | |
52990f65 MD |
2193 | uint32_t str32_be[] = { 0x000000ae, 'a', 'b', 'c', 0 }; |
2194 | uint16_t str16_be[] = { 0x00ae, 'a', 'b', 'c', 0 }; | |
2195 | #endif | |
2196 | ||
67337c4a MD |
2197 | side_event(my_provider_event_str_utf, |
2198 | side_arg_list( | |
2199 | side_arg_string(str8), | |
2200 | side_arg_string32(str32), | |
2201 | side_arg_string16(str16), | |
2202 | side_arg_string32(str32_le), | |
2203 | side_arg_string16(str16_le), | |
2204 | side_arg_string32(str32_be), | |
2205 | side_arg_string16(str16_be), | |
2206 | side_arg_dynamic_string32(str32, side_attr_list()), | |
2207 | side_arg_gather_string(str32), | |
52990f65 MD |
2208 | ) |
2209 | ); | |
2210 | } | |
2211 | ||
f611d0c3 MD |
2212 | int main() |
2213 | { | |
2214 | test_fields(); | |
89747802 MD |
2215 | test_event_hidden(); |
2216 | test_event_export(); | |
c7a14585 | 2217 | test_struct_literal(); |
f611d0c3 MD |
2218 | test_struct(); |
2219 | test_array(); | |
2220 | test_vla(); | |
2221 | test_vla_visitor(); | |
cdd6e858 | 2222 | test_vla_visitor_2d(); |
a2e2357e MD |
2223 | test_dynamic_basic_type(); |
2224 | test_dynamic_vla(); | |
465e5e7e | 2225 | test_dynamic_null(); |
c208889e MD |
2226 | test_dynamic_struct(); |
2227 | test_dynamic_nested_struct(); | |
2228 | test_dynamic_vla_struct(); | |
2229 | test_dynamic_struct_vla(); | |
948e3e72 | 2230 | test_dynamic_nested_vla(); |
19fa6aa2 | 2231 | test_variadic(); |
41c4d119 | 2232 | test_static_variadic(); |
4f40d951 MD |
2233 | test_bool(); |
2234 | test_dynamic_bool(); | |
8ceca0cd | 2235 | test_dynamic_vla_with_visitor(); |
2b359235 | 2236 | test_dynamic_struct_with_visitor(); |
65010f43 | 2237 | test_event_user_attribute(); |
a848763d | 2238 | test_field_user_attribute(); |
808bd9bf MD |
2239 | test_variadic_attr(); |
2240 | test_variadic_vla_attr(); | |
2241 | test_variadic_struct_attr(); | |
fb25b355 MD |
2242 | test_float(); |
2243 | test_variadic_float(); | |
79f677ba | 2244 | test_enum(); |
ea32e5fc | 2245 | test_enum_bitmap(); |
7aec0d09 | 2246 | test_blob(); |
71aa8975 | 2247 | test_fmt_string(); |
8bdd5c12 | 2248 | test_endian(); |
1d9c515c | 2249 | test_base(); |
d41cb7ee MD |
2250 | test_struct_gather(); |
2251 | test_struct_gather_nest_ptr(); | |
2252 | test_struct_gather_float(); | |
2253 | test_array_gather(); | |
2254 | test_gather_structnest(); | |
2255 | test_gather_vla(); | |
2256 | test_gather_vla_flex(); | |
d69918cc | 2257 | test_gather_byte(); |
8ad2f385 | 2258 | test_gather_bool(); |
4e1b0e0e | 2259 | test_gather_pointer(); |
0519cb86 | 2260 | test_gather_enum(); |
7d34edfc | 2261 | test_gather_string(); |
52990f65 | 2262 | test_string_utf(); |
f611d0c3 MD |
2263 | return 0; |
2264 | } |