1 // SPDX-License-Identifier: MIT
3 * Copyright 2022 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
13 #include <side/trace.h>
15 /* User code example */
17 side_static_event(my_provider_event
, "myprovider", "myevent", SIDE_LOGLEVEL_DEBUG
,
19 side_field_u32("abc"),
20 side_field_s64("def"),
21 side_field_pointer("ptr"),
22 side_field_dynamic("dynamic"),
23 side_field_dynamic("dynamic_pointer"),
24 side_field_null("null"),
29 void test_fields(void)
34 side_event(my_provider_event
,
38 side_arg_pointer((void *) 0x1),
39 side_arg_dynamic_string("zzz"),
40 side_arg_dynamic_pointer((void *) 0x1),
46 side_hidden_event(my_provider_event_hidden
, "myprovider", "myeventhidden", SIDE_LOGLEVEL_DEBUG
,
48 side_field_u32("abc"),
53 void test_event_hidden(void)
55 side_event(my_provider_event_hidden
, side_arg_list(side_arg_u32(2)));
58 side_declare_event(my_provider_event_export
);
60 side_export_event(my_provider_event_export
, "myprovider", "myeventexport", SIDE_LOGLEVEL_DEBUG
,
62 side_field_u32("abc"),
67 void test_event_export(void)
69 side_event(my_provider_event_export
, side_arg_list(side_arg_u32(2)));
72 side_static_event(my_provider_event_struct_literal
, "myprovider", "myeventstructliteral", SIDE_LOGLEVEL_DEBUG
,
74 side_field_struct("structliteral",
87 void test_struct_literal(void)
89 side_event_cond(my_provider_event_struct_literal
) {
90 side_arg_define_vec(mystruct
, side_arg_list(side_arg_u32(21), side_arg_s64(22)));
91 side_event_call(my_provider_event_struct_literal
, side_arg_list(side_arg_struct(&mystruct
), side_arg_u8(55)));
95 static side_define_struct(mystructdef
,
102 side_static_event(my_provider_event_struct
, "myprovider", "myeventstruct", SIDE_LOGLEVEL_DEBUG
,
104 side_field_struct("struct", &mystructdef
),
110 void test_struct(void)
112 side_event_cond(my_provider_event_struct
) {
113 side_arg_define_vec(mystruct
, side_arg_list(side_arg_u32(21), side_arg_s64(22)));
114 side_event_call(my_provider_event_struct
, side_arg_list(side_arg_struct(&mystruct
), side_arg_u8(55)));
118 side_static_event(my_provider_event_array
, "myprovider", "myarray", SIDE_LOGLEVEL_DEBUG
,
120 side_field_array("arr", side_elem(side_type_u32()), 3),
126 void test_array(void)
128 side_event_cond(my_provider_event_array
) {
129 side_arg_define_vec(myarray
, side_arg_list(side_arg_u32(1), side_arg_u32(2), side_arg_u32(3)));
130 side_event_call(my_provider_event_array
, side_arg_list(side_arg_array(&myarray
), side_arg_s64(42)));
134 side_static_event(my_provider_event_vla
, "myprovider", "myvla", SIDE_LOGLEVEL_DEBUG
,
136 side_field_vla("vla", side_elem(side_type_u32())),
144 side_event_cond(my_provider_event_vla
) {
145 side_arg_define_vec(myvla
, side_arg_list(side_arg_u32(1), side_arg_u32(2), side_arg_u32(3)));
146 side_event_call(my_provider_event_vla
, side_arg_list(side_arg_vla(&myvla
), side_arg_s64(42)));
150 /* 1D array visitor */
152 struct app_visitor_ctx
{
158 enum side_visitor_status
test_visitor(const struct side_tracer_visitor_ctx
*tracer_ctx
, void *_ctx
)
160 struct app_visitor_ctx
*ctx
= (struct app_visitor_ctx
*) _ctx
;
161 uint32_t length
= ctx
->length
, i
;
163 for (i
= 0; i
< length
; i
++) {
164 const struct side_arg elem
= side_arg_u32(ctx
->ptr
[i
]);
166 if (tracer_ctx
->write_elem(tracer_ctx
, &elem
) != SIDE_VISITOR_STATUS_OK
)
167 return SIDE_VISITOR_STATUS_ERROR
;
169 return SIDE_VISITOR_STATUS_OK
;
172 static uint32_t testarray
[] = { 1, 2, 3, 4, 5, 6, 7, 8 };
174 side_static_event(my_provider_event_vla_visitor
, "myprovider", "myvlavisit", SIDE_LOGLEVEL_DEBUG
,
176 side_field_vla_visitor("vlavisit", side_elem(side_type_u32()), test_visitor
),
182 void test_vla_visitor(void)
184 side_event_cond(my_provider_event_vla_visitor
) {
185 struct app_visitor_ctx ctx
= {
187 .length
= SIDE_ARRAY_SIZE(testarray
),
189 side_arg_define_vla_visitor(side_visitor
, &ctx
);
190 side_event_call(my_provider_event_vla_visitor
,
191 side_arg_list(side_arg_vla_visitor(&side_visitor
), side_arg_s64(42)));
195 /* 2D array visitor */
197 struct app_visitor_2d_inner_ctx
{
203 enum side_visitor_status
test_inner_visitor(const struct side_tracer_visitor_ctx
*tracer_ctx
, void *_ctx
)
205 struct app_visitor_2d_inner_ctx
*ctx
= (struct app_visitor_2d_inner_ctx
*) _ctx
;
206 uint32_t length
= ctx
->length
, i
;
208 for (i
= 0; i
< length
; i
++) {
209 const struct side_arg elem
= side_arg_u32(ctx
->ptr
[i
]);
211 if (tracer_ctx
->write_elem(tracer_ctx
, &elem
) != SIDE_VISITOR_STATUS_OK
)
212 return SIDE_VISITOR_STATUS_ERROR
;
214 return SIDE_VISITOR_STATUS_OK
;
217 struct app_visitor_2d_outer_ctx
{
218 const uint32_t (*ptr
)[2];
223 enum side_visitor_status
test_outer_visitor(const struct side_tracer_visitor_ctx
*tracer_ctx
, void *_ctx
)
225 struct app_visitor_2d_outer_ctx
*ctx
= (struct app_visitor_2d_outer_ctx
*) _ctx
;
226 uint32_t length
= ctx
->length
, i
;
228 for (i
= 0; i
< length
; i
++) {
229 struct app_visitor_2d_inner_ctx inner_ctx
= {
233 side_arg_define_vla_visitor(side_inner_visitor
, &inner_ctx
);
234 const struct side_arg elem
= side_arg_vla_visitor(&side_inner_visitor
);
235 if (tracer_ctx
->write_elem(tracer_ctx
, &elem
) != SIDE_VISITOR_STATUS_OK
)
236 return SIDE_VISITOR_STATUS_ERROR
;
238 return SIDE_VISITOR_STATUS_OK
;
241 static uint32_t testarray2d
[][2] = {
247 side_static_event(my_provider_event_vla_visitor2d
, "myprovider", "myvlavisit2d", SIDE_LOGLEVEL_DEBUG
,
249 side_field_vla_visitor("vlavisit2d",
251 side_type_vla_visitor(
252 side_elem(side_type_u32()),
255 ), test_outer_visitor
),
261 void test_vla_visitor_2d(void)
263 side_event_cond(my_provider_event_vla_visitor2d
) {
264 struct app_visitor_2d_outer_ctx ctx
= {
266 .length
= SIDE_ARRAY_SIZE(testarray2d
),
268 side_arg_define_vla_visitor(side_outer_visitor
, &ctx
);
269 side_event_call(my_provider_event_vla_visitor2d
,
270 side_arg_list(side_arg_vla_visitor(&side_outer_visitor
), side_arg_s64(42)));
274 side_static_event(my_provider_event_dynamic_basic
,
275 "myprovider", "mydynamicbasic", SIDE_LOGLEVEL_DEBUG
,
277 side_field_dynamic("dynamic"),
282 void test_dynamic_basic_type(void)
284 side_event(my_provider_event_dynamic_basic
,
285 side_arg_list(side_arg_dynamic_s16(-33)));
288 side_static_event(my_provider_event_dynamic_vla
,
289 "myprovider", "mydynamicvla", SIDE_LOGLEVEL_DEBUG
,
291 side_field_dynamic("dynamic"),
296 void test_dynamic_vla(void)
298 side_arg_dynamic_define_vec(myvla
,
300 side_arg_dynamic_u32(1),
301 side_arg_dynamic_u32(2),
302 side_arg_dynamic_u32(3),
305 side_event(my_provider_event_dynamic_vla
,
306 side_arg_list(side_arg_dynamic_vla(&myvla
)));
309 side_static_event(my_provider_event_dynamic_null
,
310 "myprovider", "mydynamicnull", SIDE_LOGLEVEL_DEBUG
,
312 side_field_dynamic("dynamic"),
317 void test_dynamic_null(void)
319 side_event(my_provider_event_dynamic_null
,
320 side_arg_list(side_arg_dynamic_null()));
323 side_static_event(my_provider_event_dynamic_struct
,
324 "myprovider", "mydynamicstruct", SIDE_LOGLEVEL_DEBUG
,
326 side_field_dynamic("dynamic"),
331 void test_dynamic_struct(void)
333 side_arg_dynamic_define_struct(mystruct
,
335 side_arg_dynamic_field("a", side_arg_dynamic_u32(43)),
336 side_arg_dynamic_field("b", side_arg_dynamic_string("zzz")),
337 side_arg_dynamic_field("c", side_arg_dynamic_null()),
341 side_event(my_provider_event_dynamic_struct
,
342 side_arg_list(side_arg_dynamic_struct(&mystruct
)));
345 side_static_event(my_provider_event_dynamic_nested_struct
,
346 "myprovider", "mydynamicnestedstruct", SIDE_LOGLEVEL_DEBUG
,
348 side_field_dynamic("dynamic"),
353 void test_dynamic_nested_struct(void)
355 side_arg_dynamic_define_struct(nested
,
357 side_arg_dynamic_field("a", side_arg_dynamic_u32(43)),
358 side_arg_dynamic_field("b", side_arg_dynamic_u8(55)),
361 side_arg_dynamic_define_struct(nested2
,
363 side_arg_dynamic_field("aa", side_arg_dynamic_u64(128)),
364 side_arg_dynamic_field("bb", side_arg_dynamic_u16(1)),
367 side_arg_dynamic_define_struct(mystruct
,
369 side_arg_dynamic_field("nested", side_arg_dynamic_struct(&nested
)),
370 side_arg_dynamic_field("nested2", side_arg_dynamic_struct(&nested2
)),
373 side_event(my_provider_event_dynamic_nested_struct
,
374 side_arg_list(side_arg_dynamic_struct(&mystruct
)));
377 side_static_event(my_provider_event_dynamic_vla_struct
,
378 "myprovider", "mydynamicvlastruct", SIDE_LOGLEVEL_DEBUG
,
380 side_field_dynamic("dynamic"),
385 void test_dynamic_vla_struct(void)
387 side_arg_dynamic_define_struct(nested
,
389 side_arg_dynamic_field("a", side_arg_dynamic_u32(43)),
390 side_arg_dynamic_field("b", side_arg_dynamic_u8(55)),
393 side_arg_dynamic_define_vec(myvla
,
395 side_arg_dynamic_struct(&nested
),
396 side_arg_dynamic_struct(&nested
),
397 side_arg_dynamic_struct(&nested
),
398 side_arg_dynamic_struct(&nested
),
401 side_event(my_provider_event_dynamic_vla_struct
,
402 side_arg_list(side_arg_dynamic_vla(&myvla
)));
405 side_static_event(my_provider_event_dynamic_struct_vla
,
406 "myprovider", "mydynamicstructvla", SIDE_LOGLEVEL_DEBUG
,
408 side_field_dynamic("dynamic"),
413 void test_dynamic_struct_vla(void)
415 side_arg_dynamic_define_vec(myvla
,
417 side_arg_dynamic_u32(1),
418 side_arg_dynamic_u32(2),
419 side_arg_dynamic_u32(3),
422 side_arg_dynamic_define_vec(myvla2
,
424 side_arg_dynamic_u32(4),
425 side_arg_dynamic_u64(5),
426 side_arg_dynamic_u32(6),
429 side_arg_dynamic_define_struct(mystruct
,
431 side_arg_dynamic_field("a", side_arg_dynamic_vla(&myvla
)),
432 side_arg_dynamic_field("b", side_arg_dynamic_vla(&myvla2
)),
435 side_event(my_provider_event_dynamic_struct_vla
,
436 side_arg_list(side_arg_dynamic_struct(&mystruct
)));
439 side_static_event(my_provider_event_dynamic_nested_vla
,
440 "myprovider", "mydynamicnestedvla", SIDE_LOGLEVEL_DEBUG
,
442 side_field_dynamic("dynamic"),
447 void test_dynamic_nested_vla(void)
449 side_arg_dynamic_define_vec(nestedvla
,
451 side_arg_dynamic_u32(1),
452 side_arg_dynamic_u16(2),
453 side_arg_dynamic_u32(3),
456 side_arg_dynamic_define_vec(nestedvla2
,
458 side_arg_dynamic_u8(4),
459 side_arg_dynamic_u32(5),
460 side_arg_dynamic_u32(6),
463 side_arg_dynamic_define_vec(myvla
,
465 side_arg_dynamic_vla(&nestedvla
),
466 side_arg_dynamic_vla(&nestedvla2
),
469 side_event(my_provider_event_dynamic_nested_vla
,
470 side_arg_list(side_arg_dynamic_vla(&myvla
)));
473 side_static_event_variadic(my_provider_event_variadic
,
474 "myprovider", "myvariadicevent", SIDE_LOGLEVEL_DEBUG
,
479 void test_variadic(void)
481 side_event_variadic(my_provider_event_variadic
,
484 side_arg_dynamic_field("a", side_arg_dynamic_u32(55)),
485 side_arg_dynamic_field("b", side_arg_dynamic_s8(-4)),
490 side_static_event_variadic(my_provider_event_static_variadic
,
491 "myprovider", "mystaticvariadicevent", SIDE_LOGLEVEL_DEBUG
,
493 side_field_u32("abc"),
494 side_field_u16("def"),
499 void test_static_variadic(void)
501 side_event_variadic(my_provider_event_static_variadic
,
507 side_arg_dynamic_field("a", side_arg_dynamic_u32(55)),
508 side_arg_dynamic_field("b", side_arg_dynamic_s8(-4)),
513 side_static_event(my_provider_event_bool
, "myprovider", "myeventbool", SIDE_LOGLEVEL_DEBUG
,
515 side_field_bool("a_false"),
516 side_field_bool("b_true"),
517 side_field_bool("c_true"),
518 side_field_bool("d_true"),
519 side_field_bool("e_true"),
520 side_field_bool("f_false"),
521 side_field_bool("g_true"),
530 uint64_t c
= 0x12345678;
536 side_event(my_provider_event_bool
,
549 side_static_event_variadic(my_provider_event_dynamic_bool
,
550 "myprovider", "mydynamicbool", SIDE_LOGLEVEL_DEBUG
,
555 void test_dynamic_bool(void)
557 side_event_variadic(my_provider_event_dynamic_bool
,
560 side_arg_dynamic_field("a_true", side_arg_dynamic_bool(55)),
561 side_arg_dynamic_field("b_true", side_arg_dynamic_bool(-4)),
562 side_arg_dynamic_field("c_false", side_arg_dynamic_bool(0)),
563 side_arg_dynamic_field("d_true", side_arg_dynamic_bool(256)),
568 side_static_event(my_provider_event_dynamic_vla_visitor
,
569 "myprovider", "mydynamicvlavisitor", SIDE_LOGLEVEL_DEBUG
,
571 side_field_dynamic("dynamic"),
575 struct app_dynamic_vla_visitor_ctx
{
581 enum side_visitor_status
test_dynamic_vla_visitor(const struct side_tracer_visitor_ctx
*tracer_ctx
, void *_ctx
)
583 struct app_dynamic_vla_visitor_ctx
*ctx
= (struct app_dynamic_vla_visitor_ctx
*) _ctx
;
584 uint32_t length
= ctx
->length
, i
;
586 for (i
= 0; i
< length
; i
++) {
587 const struct side_arg elem
= side_arg_dynamic_u32(ctx
->ptr
[i
]);
588 if (tracer_ctx
->write_elem(tracer_ctx
, &elem
) != SIDE_VISITOR_STATUS_OK
)
589 return SIDE_VISITOR_STATUS_ERROR
;
591 return SIDE_VISITOR_STATUS_OK
;
594 static uint32_t testarray_dynamic_vla
[] = { 1, 2, 3, 4, 5, 6, 7, 8 };
597 void test_dynamic_vla_with_visitor(void)
599 side_event_cond(my_provider_event_dynamic_vla_visitor
) {
600 struct app_dynamic_vla_visitor_ctx ctx
= {
601 .ptr
= testarray_dynamic_vla
,
602 .length
= SIDE_ARRAY_SIZE(testarray_dynamic_vla
),
604 side_arg_dynamic_define_vla_visitor(myvlavisitor
, test_dynamic_vla_visitor
, &ctx
);
605 side_event_call(my_provider_event_dynamic_vla_visitor
,
607 side_arg_dynamic_vla_visitor(&myvlavisitor
)
613 side_static_event(my_provider_event_dynamic_struct_visitor
,
614 "myprovider", "mydynamicstructvisitor", SIDE_LOGLEVEL_DEBUG
,
616 side_field_dynamic("dynamic"),
620 struct struct_visitor_pair
{
625 struct app_dynamic_struct_visitor_ctx
{
626 const struct struct_visitor_pair
*ptr
;
631 enum side_visitor_status
test_dynamic_struct_visitor(const struct side_tracer_dynamic_struct_visitor_ctx
*tracer_ctx
, void *_ctx
)
633 struct app_dynamic_struct_visitor_ctx
*ctx
= (struct app_dynamic_struct_visitor_ctx
*) _ctx
;
634 uint32_t length
= ctx
->length
, i
;
636 for (i
= 0; i
< length
; i
++) {
637 struct side_arg_dynamic_field dynamic_field
=
638 side_arg_dynamic_field(ctx
->ptr
[i
].name
,
639 side_arg_dynamic_u32(ctx
->ptr
[i
].value
));
640 if (tracer_ctx
->write_field(tracer_ctx
, &dynamic_field
) != SIDE_VISITOR_STATUS_OK
)
641 return SIDE_VISITOR_STATUS_ERROR
;
643 return SIDE_VISITOR_STATUS_OK
;
646 static struct struct_visitor_pair testarray_dynamic_struct
[] = {
654 void test_dynamic_struct_with_visitor(void)
656 side_event_cond(my_provider_event_dynamic_struct_visitor
) {
657 struct app_dynamic_struct_visitor_ctx ctx
= {
658 .ptr
= testarray_dynamic_struct
,
659 .length
= SIDE_ARRAY_SIZE(testarray_dynamic_struct
),
661 side_arg_dynamic_define_struct_visitor(mystructvisitor
, test_dynamic_struct_visitor
, &ctx
);
662 side_event_call(my_provider_event_dynamic_struct_visitor
,
664 side_arg_dynamic_struct_visitor(&mystructvisitor
)
670 side_static_event(my_provider_event_user_attribute
, "myprovider", "myevent_user_attribute", SIDE_LOGLEVEL_DEBUG
,
672 side_field_u32("abc"),
673 side_field_s64("def"),
676 side_attr("user_attribute_a", side_attr_string("val1")),
677 side_attr("user_attribute_b", side_attr_string("val2")),
682 void test_event_user_attribute(void)
684 side_event(my_provider_event_user_attribute
, side_arg_list(side_arg_u32(1), side_arg_s64(2)));
687 side_static_event(my_provider_field_user_attribute
, "myprovider", "myevent_field_attribute", SIDE_LOGLEVEL_DEBUG
,
689 side_field_u32("abc",
691 side_attr("user_attribute_a", side_attr_string("val1")),
692 side_attr("user_attribute_b", side_attr_u32(2)),
695 side_field_s64("def",
697 side_attr("user_attribute_c", side_attr_string("val3")),
698 side_attr("user_attribute_d", side_attr_s64(-5)),
705 void test_field_user_attribute(void)
707 side_event(my_provider_field_user_attribute
, side_arg_list(side_arg_u32(1), side_arg_s64(2)));
710 side_static_event_variadic(my_provider_event_variadic_attr
,
711 "myprovider", "myvariadiceventattr", SIDE_LOGLEVEL_DEBUG
,
716 void test_variadic_attr(void)
718 side_event_variadic(my_provider_event_variadic_attr
,
721 side_arg_dynamic_field("a",
722 side_arg_dynamic_u32(55,
724 side_attr("user_attribute_c", side_attr_string("valX")),
725 side_attr("user_attribute_d", side_attr_u8(55)),
729 side_arg_dynamic_field("b",
730 side_arg_dynamic_s8(-4,
732 side_attr("X", side_attr_u8(1)),
733 side_attr("Y", side_attr_s8(2)),
741 side_static_event_variadic(my_provider_event_variadic_vla_attr
,
742 "myprovider", "myvariadiceventvlaattr", SIDE_LOGLEVEL_DEBUG
,
747 void test_variadic_vla_attr(void)
749 side_arg_dynamic_define_vec(myvla
,
751 side_arg_dynamic_u32(1,
753 side_attr("Z", side_attr_u8(0)),
754 side_attr("A", side_attr_u8(123)),
757 side_arg_dynamic_u32(2),
758 side_arg_dynamic_u32(3),
761 side_attr("X", side_attr_u8(1)),
762 side_attr("Y", side_attr_u8(2)),
765 side_event_variadic(my_provider_event_variadic_vla_attr
,
768 side_arg_dynamic_field("a", side_arg_dynamic_vla(&myvla
)),
773 side_static_event_variadic(my_provider_event_variadic_struct_attr
,
774 "myprovider", "myvariadiceventstructattr", SIDE_LOGLEVEL_DEBUG
,
779 void test_variadic_struct_attr(void)
781 side_event_cond(my_provider_event_variadic_struct_attr
) {
782 side_arg_dynamic_define_struct(mystruct
,
784 side_arg_dynamic_field("a",
785 side_arg_dynamic_u32(43,
787 side_attr("A", side_attr_bool(true)),
791 side_arg_dynamic_field("b", side_arg_dynamic_u8(55)),
794 side_attr("X", side_attr_u8(1)),
795 side_attr("Y", side_attr_u8(2)),
798 side_event_call_variadic(my_provider_event_variadic_struct_attr
,
801 side_arg_dynamic_field("a", side_arg_dynamic_struct(&mystruct
)),
807 side_static_event(my_provider_event_float
, "myprovider", "myeventfloat", SIDE_LOGLEVEL_DEBUG
,
810 side_field_float_binary16("binary16"),
811 side_field_float_binary16_le("binary16_le"),
812 side_field_float_binary16_be("binary16_be"),
815 side_field_float_binary32("binary32"),
816 side_field_float_binary32_le("binary32_le"),
817 side_field_float_binary32_be("binary32_be"),
820 side_field_float_binary64("binary64"),
821 side_field_float_binary64_le("binary64_le"),
822 side_field_float_binary64_be("binary64_be"),
825 side_field_float_binary128("binary128"),
826 side_field_float_binary128_le("binary128_le"),
827 side_field_float_binary128_be("binary128_be"),
833 void test_float(void)
869 float16
.u
= side_bswap_16(float16
.u
);
872 float32
.u
= side_bswap_32(float32
.u
);
875 float64
.u
= side_bswap_64(float64
.u
);
878 side_bswap_128p(float128
.arr
);
881 side_event(my_provider_event_float
,
884 side_arg_float_binary16(1.1),
885 # if SIDE_FLOAT_WORD_ORDER == SIDE_LITTLE_ENDIAN
886 side_arg_float_binary16(1.1),
887 side_arg_float_binary16(float16
.f
),
889 side_arg_float_binary16(float16
.f
),
890 side_arg_float_binary16(1.1),
894 side_arg_float_binary32(2.2),
895 # if SIDE_FLOAT_WORD_ORDER == SIDE_LITTLE_ENDIAN
896 side_arg_float_binary32(2.2),
897 side_arg_float_binary32(float32
.f
),
899 side_arg_float_binary32(float32
.f
),
900 side_arg_float_binary32(2.2),
904 side_arg_float_binary64(3.3),
905 # if SIDE_FLOAT_WORD_ORDER == SIDE_LITTLE_ENDIAN
906 side_arg_float_binary64(3.3),
907 side_arg_float_binary64(float64
.f
),
909 side_arg_float_binary64(float64
.f
),
910 side_arg_float_binary64(3.3),
914 side_arg_float_binary128(4.4),
915 # if SIDE_FLOAT_WORD_ORDER == SIDE_LITTLE_ENDIAN
916 side_arg_float_binary128(4.4),
917 side_arg_float_binary128(float128
.f
),
919 side_arg_float_binary128(float128
.f
),
920 side_arg_float_binary128(4.4),
927 side_static_event_variadic(my_provider_event_variadic_float
,
928 "myprovider", "myvariadicfloat", SIDE_LOGLEVEL_DEBUG
,
933 void test_variadic_float(void)
969 float16
.u
= side_bswap_16(float16
.u
);
972 float32
.u
= side_bswap_32(float32
.u
);
975 float64
.u
= side_bswap_64(float64
.u
);
978 side_bswap_128p(float128
.arr
);
981 side_event_variadic(my_provider_event_variadic_float
,
985 side_arg_dynamic_field("binary16", side_arg_dynamic_float_binary16(1.1)),
986 # if SIDE_FLOAT_WORD_ORDER == SIDE_LITTLE_ENDIAN
987 side_arg_dynamic_field("binary16_le", side_arg_dynamic_float_binary16_le(1.1)),
988 side_arg_dynamic_field("binary16_be", side_arg_dynamic_float_binary16_be(float16
.f
)),
990 side_arg_dynamic_field("binary16_le", side_arg_dynamic_float_binary16_le(float16
.f
)),
991 side_arg_dynamic_field("binary16_be", side_arg_dynamic_float_binary16_be(1.1)),
995 side_arg_dynamic_field("binary32", side_arg_dynamic_float_binary32(2.2)),
996 # if SIDE_FLOAT_WORD_ORDER == SIDE_LITTLE_ENDIAN
997 side_arg_dynamic_field("binary32_le", side_arg_dynamic_float_binary32_le(2.2)),
998 side_arg_dynamic_field("binary32_be", side_arg_dynamic_float_binary32_be(float32
.f
)),
1000 side_arg_dynamic_field("binary32_le", side_arg_dynamic_float_binary32_le(float32
.f
)),
1001 side_arg_dynamic_field("binary32_be", side_arg_dynamic_float_binary32_be(2.2)),
1005 side_arg_dynamic_field("binary64", side_arg_dynamic_float_binary64(3.3)),
1006 # if SIDE_FLOAT_WORD_ORDER == SIDE_LITTLE_ENDIAN
1007 side_arg_dynamic_field("binary64_le", side_arg_dynamic_float_binary64_le(3.3)),
1008 side_arg_dynamic_field("binary64_be", side_arg_dynamic_float_binary64_be(float64
.f
)),
1010 side_arg_dynamic_field("binary64_le", side_arg_dynamic_float_binary64_le(float64
.f
)),
1011 side_arg_dynamic_field("binary64_be", side_arg_dynamic_float_binary64_be(3.3)),
1015 side_arg_dynamic_field("binary128", side_arg_dynamic_float_binary128(4.4)),
1016 # if SIDE_FLOAT_WORD_ORDER == SIDE_LITTLE_ENDIAN
1017 side_arg_dynamic_field("binary128_le", side_arg_dynamic_float_binary128_le(4.4)),
1018 side_arg_dynamic_field("binary128_be", side_arg_dynamic_float_binary128_be(float128
.f
)),
1020 side_arg_dynamic_field("binary128_le", side_arg_dynamic_float_binary128_le(float128
.f
)),
1021 side_arg_dynamic_field("binary128_be", side_arg_dynamic_float_binary128_be(4.4)),
1028 static side_define_enum(myenum
,
1029 side_enum_mapping_list(
1030 side_enum_mapping_range("one-ten", 1, 10),
1031 side_enum_mapping_range("100-200", 100, 200),
1032 side_enum_mapping_value("200", 200),
1033 side_enum_mapping_value("300", 300),
1037 side_static_event(my_provider_event_enum
, "myprovider", "myeventenum", SIDE_LOGLEVEL_DEBUG
,
1039 side_field_enum("5", &myenum
, side_elem(side_type_u32())),
1040 side_field_enum("400", &myenum
, side_elem(side_type_u64())),
1041 side_field_enum("200", &myenum
, side_elem(side_type_u8())),
1042 side_field_enum("-100", &myenum
, side_elem(side_type_s8())),
1043 side_field_enum("6_be", &myenum
, side_elem(side_type_u32_be())),
1044 side_field_enum("6_le", &myenum
, side_elem(side_type_u32_le())),
1049 void test_enum(void)
1051 side_event(my_provider_event_enum
,
1057 #if SIDE_BYTE_ORDER == SIDE_LITTLE_ENDIAN
1058 side_arg_u32(side_bswap_32(6)),
1062 side_arg_u32(side_bswap_32(6)),
1068 /* A bitmap enum maps bits to labels. */
1069 static side_define_enum_bitmap(myenum_bitmap
,
1070 side_enum_bitmap_mapping_list(
1071 side_enum_bitmap_mapping_value("0", 0),
1072 side_enum_bitmap_mapping_range("1-2", 1, 2),
1073 side_enum_bitmap_mapping_range("2-4", 2, 4),
1074 side_enum_bitmap_mapping_value("3", 3),
1075 side_enum_bitmap_mapping_value("30", 30),
1076 side_enum_bitmap_mapping_value("63", 63),
1077 side_enum_bitmap_mapping_range("158-160", 158, 160),
1078 side_enum_bitmap_mapping_value("159", 159),
1079 side_enum_bitmap_mapping_range("500-700", 500, 700),
1083 side_static_event(my_provider_event_enum_bitmap
, "myprovider", "myeventenumbitmap", SIDE_LOGLEVEL_DEBUG
,
1085 side_field_enum_bitmap("bit_0", &myenum_bitmap
, side_elem(side_type_u32())),
1086 side_field_enum_bitmap("bit_1", &myenum_bitmap
, side_elem(side_type_u32())),
1087 side_field_enum_bitmap("bit_2", &myenum_bitmap
, side_elem(side_type_u8())),
1088 side_field_enum_bitmap("bit_3", &myenum_bitmap
, side_elem(side_type_u8())),
1089 side_field_enum_bitmap("bit_30", &myenum_bitmap
, side_elem(side_type_u32())),
1090 side_field_enum_bitmap("bit_31", &myenum_bitmap
, side_elem(side_type_u32())),
1091 side_field_enum_bitmap("bit_63", &myenum_bitmap
, side_elem(side_type_u64())),
1092 side_field_enum_bitmap("bits_1+63", &myenum_bitmap
, side_elem(side_type_u64())),
1093 side_field_enum_bitmap("byte_bit_2", &myenum_bitmap
, side_elem(side_type_byte())),
1094 side_field_enum_bitmap("bit_159", &myenum_bitmap
,
1095 side_elem(side_type_array(side_elem(side_type_u32()), 5))),
1096 side_field_enum_bitmap("bit_159", &myenum_bitmap
,
1097 side_elem(side_type_vla(side_elem(side_type_u32())))),
1098 side_field_enum_bitmap("bit_2_be", &myenum_bitmap
, side_elem(side_type_u32_be())),
1099 side_field_enum_bitmap("bit_2_le", &myenum_bitmap
, side_elem(side_type_u32_le())),
1104 void test_enum_bitmap(void)
1106 side_event_cond(my_provider_event_enum_bitmap
) {
1107 side_arg_define_vec(myarray
,
1113 side_arg_u32(0x80000000), /* bit 159 */
1116 side_event_call(my_provider_event_enum_bitmap
,
1118 side_arg_u32(1U << 0),
1119 side_arg_u32(1U << 1),
1120 side_arg_u8(1U << 2),
1121 side_arg_u8(1U << 3),
1122 side_arg_u32(1U << 30),
1123 side_arg_u32(1U << 31),
1124 side_arg_u64(1ULL << 63),
1125 side_arg_u64((1ULL << 1) | (1ULL << 63)),
1126 side_arg_byte(1U << 2),
1127 side_arg_array(&myarray
),
1128 side_arg_vla(&myarray
),
1129 #if SIDE_BYTE_ORDER == SIDE_LITTLE_ENDIAN
1130 side_arg_u32(side_bswap_32(1U << 2)),
1131 side_arg_u32(1U << 2),
1133 side_arg_u32(1U << 2),
1134 side_arg_u32(side_bswap_32(1U << 2)),
1141 side_static_event_variadic(my_provider_event_blob
, "myprovider", "myeventblob", SIDE_LOGLEVEL_DEBUG
,
1143 side_field_byte("blobfield"),
1144 side_field_array("arrayblob", side_elem(side_type_byte()), 3),
1149 void test_blob(void)
1151 side_event_cond(my_provider_event_blob
) {
1152 side_arg_define_vec(myarray
, side_arg_list(side_arg_byte(1), side_arg_byte(2), side_arg_byte(3)));
1153 side_arg_dynamic_define_vec(myvla
,
1155 side_arg_dynamic_byte(0x22),
1156 side_arg_dynamic_byte(0x33),
1159 side_event_call_variadic(my_provider_event_blob
,
1161 side_arg_byte(0x55),
1162 side_arg_array(&myarray
),
1165 side_arg_dynamic_field("varblobfield",
1166 side_arg_dynamic_byte(0x55)
1168 side_arg_dynamic_field("varblobvla", side_arg_dynamic_vla(&myvla
)),
1174 side_static_event_variadic(my_provider_event_format_string
,
1175 "myprovider", "myeventformatstring", SIDE_LOGLEVEL_DEBUG
,
1177 side_field_string("fmt"),
1180 side_attr("lang.c.format_string", side_attr_bool(true)),
1185 void test_fmt_string(void)
1187 side_event_cond(my_provider_event_format_string
) {
1188 side_arg_dynamic_define_vec(args
,
1190 side_arg_dynamic_string("blah"),
1191 side_arg_dynamic_s32(123),
1194 side_event_call_variadic(my_provider_event_format_string
,
1196 side_arg_string("This is a formatted string with str: %s int: %d"),
1199 side_arg_dynamic_field("arguments", side_arg_dynamic_vla(&args
)),
1205 side_static_event_variadic(my_provider_event_endian
, "myprovider", "myevent_endian", SIDE_LOGLEVEL_DEBUG
,
1207 side_field_u16_le("u16_le"),
1208 side_field_u32_le("u32_le"),
1209 side_field_u64_le("u64_le"),
1210 side_field_s16_le("s16_le"),
1211 side_field_s32_le("s32_le"),
1212 side_field_s64_le("s64_le"),
1213 side_field_u16_be("u16_be"),
1214 side_field_u32_be("u32_be"),
1215 side_field_u64_be("u64_be"),
1216 side_field_s16_be("s16_be"),
1217 side_field_s32_be("s32_be"),
1218 side_field_s64_be("s64_be"),
1223 void test_endian(void)
1225 side_event_variadic(my_provider_event_endian
,
1227 #if SIDE_BYTE_ORDER == SIDE_LITTLE_ENDIAN
1234 side_arg_u16(side_bswap_16(1)),
1235 side_arg_u32(side_bswap_32(1)),
1236 side_arg_u64(side_bswap_64(1)),
1237 side_arg_s16(side_bswap_16(1)),
1238 side_arg_s32(side_bswap_32(1)),
1239 side_arg_s64(side_bswap_64(1)),
1241 side_arg_u16(side_bswap_16(1)),
1242 side_arg_u32(side_bswap_32(1)),
1243 side_arg_u64(side_bswap_64(1)),
1244 side_arg_s16(side_bswap_16(1)),
1245 side_arg_s32(side_bswap_32(1)),
1246 side_arg_s64(side_bswap_64(1)),
1256 #if SIDE_BYTE_ORDER == SIDE_LITTLE_ENDIAN
1257 side_arg_dynamic_field("u16_le", side_arg_dynamic_u16_le(1)),
1258 side_arg_dynamic_field("u32_le", side_arg_dynamic_u32_le(1)),
1259 side_arg_dynamic_field("u64_le", side_arg_dynamic_u64_le(1)),
1260 side_arg_dynamic_field("s16_le", side_arg_dynamic_s16_le(1)),
1261 side_arg_dynamic_field("s32_le", side_arg_dynamic_s32_le(1)),
1262 side_arg_dynamic_field("s64_le", side_arg_dynamic_s64_le(1)),
1263 side_arg_dynamic_field("u16_be", side_arg_dynamic_u16_be(side_bswap_16(1))),
1264 side_arg_dynamic_field("u32_be", side_arg_dynamic_u32_be(side_bswap_32(1))),
1265 side_arg_dynamic_field("u64_be", side_arg_dynamic_u64_be(side_bswap_64(1))),
1266 side_arg_dynamic_field("s16_be", side_arg_dynamic_s16_be(side_bswap_16(1))),
1267 side_arg_dynamic_field("s32_be", side_arg_dynamic_s32_be(side_bswap_32(1))),
1268 side_arg_dynamic_field("s64_be", side_arg_dynamic_s64_be(side_bswap_64(1))),
1270 side_arg_dynamic_field("u16_le", side_arg_dynamic_u16_le(side_bswap_16(1))),
1271 side_arg_dynamic_field("u32_le", side_arg_dynamic_u32_le(side_bswap_32(1))),
1272 side_arg_dynamic_field("u64_le", side_arg_dynamic_u64_le(side_bswap_64(1))),
1273 side_arg_dynamic_field("s16_le", side_arg_dynamic_s16_le(side_bswap_16(1))),
1274 side_arg_dynamic_field("s32_le", side_arg_dynamic_s32_le(side_bswap_32(1))),
1275 side_arg_dynamic_field("s64_le", side_arg_dynamic_s64_le(side_bswap_64(1))),
1276 side_arg_dynamic_field("u16_be", side_arg_dynamic_u16_be(1)),
1277 side_arg_dynamic_field("u32_be", side_arg_dynamic_u32_be(1)),
1278 side_arg_dynamic_field("u64_be", side_arg_dynamic_u64_be(1)),
1279 side_arg_dynamic_field("s16_be", side_arg_dynamic_s16_be(1)),
1280 side_arg_dynamic_field("s32_be", side_arg_dynamic_s32_be(1)),
1281 side_arg_dynamic_field("s64_be", side_arg_dynamic_s64_be(1)),
1287 side_static_event(my_provider_event_base
, "myprovider", "myevent_base", SIDE_LOGLEVEL_DEBUG
,
1289 side_field_u8("u8base2", side_attr_list(side_attr("std.integer.base", side_attr_u8(2)))),
1290 side_field_u8("u8base8", side_attr_list(side_attr("std.integer.base", side_attr_u8(8)))),
1291 side_field_u8("u8base10", side_attr_list(side_attr("std.integer.base", side_attr_u8(10)))),
1292 side_field_u8("u8base16", side_attr_list(side_attr("std.integer.base", side_attr_u8(16)))),
1293 side_field_u16("u16base2", side_attr_list(side_attr("std.integer.base", side_attr_u8(2)))),
1294 side_field_u16("u16base8", side_attr_list(side_attr("std.integer.base", side_attr_u8(8)))),
1295 side_field_u16("u16base10", side_attr_list(side_attr("std.integer.base", side_attr_u8(10)))),
1296 side_field_u16("u16base16", side_attr_list(side_attr("std.integer.base", side_attr_u8(16)))),
1297 side_field_u32("u32base2", side_attr_list(side_attr("std.integer.base", side_attr_u8(2)))),
1298 side_field_u32("u32base8", side_attr_list(side_attr("std.integer.base", side_attr_u8(8)))),
1299 side_field_u32("u32base10", side_attr_list(side_attr("std.integer.base", side_attr_u8(10)))),
1300 side_field_u32("u32base16", side_attr_list(side_attr("std.integer.base", side_attr_u8(16)))),
1301 side_field_u64("u64base2", side_attr_list(side_attr("std.integer.base", side_attr_u8(2)))),
1302 side_field_u64("u64base8", side_attr_list(side_attr("std.integer.base", side_attr_u8(8)))),
1303 side_field_u64("u64base10", side_attr_list(side_attr("std.integer.base", side_attr_u8(10)))),
1304 side_field_u64("u64base16", side_attr_list(side_attr("std.integer.base", side_attr_u8(16)))),
1305 side_field_s8("s8base2", side_attr_list(side_attr("std.integer.base", side_attr_u8(2)))),
1306 side_field_s8("s8base8", side_attr_list(side_attr("std.integer.base", side_attr_u8(8)))),
1307 side_field_s8("s8base10", side_attr_list(side_attr("std.integer.base", side_attr_u8(10)))),
1308 side_field_s8("s8base16", side_attr_list(side_attr("std.integer.base", side_attr_u8(16)))),
1309 side_field_s16("s16base2", side_attr_list(side_attr("std.integer.base", side_attr_u8(2)))),
1310 side_field_s16("s16base8", side_attr_list(side_attr("std.integer.base", side_attr_u8(8)))),
1311 side_field_s16("s16base10", side_attr_list(side_attr("std.integer.base", side_attr_u8(10)))),
1312 side_field_s16("s16base16", side_attr_list(side_attr("std.integer.base", side_attr_u8(16)))),
1313 side_field_s32("s32base2", side_attr_list(side_attr("std.integer.base", side_attr_u8(2)))),
1314 side_field_s32("s32base8", side_attr_list(side_attr("std.integer.base", side_attr_u8(8)))),
1315 side_field_s32("s32base10", side_attr_list(side_attr("std.integer.base", side_attr_u8(10)))),
1316 side_field_s32("s32base16", side_attr_list(side_attr("std.integer.base", side_attr_u8(16)))),
1317 side_field_s64("s64base2", side_attr_list(side_attr("std.integer.base", side_attr_u8(2)))),
1318 side_field_s64("s64base8", side_attr_list(side_attr("std.integer.base", side_attr_u8(8)))),
1319 side_field_s64("s64base10", side_attr_list(side_attr("std.integer.base", side_attr_u8(10)))),
1320 side_field_s64("s64base16", side_attr_list(side_attr("std.integer.base", side_attr_u8(16)))),
1325 void test_base(void)
1327 side_event(my_provider_event_base
,
1380 static side_define_struct(mystructgatherdef
,
1382 side_field_gather_unsigned_integer("a", offsetof(struct test
, a
),
1383 side_struct_field_sizeof(struct test
, a
), 0, 0,
1384 SIDE_TYPE_GATHER_ACCESS_DIRECT
),
1385 side_field_gather_signed_integer("d", offsetof(struct test
, d
),
1386 side_struct_field_sizeof(struct test
, d
), 0, 0,
1387 SIDE_TYPE_GATHER_ACCESS_DIRECT
),
1388 side_field_gather_unsigned_integer("e", offsetof(struct test
, e
),
1389 side_struct_field_sizeof(struct test
, e
), 8, 4,
1390 SIDE_TYPE_GATHER_ACCESS_DIRECT
, side_attr_list(side_attr("std.integer.base", side_attr_u8(16)))),
1391 side_field_gather_signed_integer("f", offsetof(struct test
, f
),
1392 side_struct_field_sizeof(struct test
, f
), 1, 4,
1393 SIDE_TYPE_GATHER_ACCESS_DIRECT
, side_attr_list(side_attr("std.integer.base", side_attr_u8(10)))),
1394 side_field_gather_signed_integer("g", offsetof(struct test
, g
),
1395 side_struct_field_sizeof(struct test
, g
), 11, 4,
1396 SIDE_TYPE_GATHER_ACCESS_DIRECT
, side_attr_list(side_attr("std.integer.base", side_attr_u8(10)))),
1397 side_field_gather_signed_integer("h", offsetof(struct test
, h
),
1398 side_struct_field_sizeof(struct test
, h
), 1, 31,
1399 SIDE_TYPE_GATHER_ACCESS_DIRECT
, side_attr_list(side_attr("std.integer.base", side_attr_u8(10)))),
1400 side_field_gather_signed_integer("i", offsetof(struct test
, i
),
1401 side_struct_field_sizeof(struct test
, i
), 33, 20,
1402 SIDE_TYPE_GATHER_ACCESS_DIRECT
, side_attr_list(side_attr("std.integer.base", side_attr_u8(10)))),
1403 side_field_gather_signed_integer("j", offsetof(struct test
, j
),
1404 side_struct_field_sizeof(struct test
, j
), 63, 1,
1405 SIDE_TYPE_GATHER_ACCESS_DIRECT
, side_attr_list(side_attr("std.integer.base", side_attr_u8(10)))),
1406 side_field_gather_signed_integer("k", offsetof(struct test
, k
),
1407 side_struct_field_sizeof(struct test
, k
), 1, 63,
1408 SIDE_TYPE_GATHER_ACCESS_DIRECT
, side_attr_list(side_attr("std.integer.base", side_attr_u8(10)))),
1409 side_field_gather_unsigned_integer_le("test", offsetof(struct test
, test
),
1410 side_struct_field_sizeof(struct test
, test
), 0, 64,
1411 SIDE_TYPE_GATHER_ACCESS_DIRECT
, side_attr_list(side_attr("std.integer.base", side_attr_u8(16)))),
1412 side_field_gather_unsigned_integer_le("test_le", offsetof(struct test
, test
),
1413 side_struct_field_sizeof(struct test
, test
), 0, 64,
1414 SIDE_TYPE_GATHER_ACCESS_DIRECT
, side_attr_list(side_attr("std.integer.base", side_attr_u8(16)))),
1415 side_field_gather_unsigned_integer_be("test_be", offsetof(struct test
, test
),
1416 side_struct_field_sizeof(struct test
, test
), 0, 64,
1417 SIDE_TYPE_GATHER_ACCESS_DIRECT
, side_attr_list(side_attr("std.integer.base", side_attr_u8(16)))),
1421 side_static_event(my_provider_event_structgather
, "myprovider", "myeventstructgather", SIDE_LOGLEVEL_DEBUG
,
1423 side_field_gather_struct("structgather", &mystructgatherdef
, 0, sizeof(struct test
),
1424 SIDE_TYPE_GATHER_ACCESS_DIRECT
),
1425 side_field_gather_signed_integer("intgather", 0, sizeof(int32_t), 0, 0, SIDE_TYPE_GATHER_ACCESS_DIRECT
,
1426 side_attr_list(side_attr("std.integer.base", side_attr_u8(10)))),
1428 side_field_gather_float("f32", 0, sizeof(_Float32
), SIDE_TYPE_GATHER_ACCESS_DIRECT
),
1434 void test_struct_gather(void)
1436 side_event_cond(my_provider_event_structgather
) {
1437 struct test mystruct
= {
1455 side_event_call(my_provider_event_structgather
,
1457 side_arg_gather_struct(&mystruct
),
1458 side_arg_gather_integer(&val
),
1460 side_arg_gather_float(&f32
),
1473 struct testnest2
*nest
;
1478 struct testnest1
*nest
;
1481 static side_define_struct(mystructgathernest2
,
1483 side_field_gather_unsigned_integer("c", offsetof(struct testnest2
, c
),
1484 side_struct_field_sizeof(struct testnest2
, c
), 0, 0,
1485 SIDE_TYPE_GATHER_ACCESS_DIRECT
),
1489 static side_define_struct(mystructgathernest1
,
1491 side_field_gather_unsigned_integer("b", offsetof(struct testnest1
, b
),
1492 side_struct_field_sizeof(struct testnest1
, b
), 0, 0,
1493 SIDE_TYPE_GATHER_ACCESS_DIRECT
),
1494 side_field_gather_struct("nest2", &mystructgathernest2
,
1495 offsetof(struct testnest1
, nest
), sizeof(struct testnest2
),
1496 SIDE_TYPE_GATHER_ACCESS_POINTER
),
1500 static side_define_struct(mystructgathernest0
,
1502 side_field_gather_unsigned_integer("a", offsetof(struct testnest0
, a
),
1503 side_struct_field_sizeof(struct testnest0
, a
), 0, 0,
1504 SIDE_TYPE_GATHER_ACCESS_DIRECT
),
1505 side_field_gather_struct("nest1", &mystructgathernest1
,
1506 offsetof(struct testnest0
, nest
), sizeof(struct testnest1
),
1507 SIDE_TYPE_GATHER_ACCESS_POINTER
),
1511 side_static_event(my_provider_event_structgather_nest
,
1512 "myprovider", "myeventstructgathernest", SIDE_LOGLEVEL_DEBUG
,
1514 side_field_gather_struct("nest0", &mystructgathernest0
, 0,
1515 sizeof(struct testnest0
), SIDE_TYPE_GATHER_ACCESS_DIRECT
),
1520 void test_struct_gather_nest_ptr(void)
1522 side_event_cond(my_provider_event_structgather_nest
) {
1523 struct testnest2 mystruct2
= {
1526 struct testnest1 mystruct1
= {
1530 struct testnest0 mystruct
= {
1534 side_event_call(my_provider_event_structgather_nest
,
1536 side_arg_gather_struct(&mystruct
),
1557 static side_define_struct(mystructgatherfloat
,
1560 side_field_gather_float("f16", offsetof(struct testfloat
, f16
), side_struct_field_sizeof(struct testfloat
, f16
),
1561 SIDE_TYPE_GATHER_ACCESS_DIRECT
),
1564 side_field_gather_float("f32", offsetof(struct testfloat
, f32
), side_struct_field_sizeof(struct testfloat
, f32
),
1565 SIDE_TYPE_GATHER_ACCESS_DIRECT
),
1568 side_field_gather_float("f64", offsetof(struct testfloat
, f64
), side_struct_field_sizeof(struct testfloat
, f64
),
1569 SIDE_TYPE_GATHER_ACCESS_DIRECT
),
1572 side_field_gather_float("f128", offsetof(struct testfloat
, f128
), side_struct_field_sizeof(struct testfloat
, f128
),
1573 SIDE_TYPE_GATHER_ACCESS_DIRECT
),
1578 side_static_event(my_provider_event_structgatherfloat
,
1579 "myprovider", "myeventstructgatherfloat", SIDE_LOGLEVEL_DEBUG
,
1581 side_field_gather_struct("structgatherfloat", &mystructgatherfloat
, 0,
1582 sizeof(struct testfloat
), SIDE_TYPE_GATHER_ACCESS_DIRECT
),
1587 void test_struct_gather_float(void)
1589 side_event_cond(my_provider_event_structgatherfloat
) {
1590 struct testfloat mystruct
= {
1604 side_event_call(my_provider_event_structgatherfloat
,
1606 side_arg_gather_struct(&mystruct
),
1612 uint32_t mygatherarray
[] = { 1, 2, 3, 4, 5 };
1614 uint16_t mygatherarray2
[] = { 6, 7, 8, 9 };
1621 static side_define_struct(mystructgatherarray
,
1623 side_field_gather_array("array",
1624 side_elem(side_type_gather_unsigned_integer(0, sizeof(uint32_t), 0, 0, SIDE_TYPE_GATHER_ACCESS_DIRECT
)),
1625 SIDE_ARRAY_SIZE(mygatherarray
),
1626 offsetof(struct testarray
, ptr
),
1627 SIDE_TYPE_GATHER_ACCESS_POINTER
1632 side_static_event(my_provider_event_structgatherarray
,
1633 "myprovider", "myeventstructgatherarray", SIDE_LOGLEVEL_DEBUG
,
1635 side_field_gather_struct("structgatherarray", &mystructgatherarray
, 0,
1636 sizeof(struct testarray
), SIDE_TYPE_GATHER_ACCESS_DIRECT
),
1637 side_field_gather_array("array2",
1638 side_elem(side_type_gather_unsigned_integer(0, sizeof(uint16_t), 0, 0, SIDE_TYPE_GATHER_ACCESS_DIRECT
)),
1639 SIDE_ARRAY_SIZE(mygatherarray2
), 0,
1640 SIDE_TYPE_GATHER_ACCESS_DIRECT
1646 void test_array_gather(void)
1648 side_event_cond(my_provider_event_structgatherarray
) {
1649 struct testarray mystruct
= {
1651 .ptr
= mygatherarray
,
1653 side_event_call(my_provider_event_structgatherarray
,
1655 side_arg_gather_struct(&mystruct
),
1656 side_arg_gather_array(&mygatherarray2
),
1662 #define TESTSGNESTARRAY_LEN 4
1663 struct testgatherstructnest1
{
1665 int c
[TESTSGNESTARRAY_LEN
];
1668 struct testgatherstructnest0
{
1669 struct testgatherstructnest1 nest
;
1670 struct testgatherstructnest1 nestarray
[2];
1674 static side_define_struct(mystructgatherstructnest1
,
1676 side_field_gather_signed_integer("b", offsetof(struct testgatherstructnest1
, b
),
1677 side_struct_field_sizeof(struct testgatherstructnest1
, b
), 0, 0,
1678 SIDE_TYPE_GATHER_ACCESS_DIRECT
),
1679 side_field_gather_array("c",
1681 side_type_gather_signed_integer(0, sizeof(uint32_t), 0, 0,
1682 SIDE_TYPE_GATHER_ACCESS_DIRECT
)
1684 TESTSGNESTARRAY_LEN
,
1685 offsetof(struct testgatherstructnest1
, c
),
1686 SIDE_TYPE_GATHER_ACCESS_DIRECT
),
1690 static side_define_struct(mystructgatherstructnest0
,
1692 side_field_gather_signed_integer("a", offsetof(struct testgatherstructnest0
, a
),
1693 side_struct_field_sizeof(struct testgatherstructnest0
, a
), 0, 0,
1694 SIDE_TYPE_GATHER_ACCESS_DIRECT
),
1695 side_field_gather_struct("structnest0", &mystructgatherstructnest1
,
1696 offsetof(struct testgatherstructnest0
, nest
),
1697 sizeof(struct testgatherstructnest1
),
1698 SIDE_TYPE_GATHER_ACCESS_DIRECT
),
1699 side_field_gather_array("nestarray",
1701 side_type_gather_struct(&mystructgatherstructnest1
,
1703 sizeof(struct testgatherstructnest1
),
1704 SIDE_TYPE_GATHER_ACCESS_DIRECT
)
1707 offsetof(struct testgatherstructnest0
, nestarray
),
1708 SIDE_TYPE_GATHER_ACCESS_DIRECT
),
1712 side_static_event(my_provider_event_gatherstructnest
,
1713 "myprovider", "myeventgatherstructnest", SIDE_LOGLEVEL_DEBUG
,
1715 side_field_gather_struct("structgather", &mystructgatherstructnest0
, 0,
1716 sizeof(struct testgatherstructnest0
), SIDE_TYPE_GATHER_ACCESS_DIRECT
),
1721 void test_gather_structnest(void)
1723 side_event_cond(my_provider_event_gatherstructnest
) {
1724 struct testgatherstructnest0 mystruct
= {
1727 .c
= { 0, 1, 2, 3 },
1732 .c
= { 11, 12, 13, 14 },
1736 .c
= { 15, 16, 17, 18 },
1741 side_event_call(my_provider_event_gatherstructnest
,
1743 side_arg_gather_struct(&mystruct
),
1749 uint32_t gathervla
[] = { 1, 2, 3, 4 };
1750 uint32_t gathervla2
[] = { 5, 6, 7, 8, 9 };
1752 struct testgathervla
{
1758 static side_define_struct(mystructgathervla
,
1760 side_field_gather_signed_integer("a", offsetof(struct testgathervla
, a
),
1761 side_struct_field_sizeof(struct testgathervla
, a
), 0, 0,
1762 SIDE_TYPE_GATHER_ACCESS_DIRECT
1764 side_field_gather_vla("nestvla",
1765 side_elem(side_type_gather_unsigned_integer(0, sizeof(uint32_t), 0, 0, SIDE_TYPE_GATHER_ACCESS_DIRECT
)),
1766 offsetof(struct testgathervla
, p
),
1767 SIDE_TYPE_GATHER_ACCESS_POINTER
,
1768 side_length(side_type_gather_unsigned_integer(offsetof(struct testgathervla
, len
),
1769 sizeof(uint16_t), 0, 0, SIDE_TYPE_GATHER_ACCESS_DIRECT
))
1774 side_static_event(my_provider_event_gathervla
,
1775 "myprovider", "myeventgathervla", SIDE_LOGLEVEL_DEBUG
,
1777 side_field_gather_struct("structgathervla", &mystructgathervla
, 0,
1778 sizeof(struct testgathervla
), SIDE_TYPE_GATHER_ACCESS_DIRECT
),
1779 side_field_gather_vla("vla",
1780 side_elem(side_type_gather_unsigned_integer(0, sizeof(uint32_t), 0, 0, SIDE_TYPE_GATHER_ACCESS_DIRECT
)),
1781 0, SIDE_TYPE_GATHER_ACCESS_DIRECT
,
1782 side_length(side_type_gather_unsigned_integer(0, sizeof(uint16_t), 0, 0, SIDE_TYPE_GATHER_ACCESS_DIRECT
))
1788 void test_gather_vla(void)
1790 side_event_cond(my_provider_event_gathervla
) {
1791 struct testgathervla mystruct
= {
1793 .len
= SIDE_ARRAY_SIZE(gathervla
),
1796 uint16_t vla2_len
= 5;
1797 side_event_call(my_provider_event_gathervla
,
1799 side_arg_gather_struct(&mystruct
),
1800 side_arg_gather_vla(gathervla2
, &vla2_len
),
1806 struct testgathervlaflex
{
1808 uint32_t otherfield
;
1812 static side_define_struct(mystructgathervlaflex
,
1814 side_field_gather_vla("vlaflex",
1815 side_elem(side_type_gather_unsigned_integer(0, sizeof(uint64_t), 0, 0, SIDE_TYPE_GATHER_ACCESS_DIRECT
)),
1816 offsetof(struct testgathervlaflex
, array
),
1817 SIDE_TYPE_GATHER_ACCESS_DIRECT
,
1818 side_length(side_type_gather_unsigned_integer(offsetof(struct testgathervlaflex
, len
),
1819 side_struct_field_sizeof(struct testgathervlaflex
, len
), 0, 0, SIDE_TYPE_GATHER_ACCESS_DIRECT
))
1824 side_static_event(my_provider_event_gathervlaflex
,
1825 "myprovider", "myeventgathervlaflex", SIDE_LOGLEVEL_DEBUG
,
1827 side_field_gather_struct("structgathervlaflex", &mystructgathervlaflex
, 0,
1828 sizeof(struct testgathervlaflex
), SIDE_TYPE_GATHER_ACCESS_DIRECT
)
1832 #define VLAFLEXLEN 6
1834 void test_gather_vla_flex(void)
1836 side_event_cond(my_provider_event_gathervlaflex
) {
1837 struct testgathervlaflex
*mystruct
=
1838 (struct testgathervlaflex
*) malloc(sizeof(*mystruct
) + VLAFLEXLEN
* sizeof(uint64_t));
1840 mystruct
->len
= VLAFLEXLEN
;
1841 mystruct
->otherfield
= 0;
1842 mystruct
->array
[0] = 1;
1843 mystruct
->array
[1] = 2;
1844 mystruct
->array
[2] = 3;
1845 mystruct
->array
[3] = 4;
1846 mystruct
->array
[4] = 5;
1847 mystruct
->array
[5] = 6;
1848 side_event_call(my_provider_event_gathervlaflex
,
1850 side_arg_gather_struct(mystruct
),
1857 side_static_event(my_provider_event_gatherbyte
,
1858 "myprovider", "myeventgatherbyte", SIDE_LOGLEVEL_DEBUG
,
1860 side_field_gather_byte("byte", 0, SIDE_TYPE_GATHER_ACCESS_DIRECT
),
1861 side_field_gather_array("array",
1862 side_elem(side_type_gather_byte(0, SIDE_TYPE_GATHER_ACCESS_DIRECT
)),
1863 3, 0, SIDE_TYPE_GATHER_ACCESS_DIRECT
1869 void test_gather_byte(void)
1871 side_event_cond(my_provider_event_gatherbyte
) {
1873 uint8_t array
[3] = { 0x1, 0x2, 0x3 };
1875 side_event_call(my_provider_event_gatherbyte
,
1877 side_arg_gather_byte(&v
),
1878 side_arg_gather_array(array
),
1884 #define ARRAYBOOLLEN 4
1885 static bool arraybool
[ARRAYBOOLLEN
] = { false, true, false, true };
1887 side_static_event(my_provider_event_gatherbool
,
1888 "myprovider", "myeventgatherbool", SIDE_LOGLEVEL_DEBUG
,
1890 side_field_gather_bool("v1_true", 0, sizeof(bool), 0, 0,
1891 SIDE_TYPE_GATHER_ACCESS_DIRECT
),
1892 side_field_gather_bool("v2_false", 0, sizeof(bool), 0, 0,
1893 SIDE_TYPE_GATHER_ACCESS_DIRECT
),
1894 side_field_gather_bool("v3_true", 0, sizeof(uint16_t), 1, 1,
1895 SIDE_TYPE_GATHER_ACCESS_DIRECT
),
1896 side_field_gather_bool("v4_false", 0, sizeof(uint16_t), 1, 1,
1897 SIDE_TYPE_GATHER_ACCESS_DIRECT
),
1898 side_field_gather_array("arraybool",
1899 side_elem(side_type_gather_bool(0, sizeof(bool), 0, 0,
1900 SIDE_TYPE_GATHER_ACCESS_DIRECT
)),
1901 ARRAYBOOLLEN
, 0, SIDE_TYPE_GATHER_ACCESS_DIRECT
1907 void test_gather_bool(void)
1909 side_event_cond(my_provider_event_structgatherarray
) {
1912 uint16_t v3
= 1U << 1;
1913 uint16_t v4
= 1U << 2;
1915 side_event_call(my_provider_event_gatherbool
,
1917 side_arg_gather_bool(&v1
),
1918 side_arg_gather_bool(&v2
),
1919 side_arg_gather_bool(&v3
),
1920 side_arg_gather_bool(&v4
),
1921 side_arg_gather_array(arraybool
),
1927 side_static_event(my_provider_event_gatherpointer
,
1928 "myprovider", "myeventgatherpointer", SIDE_LOGLEVEL_DEBUG
,
1930 side_field_gather_pointer("ptr", 0, SIDE_TYPE_GATHER_ACCESS_DIRECT
),
1931 side_field_gather_array("array",
1932 side_elem(side_type_gather_pointer(0, SIDE_TYPE_GATHER_ACCESS_DIRECT
)),
1933 3, 0, SIDE_TYPE_GATHER_ACCESS_DIRECT
1939 void test_gather_pointer(void)
1941 side_event_cond(my_provider_event_structgatherarray
) {
1942 void *v
= (void *)0x44;
1943 void *array
[3] = { (void *)0x1, (void *)0x2, (void *)0x3 };
1945 side_event_call(my_provider_event_gatherpointer
,
1947 side_arg_gather_pointer(&v
),
1948 side_arg_gather_array(array
),
1954 static side_define_enum(myenumgather
,
1955 side_enum_mapping_list(
1956 side_enum_mapping_range("one-ten", 1, 10),
1957 side_enum_mapping_range("100-200", 100, 200),
1958 side_enum_mapping_value("200", 200),
1959 side_enum_mapping_value("300", 300),
1963 side_static_event(my_provider_event_enum_gather
, "myprovider", "myeventenumgather", SIDE_LOGLEVEL_DEBUG
,
1965 side_field_gather_enum("5", &myenumgather
,
1967 side_type_gather_unsigned_integer(0, sizeof(uint32_t), 0, 0,
1968 SIDE_TYPE_GATHER_ACCESS_DIRECT
)
1971 side_field_gather_enum("400", &myenumgather
,
1973 side_type_gather_unsigned_integer(0, sizeof(uint64_t), 0, 0,
1974 SIDE_TYPE_GATHER_ACCESS_DIRECT
)
1977 side_field_gather_enum("200", &myenumgather
,
1979 side_type_gather_unsigned_integer(0, sizeof(uint8_t), 0, 0,
1980 SIDE_TYPE_GATHER_ACCESS_DIRECT
)
1983 side_field_gather_enum("-100", &myenumgather
,
1985 side_type_gather_signed_integer(0, sizeof(int8_t), 0, 0,
1986 SIDE_TYPE_GATHER_ACCESS_DIRECT
)
1989 side_field_gather_enum("6_be", &myenumgather
,
1991 side_type_gather_unsigned_integer_be(0, sizeof(uint32_t), 0, 0,
1992 SIDE_TYPE_GATHER_ACCESS_DIRECT
)
1995 side_field_gather_enum("6_le", &myenumgather
,
1997 side_type_gather_unsigned_integer_le(0, sizeof(uint32_t), 0, 0,
1998 SIDE_TYPE_GATHER_ACCESS_DIRECT
)
2005 void test_gather_enum(void)
2011 #if SIDE_BYTE_ORDER == SIDE_LITTLE_ENDIAN
2012 uint32_t v5
= side_bswap_32(6);
2016 uint32_t v6
= side_bswap_32(6);
2019 side_event(my_provider_event_enum_gather
,
2021 side_arg_gather_integer(&v1
),
2022 side_arg_gather_integer(&v2
),
2023 side_arg_gather_integer(&v3
),
2024 side_arg_gather_integer(&v4
),
2025 side_arg_gather_integer(&v5
),
2026 side_arg_gather_integer(&v6
),
2031 side_static_event(my_provider_event_gatherstring
,
2032 "myprovider", "myeventgatherstring", SIDE_LOGLEVEL_DEBUG
,
2034 side_field_gather_string("string", 0, SIDE_TYPE_GATHER_ACCESS_DIRECT
),
2035 side_field_gather_array("arrayptr",
2036 side_elem(side_type_gather_string(0, SIDE_TYPE_GATHER_ACCESS_POINTER
)),
2037 3, 0, SIDE_TYPE_GATHER_ACCESS_DIRECT
2039 side_field_gather_array("array",
2040 side_elem(side_type_gather_string(0, SIDE_TYPE_GATHER_ACCESS_DIRECT
)),
2041 3, 0, SIDE_TYPE_GATHER_ACCESS_DIRECT
2047 void test_gather_string(void)
2049 side_event_cond(my_provider_event_gatherstring
) {
2050 const char *str1
= "abcdef";
2051 const char *ptrarray
[3] = {
2056 char flatarray
[] = { 'a', 'b', '\0', 'c', 'd', '\0', 'e', 'f', '\0' };
2058 side_event_call(my_provider_event_gatherstring
,
2060 side_arg_gather_string(str1
),
2061 side_arg_gather_array(ptrarray
),
2062 side_arg_gather_array(flatarray
),
2068 side_static_event(my_provider_event_str_utf
, "myprovider", "myevent_str_utf", SIDE_LOGLEVEL_DEBUG
,
2070 side_field_string("utf8"),
2071 side_field_string32("utf32"),
2072 side_field_string16("utf16"),
2073 side_field_string32_le("utf32_le"),
2074 side_field_string16_le("utf16_le"),
2075 side_field_string32_be("utf32_be"),
2076 side_field_string16_be("utf16_be"),
2077 side_field_dynamic("dynamic_utf32"),
2078 side_field_gather_string32("gather_utf32", 0, SIDE_TYPE_GATHER_ACCESS_DIRECT
),
2083 void test_string_utf(void)
2086 * Character '®' is:
2089 * UTF-32: U+000000ae
2091 uint8_t str8
[] = { 0xc2, 0xae, 'a', 'b', 'c', 0 };
2092 uint32_t str32
[] = { 0x000000ae, 'a', 'b', 'c', 0 };
2093 uint16_t str16
[] = { 0x00ae, 'a', 'b', 'c', 0 };
2094 #if SIDE_BYTE_ORDER == SIDE_LITTLE_ENDIAN
2095 uint32_t str32_le
[] = { 0x000000ae, 'a', 'b', 'c', 0 };
2096 uint16_t str16_le
[] = { 0x00ae, 'a', 'b', 'c', 0 };
2097 uint32_t str32_be
[] = { side_bswap_32(0x000000ae), side_bswap_32('a'), side_bswap_32('b'), side_bswap_32('c'), 0 };
2098 uint16_t str16_be
[] = { side_bswap_16(0x00ae), side_bswap_16('a'), side_bswap_16('b'), side_bswap_16('c'), 0 };
2100 uint32_t str32_le
[] = { side_bswap_32(0x000000ae), side_bswap_32('a'), side_bswap_32('b'), side_bswap_32('c'), 0 };
2101 uint16_t str16_le
[] = { side_bswap_16(0x00ae), side_bswap_16('a'), side_bswap_16('b'), side_bswap_16('c'), 0 };
2102 uint32_t str32_be
[] = { 0x000000ae, 'a', 'b', 'c', 0 };
2103 uint16_t str16_be
[] = { 0x00ae, 'a', 'b', 'c', 0 };
2106 side_event(my_provider_event_str_utf
,
2108 side_arg_string(str8
),
2109 side_arg_string32(str32
),
2110 side_arg_string16(str16
),
2111 side_arg_string32(str32_le
),
2112 side_arg_string16(str16_le
),
2113 side_arg_string32(str32_be
),
2114 side_arg_string16(str16_be
),
2115 side_arg_dynamic_string32(str32
),
2116 side_arg_gather_string(str32
),
2121 static side_define_variant(myvariantdef
,
2124 side_option_range(1, 3, side_type_u16()),
2125 side_option(5, side_type_string()),
2129 side_static_event(my_provider_event_variant
, "myprovider", "myeventvariant", SIDE_LOGLEVEL_DEBUG
,
2131 side_field_variant("variant1", &myvariantdef
),
2132 side_field_variant("variant2", &myvariantdef
),
2138 void test_variant(void)
2140 side_event_cond(my_provider_event_variant
) {
2141 side_arg_define_variant(myvariant1
, side_arg_u32(2), side_arg_u16(4));
2142 side_arg_define_variant(myvariant2
, side_arg_u32(5), side_arg_string("abc"));
2144 side_event_call(my_provider_event_variant
,
2146 side_arg_variant(&myvariant1
),
2147 side_arg_variant(&myvariant2
),
2154 #ifdef __SIZEOF_INT128__
2155 side_static_event(my_provider_event_integer128
, "myprovider", "myevent_integer128", SIDE_LOGLEVEL_DEBUG
,
2157 side_field_s128("signed128_base2", side_attr_list(side_attr("std.integer.base", side_attr_u8(2)))),
2158 side_field_u128("unsigned128_base2", side_attr_list(side_attr("std.integer.base", side_attr_u8(2)))),
2159 side_field_s128("signed128_base8", side_attr_list(side_attr("std.integer.base", side_attr_u8(8)))),
2160 side_field_u128("unsigned128_base8", side_attr_list(side_attr("std.integer.base", side_attr_u8(8)))),
2161 side_field_s128("signed128_base10", side_attr_list(side_attr("std.integer.base", side_attr_u8(10)))),
2162 side_field_u128("unsigned128_base10", side_attr_list(side_attr("std.integer.base", side_attr_u8(10)))),
2163 side_field_s128("signed128_base16", side_attr_list(side_attr("std.integer.base", side_attr_u8(16)))),
2164 side_field_u128("unsigned128_base16", side_attr_list(side_attr("std.integer.base", side_attr_u8(16)))),
2169 void test_integer128(void)
2171 side_event_cond(my_provider_event_integer128
) {
2172 __int128 s_v128
= 0;
2173 unsigned __int128 u_v128
;
2178 /* Maximum unsigned 128-bit value: 340282366920938463463374607431768211455. */
2181 side_event_call(my_provider_event_integer128
,
2183 side_arg_s128(s_v128
),
2184 side_arg_u128(u_v128
),
2185 side_arg_s128(s_v128
),
2186 side_arg_u128(u_v128
),
2187 side_arg_s128(s_v128
),
2188 side_arg_u128(u_v128
),
2189 side_arg_s128(s_v128
),
2190 side_arg_u128(u_v128
),
2194 side_event_cond(my_provider_event_integer128
) {
2195 __int128 s_v128
= 0;
2196 unsigned __int128 u_v128
;
2198 /* Minimum signed 128-bit value: -170141183460469231731687303715884105728 */
2204 side_event_call(my_provider_event_integer128
,
2206 side_arg_s128(s_v128
),
2207 side_arg_u128(u_v128
),
2208 side_arg_s128(s_v128
),
2209 side_arg_u128(u_v128
),
2210 side_arg_s128(s_v128
),
2211 side_arg_u128(u_v128
),
2212 side_arg_s128(s_v128
),
2213 side_arg_u128(u_v128
),
2217 side_event_cond(my_provider_event_integer128
) {
2218 __int128 s_v128
= 0;
2219 unsigned __int128 u_v128
;
2221 /* Minimum signed 128-bit value + 1: -170141183460469231731687303715884105727 */
2226 /* INT64_MAX + 1. */
2227 u_v128
= INT64_MAX
; /* 9223372036854775807LL */
2229 side_event_call(my_provider_event_integer128
,
2231 side_arg_s128(s_v128
),
2232 side_arg_u128(u_v128
),
2233 side_arg_s128(s_v128
),
2234 side_arg_u128(u_v128
),
2235 side_arg_s128(s_v128
),
2236 side_arg_u128(u_v128
),
2237 side_arg_s128(s_v128
),
2238 side_arg_u128(u_v128
),
2245 void test_integer128(void)
2254 test_event_hidden();
2255 test_event_export();
2256 test_struct_literal();
2261 test_vla_visitor_2d();
2262 test_dynamic_basic_type();
2264 test_dynamic_null();
2265 test_dynamic_struct();
2266 test_dynamic_nested_struct();
2267 test_dynamic_vla_struct();
2268 test_dynamic_struct_vla();
2269 test_dynamic_nested_vla();
2271 test_static_variadic();
2273 test_dynamic_bool();
2274 test_dynamic_vla_with_visitor();
2275 test_dynamic_struct_with_visitor();
2276 test_event_user_attribute();
2277 test_field_user_attribute();
2278 test_variadic_attr();
2279 test_variadic_vla_attr();
2280 test_variadic_struct_attr();
2282 test_variadic_float();
2289 test_struct_gather();
2290 test_struct_gather_nest_ptr();
2291 test_struct_gather_float();
2292 test_array_gather();
2293 test_gather_structnest();
2295 test_gather_vla_flex();
2298 test_gather_pointer();
2300 test_gather_string();