}
}
-static int64_t array_fixint[] = { -444, 555, 123, 2897432587 };
-
-side_static_event(my_provider_event_array_fixint, "myprovider", "myarrayfixint", SIDE_LOGLEVEL_DEBUG,
- side_field_list(
- side_field_array("arrfixint", side_elem(side_type_s64(side_attr_list())), SIDE_ARRAY_SIZE(array_fixint), side_attr_list()),
- side_field_s64("v", side_attr_list()),
- ),
- side_attr_list()
-);
-
-static
-void test_array_fixint(void)
-{
- side_event(my_provider_event_array_fixint,
- side_arg_list(side_arg_array_s64(array_fixint), side_arg_s64(42)));
-}
-
-static int64_t vla_fixint[] = { -444, 555, 123, 2897432587 };
-
-side_static_event(my_provider_event_vla_fixint, "myprovider", "myvlafixint", SIDE_LOGLEVEL_DEBUG,
- side_field_list(
- side_field_vla("vlafixint", side_elem(side_type_s64(side_attr_list())), side_attr_list()),
- side_field_s64("v", side_attr_list()),
- ),
- side_attr_list()
-);
-
-static
-void test_vla_fixint(void)
-{
- side_event(my_provider_event_vla_fixint,
- side_arg_list(side_arg_vla_s64(vla_fixint, SIDE_ARRAY_SIZE(vla_fixint)), side_arg_s64(42)));
-}
-
side_static_event(my_provider_event_dynamic_basic,
"myprovider", "mydynamicbasic", SIDE_LOGLEVEL_DEBUG,
side_field_list(
};
static
-enum side_visitor_status test_dynamic_vla_visitor(const struct side_tracer_dynamic_vla_visitor_ctx *tracer_ctx, void *_ctx)
+enum side_visitor_status test_dynamic_vla_visitor(const struct side_tracer_visitor_ctx *tracer_ctx, void *_ctx)
{
struct app_dynamic_vla_visitor_ctx *ctx = (struct app_dynamic_vla_visitor_ctx *) _ctx;
uint32_t length = ctx->length, i;
for (i = 0; i < length; i++) {
- const struct side_arg elem = {
- .type = SIDE_TYPE_DYNAMIC_U32,
- .u = {
- .side_dynamic = {
- .side_integer = {
- .type = {
- .attr = NULL,
- .nr_attr = 0,
- .integer_size_bits = 32,
- .len_bits = 32,
- .signedness = false,
- .byte_order = SIDE_TYPE_BYTE_ORDER_HOST,
- },
- .value = {
- .side_u32 = ctx->ptr[i],
- },
- },
- },
- },
- };
+ const struct side_arg elem = side_arg_dynamic_u32(ctx->ptr[i], side_attr_list());
if (tracer_ctx->write_elem(tracer_ctx, &elem) != SIDE_VISITOR_STATUS_OK)
return SIDE_VISITOR_STATUS_ERROR;
}
uint32_t length = ctx->length, i;
for (i = 0; i < length; i++) {
- struct side_arg_dynamic_event_field dynamic_field = {
+ struct side_arg_dynamic_field dynamic_field = {
.field_name = ctx->ptr[i].name,
- .elem = {
- .type = SIDE_TYPE_DYNAMIC_U32,
- .u = {
- .side_dynamic = {
- .side_integer = {
- .type = {
- .attr = NULL,
- .nr_attr = 0,
- .integer_size_bits = 32,
- .len_bits = 32,
- .signedness = false,
- .byte_order = SIDE_TYPE_BYTE_ORDER_HOST,
- },
- .value = {
- .side_u32 = ctx->ptr[i].value,
- },
- },
- },
- },
- },
+ .elem = side_arg_dynamic_u32(ctx->ptr[i].value, side_attr_list()),
};
if (tracer_ctx->write_field(tracer_ctx, &dynamic_field) != SIDE_VISITOR_STATUS_OK)
return SIDE_VISITOR_STATUS_ERROR;
side_arg_u32(side_bswap_32(6)),
side_arg_u32(6),
#else
- side_arg_u32(side_bswap_32(6)),
side_arg_u32(6),
+ side_arg_u32(side_bswap_32(6)),
#endif
)
);
);
side_event_call(my_provider_event_enum_bitmap,
side_arg_list(
- side_arg_u32(1 << 0),
- side_arg_u32(1 << 1),
- side_arg_u8(1 << 2),
- side_arg_u8(1 << 3),
- side_arg_u32(1 << 30),
- side_arg_u32(1 << 31),
+ side_arg_u32(1U << 0),
+ side_arg_u32(1U << 1),
+ side_arg_u8(1U << 2),
+ side_arg_u8(1U << 3),
+ side_arg_u32(1U << 30),
+ side_arg_u32(1U << 31),
side_arg_u64(1ULL << 63),
side_arg_u64((1ULL << 1) | (1ULL << 63)),
- side_arg_byte(1 << 2),
+ side_arg_byte(1U << 2),
side_arg_array(&myarray),
side_arg_vla(&myarray),
#if SIDE_BYTE_ORDER == SIDE_LITTLE_ENDIAN
- side_arg_u32(side_bswap_32(1 << 2)),
- side_arg_u32(1 << 2),
+ side_arg_u32(side_bswap_32(1U << 2)),
+ side_arg_u32(1U << 2),
#else
- side_arg_u32(0x06000000),
- side_arg_u32(side_bswap_32(1 << 2)),
+ side_arg_u32(1U << 2),
+ side_arg_u32(side_bswap_32(1U << 2)),
#endif
)
);
}
}
-static uint8_t blob_fixint[] = { 0x55, 0x44, 0x33, 0x22, 0x11 };
-
side_static_event_variadic(my_provider_event_blob, "myprovider", "myeventblob", SIDE_LOGLEVEL_DEBUG,
side_field_list(
side_field_byte("blobfield", side_attr_list()),
side_field_array("arrayblob", side_elem(side_type_byte(side_attr_list())), 3, side_attr_list()),
- side_field_array("arrayblobfix", side_elem(side_type_byte(side_attr_list())), SIDE_ARRAY_SIZE(blob_fixint), side_attr_list()),
- side_field_vla("vlablobfix", side_elem(side_type_byte(side_attr_list())), side_attr_list()),
),
side_attr_list()
);
side_arg_list(
side_arg_byte(0x55),
side_arg_array(&myarray),
- side_arg_array_byte(blob_fixint),
- side_arg_vla_byte(blob_fixint, SIDE_ARRAY_SIZE(blob_fixint)),
),
side_arg_list(
side_arg_dynamic_field("varblobfield",
int64_t i;
int64_t j;
int64_t k;
+ uint64_t test;
};
-static side_define_struct_sg(mystructsgdef,
- side_field_sg_list(
- side_field_sg_unsigned_integer("a", offsetof(struct test, a),
- side_struct_field_sizeof_bit(struct test, a), 0,
- side_struct_field_sizeof_bit(struct test, a), side_attr_list()),
- side_field_sg_signed_integer("d", offsetof(struct test, d),
- side_struct_field_sizeof_bit(struct test, d), 0,
- side_struct_field_sizeof_bit(struct test, d), side_attr_list()),
- side_field_sg_unsigned_integer("e", offsetof(struct test, e),
- side_struct_field_sizeof_bit(struct test, e), 8, 4,
- side_attr_list(side_attr("std.integer.base", side_attr_u8(16)))),
- side_field_sg_signed_integer("f", offsetof(struct test, f),
- side_struct_field_sizeof_bit(struct test, f), 1, 4,
- side_attr_list(side_attr("std.integer.base", side_attr_u8(10)))),
- side_field_sg_signed_integer("g", offsetof(struct test, g),
- side_struct_field_sizeof_bit(struct test, g), 11, 4,
- side_attr_list(side_attr("std.integer.base", side_attr_u8(10)))),
- side_field_sg_signed_integer("h", offsetof(struct test, h),
- side_struct_field_sizeof_bit(struct test, h), 1, 31,
- side_attr_list(side_attr("std.integer.base", side_attr_u8(10)))),
- side_field_sg_signed_integer("i", offsetof(struct test, i),
- side_struct_field_sizeof_bit(struct test, i), 33, 20,
- side_attr_list(side_attr("std.integer.base", side_attr_u8(10)))),
- side_field_sg_signed_integer("j", offsetof(struct test, j),
- side_struct_field_sizeof_bit(struct test, j), 63, 1,
- side_attr_list(side_attr("std.integer.base", side_attr_u8(10)))),
- side_field_sg_signed_integer("k", offsetof(struct test, k),
- side_struct_field_sizeof_bit(struct test, k), 1, 63,
- side_attr_list(side_attr("std.integer.base", side_attr_u8(10)))),
- side_field_sg_null("null", side_attr_list()),
+static side_define_struct(mystructgatherdef,
+ side_field_list(
+ side_field_gather_unsigned_integer("a", offsetof(struct test, a),
+ side_struct_field_sizeof(struct test, a), 0, 0,
+ SIDE_TYPE_GATHER_ACCESS_DIRECT, side_attr_list()),
+ side_field_gather_signed_integer("d", offsetof(struct test, d),
+ side_struct_field_sizeof(struct test, d), 0, 0,
+ SIDE_TYPE_GATHER_ACCESS_DIRECT, side_attr_list()),
+ side_field_gather_unsigned_integer("e", offsetof(struct test, e),
+ side_struct_field_sizeof(struct test, e), 8, 4,
+ SIDE_TYPE_GATHER_ACCESS_DIRECT, side_attr_list(side_attr("std.integer.base", side_attr_u8(16)))),
+ side_field_gather_signed_integer("f", offsetof(struct test, f),
+ side_struct_field_sizeof(struct test, f), 1, 4,
+ SIDE_TYPE_GATHER_ACCESS_DIRECT, side_attr_list(side_attr("std.integer.base", side_attr_u8(10)))),
+ side_field_gather_signed_integer("g", offsetof(struct test, g),
+ side_struct_field_sizeof(struct test, g), 11, 4,
+ SIDE_TYPE_GATHER_ACCESS_DIRECT, side_attr_list(side_attr("std.integer.base", side_attr_u8(10)))),
+ side_field_gather_signed_integer("h", offsetof(struct test, h),
+ side_struct_field_sizeof(struct test, h), 1, 31,
+ SIDE_TYPE_GATHER_ACCESS_DIRECT, side_attr_list(side_attr("std.integer.base", side_attr_u8(10)))),
+ side_field_gather_signed_integer("i", offsetof(struct test, i),
+ side_struct_field_sizeof(struct test, i), 33, 20,
+ SIDE_TYPE_GATHER_ACCESS_DIRECT, side_attr_list(side_attr("std.integer.base", side_attr_u8(10)))),
+ side_field_gather_signed_integer("j", offsetof(struct test, j),
+ side_struct_field_sizeof(struct test, j), 63, 1,
+ SIDE_TYPE_GATHER_ACCESS_DIRECT, side_attr_list(side_attr("std.integer.base", side_attr_u8(10)))),
+ side_field_gather_signed_integer("k", offsetof(struct test, k),
+ side_struct_field_sizeof(struct test, k), 1, 63,
+ SIDE_TYPE_GATHER_ACCESS_DIRECT, side_attr_list(side_attr("std.integer.base", side_attr_u8(10)))),
+ side_field_gather_unsigned_integer_le("test", offsetof(struct test, test),
+ side_struct_field_sizeof(struct test, test), 0, 64,
+ SIDE_TYPE_GATHER_ACCESS_DIRECT, side_attr_list(side_attr("std.integer.base", side_attr_u8(16)))),
+ side_field_gather_unsigned_integer_le("test_le", offsetof(struct test, test),
+ side_struct_field_sizeof(struct test, test), 0, 64,
+ SIDE_TYPE_GATHER_ACCESS_DIRECT, side_attr_list(side_attr("std.integer.base", side_attr_u8(16)))),
+ side_field_gather_unsigned_integer_be("test_be", offsetof(struct test, test),
+ side_struct_field_sizeof(struct test, test), 0, 64,
+ SIDE_TYPE_GATHER_ACCESS_DIRECT, side_attr_list(side_attr("std.integer.base", side_attr_u8(16)))),
),
side_attr_list()
);
-side_static_event(my_provider_event_structsg, "myprovider", "myeventstructsg", SIDE_LOGLEVEL_DEBUG,
+side_static_event(my_provider_event_structgather, "myprovider", "myeventstructgather", SIDE_LOGLEVEL_DEBUG,
side_field_list(
- side_field_struct_sg("structsg", &mystructsgdef),
+ side_field_gather_struct("structgather", &mystructgatherdef, 0, sizeof(struct test),
+ SIDE_TYPE_GATHER_ACCESS_DIRECT),
+ side_field_gather_signed_integer("intgather", 0, sizeof(int32_t), 0, 0, SIDE_TYPE_GATHER_ACCESS_DIRECT,
+ side_attr_list(side_attr("std.integer.base", side_attr_u8(10)))),
+#if __HAVE_FLOAT32
+ side_field_gather_float("f32", 0, sizeof(_Float32), SIDE_TYPE_GATHER_ACCESS_DIRECT, side_attr_list()),
+#endif
),
side_attr_list()
);
static
-void test_struct_sg(void)
+void test_struct_gather(void)
{
- side_event_cond(my_provider_event_structsg) {
+ side_event_cond(my_provider_event_structgather) {
struct test mystruct = {
.a = 55,
.b = 123,
.i = -1,
.j = -1,
.k = -1,
+ .test = 0xFF,
+ };
+ int32_t val = -66;
+#if __HAVE_FLOAT32
+ _Float32 f32 = 1.1;
+#endif
+ side_event_call(my_provider_event_structgather,
+ side_arg_list(
+ side_arg_gather_struct(&mystruct),
+ side_arg_gather_integer(&val),
+#if __HAVE_FLOAT32
+ side_arg_gather_float(&f32),
+#endif
+ )
+ );
+ }
+}
+
+struct testnest2 {
+ uint8_t c;
+};
+
+struct testnest1 {
+ uint64_t b;
+ struct testnest2 *nest;
+};
+
+struct testnest0 {
+ uint32_t a;
+ struct testnest1 *nest;
+};
+
+static side_define_struct(mystructgathernest2,
+ side_field_list(
+ side_field_gather_unsigned_integer("c", offsetof(struct testnest2, c),
+ side_struct_field_sizeof(struct testnest2, c), 0, 0,
+ SIDE_TYPE_GATHER_ACCESS_DIRECT, side_attr_list()),
+ ),
+ side_attr_list()
+);
+
+static side_define_struct(mystructgathernest1,
+ side_field_list(
+ side_field_gather_unsigned_integer("b", offsetof(struct testnest1, b),
+ side_struct_field_sizeof(struct testnest1, b), 0, 0,
+ SIDE_TYPE_GATHER_ACCESS_DIRECT, side_attr_list()),
+ side_field_gather_struct("nest2", &mystructgathernest2,
+ offsetof(struct testnest1, nest), sizeof(struct testnest2),
+ SIDE_TYPE_GATHER_ACCESS_POINTER),
+ ),
+ side_attr_list()
+);
+
+static side_define_struct(mystructgathernest0,
+ side_field_list(
+ side_field_gather_unsigned_integer("a", offsetof(struct testnest0, a),
+ side_struct_field_sizeof(struct testnest0, a), 0, 0,
+ SIDE_TYPE_GATHER_ACCESS_DIRECT, side_attr_list()),
+ side_field_gather_struct("nest1", &mystructgathernest1,
+ offsetof(struct testnest0, nest), sizeof(struct testnest1),
+ SIDE_TYPE_GATHER_ACCESS_POINTER),
+ ),
+ side_attr_list()
+);
+
+side_static_event(my_provider_event_structgather_nest,
+ "myprovider", "myeventstructgathernest", SIDE_LOGLEVEL_DEBUG,
+ side_field_list(
+ side_field_gather_struct("nest0", &mystructgathernest0, 0,
+ sizeof(struct testnest0), SIDE_TYPE_GATHER_ACCESS_DIRECT),
+ ),
+ side_attr_list()
+);
+
+static
+void test_struct_gather_nest_ptr(void)
+{
+ side_event_cond(my_provider_event_structgather_nest) {
+ struct testnest2 mystruct2 = {
+ .c = 77,
+ };
+ struct testnest1 mystruct1 = {
+ .b = 66,
+ .nest = &mystruct2,
};
- side_event_call(my_provider_event_structsg, side_arg_list(side_arg_struct_sg(&mystruct)));
+ struct testnest0 mystruct = {
+ .a = 55,
+ .nest = &mystruct1,
+ };
+ side_event_call(my_provider_event_structgather_nest,
+ side_arg_list(
+ side_arg_gather_struct(&mystruct),
+ )
+ );
}
}
+struct testfloat {
+#if __HAVE_FLOAT16
+ _Float16 f16;
+#endif
+#if __HAVE_FLOAT32
+ _Float32 f32;
+#endif
+#if __HAVE_FLOAT64
+ _Float64 f64;
+#endif
+#if __HAVE_FLOAT128
+ _Float128 f128;
+#endif
+};
+
+static side_define_struct(mystructgatherfloat,
+ side_field_list(
+#if __HAVE_FLOAT16
+ side_field_gather_float("f16", offsetof(struct testfloat, f16), side_struct_field_sizeof(struct testfloat, f16),
+ SIDE_TYPE_GATHER_ACCESS_DIRECT,
+ side_attr_list()),
+#endif
+#if __HAVE_FLOAT32
+ side_field_gather_float("f32", offsetof(struct testfloat, f32), side_struct_field_sizeof(struct testfloat, f32),
+ SIDE_TYPE_GATHER_ACCESS_DIRECT,
+ side_attr_list()),
+#endif
+#if __HAVE_FLOAT64
+ side_field_gather_float("f64", offsetof(struct testfloat, f64), side_struct_field_sizeof(struct testfloat, f64),
+ SIDE_TYPE_GATHER_ACCESS_DIRECT,
+ side_attr_list()),
+#endif
+#if __HAVE_FLOAT128
+ side_field_gather_float("f128", offsetof(struct testfloat, f128), side_struct_field_sizeof(struct testfloat, f128),
+ SIDE_TYPE_GATHER_ACCESS_DIRECT,
+ side_attr_list()),
+#endif
+ ),
+ side_attr_list()
+);
+
+side_static_event(my_provider_event_structgatherfloat,
+ "myprovider", "myeventstructgatherfloat", SIDE_LOGLEVEL_DEBUG,
+ side_field_list(
+ side_field_gather_struct("structgatherfloat", &mystructgatherfloat, 0,
+ sizeof(struct testfloat), SIDE_TYPE_GATHER_ACCESS_DIRECT),
+ ),
+ side_attr_list()
+);
+
+static
+void test_struct_gather_float(void)
+{
+ side_event_cond(my_provider_event_structgatherfloat) {
+ struct testfloat mystruct = {
+#if __HAVE_FLOAT16
+ .f16 = 1.1,
+#endif
+#if __HAVE_FLOAT32
+ .f32 = 2.2,
+#endif
+#if __HAVE_FLOAT64
+ .f64 = 3.3,
+#endif
+#if __HAVE_FLOAT128
+ .f128 = 4.4,
+#endif
+ };
+ side_event_call(my_provider_event_structgatherfloat,
+ side_arg_list(
+ side_arg_gather_struct(&mystruct),
+ )
+ );
+ }
+}
+
+uint32_t mygatherarray[] = { 1, 2, 3, 4, 5 };
+
+uint16_t mygatherarray2[] = { 6, 7, 8, 9 };
+
+struct testarray {
+ int a;
+ uint32_t *ptr;
+};
+
+static side_define_struct(mystructgatherarray,
+ side_field_list(
+ side_field_gather_array("array",
+ side_elem(side_type_gather_unsigned_integer(0, sizeof(uint32_t), 0, 0, SIDE_TYPE_GATHER_ACCESS_DIRECT, side_attr_list())),
+ SIDE_ARRAY_SIZE(mygatherarray),
+ offsetof(struct testarray, ptr),
+ SIDE_TYPE_GATHER_ACCESS_POINTER,
+ side_attr_list()),
+ ),
+ side_attr_list()
+);
+
+side_static_event(my_provider_event_structgatherarray,
+ "myprovider", "myeventstructgatherarray", SIDE_LOGLEVEL_DEBUG,
+ side_field_list(
+ side_field_gather_struct("structgatherarray", &mystructgatherarray, 0,
+ sizeof(struct testarray), SIDE_TYPE_GATHER_ACCESS_DIRECT),
+ side_field_gather_array("array2",
+ side_elem(side_type_gather_unsigned_integer(0, sizeof(uint16_t), 0, 0, SIDE_TYPE_GATHER_ACCESS_DIRECT, side_attr_list())),
+ SIDE_ARRAY_SIZE(mygatherarray2), 0,
+ SIDE_TYPE_GATHER_ACCESS_DIRECT,
+ side_attr_list()
+ ),
+ ),
+ side_attr_list()
+);
+
+static
+void test_array_gather(void)
+{
+ side_event_cond(my_provider_event_structgatherarray) {
+ struct testarray mystruct = {
+ .a = 55,
+ .ptr = mygatherarray,
+ };
+ side_event_call(my_provider_event_structgatherarray,
+ side_arg_list(
+ side_arg_gather_struct(&mystruct),
+ side_arg_gather_array(&mygatherarray2),
+ )
+ );
+ }
+}
+
+#define TESTSGNESTARRAY_LEN 4
+struct testgatherstructnest1 {
+ int b;
+ int c[TESTSGNESTARRAY_LEN];
+};
+
+struct testgatherstructnest0 {
+ struct testgatherstructnest1 nest;
+ struct testgatherstructnest1 nestarray[2];
+ int a;
+};
+
+static side_define_struct(mystructgatherstructnest1,
+ side_field_list(
+ side_field_gather_signed_integer("b", offsetof(struct testgatherstructnest1, b),
+ side_struct_field_sizeof(struct testgatherstructnest1, b), 0, 0,
+ SIDE_TYPE_GATHER_ACCESS_DIRECT, side_attr_list()),
+ side_field_gather_array("c",
+ side_elem(
+ side_type_gather_signed_integer(0, sizeof(uint32_t), 0, 0,
+ SIDE_TYPE_GATHER_ACCESS_DIRECT, side_attr_list()),
+ ),
+ TESTSGNESTARRAY_LEN,
+ offsetof(struct testgatherstructnest1, c),
+ SIDE_TYPE_GATHER_ACCESS_DIRECT,
+ side_attr_list()),
+ ),
+ side_attr_list()
+);
+
+static side_define_struct(mystructgatherstructnest0,
+ side_field_list(
+ side_field_gather_signed_integer("a", offsetof(struct testgatherstructnest0, a),
+ side_struct_field_sizeof(struct testgatherstructnest0, a), 0, 0,
+ SIDE_TYPE_GATHER_ACCESS_DIRECT, side_attr_list()),
+ side_field_gather_struct("structnest0", &mystructgatherstructnest1,
+ offsetof(struct testgatherstructnest0, nest),
+ sizeof(struct testgatherstructnest1),
+ SIDE_TYPE_GATHER_ACCESS_DIRECT),
+ side_field_gather_array("nestarray",
+ side_elem(
+ side_type_gather_struct(&mystructgatherstructnest1,
+ 0,
+ sizeof(struct testgatherstructnest1),
+ SIDE_TYPE_GATHER_ACCESS_DIRECT),
+ ),
+ 2,
+ offsetof(struct testgatherstructnest0, nestarray),
+ SIDE_TYPE_GATHER_ACCESS_DIRECT,
+ side_attr_list()),
+ ),
+ side_attr_list()
+);
+
+side_static_event(my_provider_event_gatherstructnest,
+ "myprovider", "myeventgatherstructnest", SIDE_LOGLEVEL_DEBUG,
+ side_field_list(
+ side_field_gather_struct("structgather", &mystructgatherstructnest0, 0,
+ sizeof(struct testgatherstructnest0), SIDE_TYPE_GATHER_ACCESS_DIRECT),
+ ),
+ side_attr_list()
+);
+
+static
+void test_gather_structnest(void)
+{
+ side_event_cond(my_provider_event_gatherstructnest) {
+ struct testgatherstructnest0 mystruct = {
+ .nest = {
+ .b = 66,
+ .c = { 0, 1, 2, 3 },
+ },
+ .nestarray = {
+ [0] = {
+ .b = 77,
+ .c = { 11, 12, 13, 14 },
+ },
+ [1] = {
+ .b = 88,
+ .c = { 15, 16, 17, 18 },
+ },
+ },
+ .a = 55,
+ };
+ side_event_call(my_provider_event_gatherstructnest,
+ side_arg_list(
+ side_arg_gather_struct(&mystruct),
+ )
+ );
+ }
+}
+
+uint32_t gathervla[] = { 1, 2, 3, 4 };
+uint32_t gathervla2[] = { 5, 6, 7, 8, 9 };
+
+struct testgathervla {
+ int a;
+ uint16_t len;
+ uint32_t *p;
+};
+
+static side_define_struct(mystructgathervla,
+ side_field_list(
+ side_field_gather_signed_integer("a", offsetof(struct testgathervla, a),
+ side_struct_field_sizeof(struct testgathervla, a), 0, 0,
+ SIDE_TYPE_GATHER_ACCESS_DIRECT, side_attr_list()
+ ),
+ side_field_gather_vla("nestvla",
+ side_elem(side_type_gather_unsigned_integer(0, sizeof(uint32_t), 0, 0, SIDE_TYPE_GATHER_ACCESS_DIRECT, side_attr_list())),
+ offsetof(struct testgathervla, p),
+ SIDE_TYPE_GATHER_ACCESS_POINTER,
+ side_length(side_type_gather_unsigned_integer(offsetof(struct testgathervla, len),
+ sizeof(uint16_t), 0, 0, SIDE_TYPE_GATHER_ACCESS_DIRECT, side_attr_list())),
+ side_attr_list()
+ ),
+ ),
+ side_attr_list()
+);
+
+side_static_event(my_provider_event_gathervla,
+ "myprovider", "myeventgathervla", SIDE_LOGLEVEL_DEBUG,
+ side_field_list(
+ side_field_gather_struct("structgathervla", &mystructgathervla, 0,
+ sizeof(struct testgathervla), SIDE_TYPE_GATHER_ACCESS_DIRECT),
+ side_field_gather_vla("vla",
+ side_elem(side_type_gather_unsigned_integer(0, sizeof(uint32_t), 0, 0, SIDE_TYPE_GATHER_ACCESS_DIRECT, side_attr_list())),
+ 0, SIDE_TYPE_GATHER_ACCESS_DIRECT,
+ side_length(side_type_gather_unsigned_integer(0, sizeof(uint16_t), 0, 0, SIDE_TYPE_GATHER_ACCESS_DIRECT, side_attr_list())),
+ side_attr_list()
+ ),
+ ),
+ side_attr_list()
+);
+
+static
+void test_gather_vla(void)
+{
+ side_event_cond(my_provider_event_gathervla) {
+ struct testgathervla mystruct = {
+ .a = 55,
+ .len = SIDE_ARRAY_SIZE(gathervla),
+ .p = gathervla,
+ };
+ uint16_t vla2_len = 5;
+ side_event_call(my_provider_event_gathervla,
+ side_arg_list(
+ side_arg_gather_struct(&mystruct),
+ side_arg_gather_vla(gathervla2, &vla2_len),
+ )
+ );
+ }
+}
+
+struct testgathervlaflex {
+ uint8_t len;
+ uint32_t otherfield;
+ uint64_t array[];
+};
+
+static side_define_struct(mystructgathervlaflex,
+ side_field_list(
+ side_field_gather_vla("vlaflex",
+ side_elem(side_type_gather_unsigned_integer(0, sizeof(uint64_t), 0, 0, SIDE_TYPE_GATHER_ACCESS_DIRECT, side_attr_list())),
+ offsetof(struct testgathervlaflex, array),
+ SIDE_TYPE_GATHER_ACCESS_DIRECT,
+ side_length(side_type_gather_unsigned_integer(offsetof(struct testgathervlaflex, len),
+ side_struct_field_sizeof(struct testgathervlaflex, len), 0, 0, SIDE_TYPE_GATHER_ACCESS_DIRECT, side_attr_list())),
+ side_attr_list()
+ ),
+ ),
+ side_attr_list()
+);
+
+side_static_event(my_provider_event_gathervlaflex,
+ "myprovider", "myeventgathervlaflex", SIDE_LOGLEVEL_DEBUG,
+ side_field_list(
+ side_field_gather_struct("structgathervlaflex", &mystructgathervlaflex, 0,
+ sizeof(struct testgathervlaflex), SIDE_TYPE_GATHER_ACCESS_DIRECT),
+ ),
+ side_attr_list()
+);
+
+#define VLAFLEXLEN 6
+static
+void test_gather_vla_flex(void)
+{
+ side_event_cond(my_provider_event_gathervlaflex) {
+ struct testgathervlaflex *mystruct =
+ (struct testgathervlaflex *) malloc(sizeof(*mystruct) + VLAFLEXLEN + sizeof(uint64_t));
+
+ mystruct->len = VLAFLEXLEN;
+ mystruct->otherfield = 0;
+ mystruct->array[0] = 1;
+ mystruct->array[1] = 2;
+ mystruct->array[2] = 3;
+ mystruct->array[3] = 4;
+ mystruct->array[4] = 5;
+ mystruct->array[5] = 6;
+ side_event_call(my_provider_event_gathervlaflex,
+ side_arg_list(
+ side_arg_gather_struct(mystruct),
+ )
+ );
+ free(mystruct);
+ }
+}
+
+side_static_event(my_provider_event_gatherbyte,
+ "myprovider", "myeventgatherbyte", SIDE_LOGLEVEL_DEBUG,
+ side_field_list(
+ side_field_gather_byte("byte", 0, SIDE_TYPE_GATHER_ACCESS_DIRECT, side_attr_list()),
+ side_field_gather_array("array",
+ side_elem(side_type_gather_byte(0, SIDE_TYPE_GATHER_ACCESS_DIRECT, side_attr_list())),
+ 3, 0, SIDE_TYPE_GATHER_ACCESS_DIRECT, side_attr_list()
+ ),
+ ),
+ side_attr_list()
+);
+
+static
+void test_gather_byte(void)
+{
+ side_event_cond(my_provider_event_structgatherarray) {
+ uint8_t v = 0x44;
+ uint8_t array[3] = { 0x1, 0x2, 0x3 };
+
+ side_event_call(my_provider_event_gatherbyte,
+ side_arg_list(
+ side_arg_gather_byte(&v),
+ side_arg_gather_array(array),
+ )
+ );
+ }
+}
+
+#define ARRAYBOOLLEN 4
+static bool arraybool[ARRAYBOOLLEN] = { false, true, false, true };
+
+side_static_event(my_provider_event_gatherbool,
+ "myprovider", "myeventgatherbool", SIDE_LOGLEVEL_DEBUG,
+ side_field_list(
+ side_field_gather_bool("v1_true", 0, sizeof(bool), 0, 0,
+ SIDE_TYPE_GATHER_ACCESS_DIRECT, side_attr_list()),
+ side_field_gather_bool("v2_false", 0, sizeof(bool), 0, 0,
+ SIDE_TYPE_GATHER_ACCESS_DIRECT, side_attr_list()),
+ side_field_gather_bool("v3_true", 0, sizeof(uint16_t), 1, 1,
+ SIDE_TYPE_GATHER_ACCESS_DIRECT, side_attr_list()),
+ side_field_gather_bool("v4_false", 0, sizeof(uint16_t), 1, 1,
+ SIDE_TYPE_GATHER_ACCESS_DIRECT, side_attr_list()),
+ side_field_gather_array("arraybool",
+ side_elem(side_type_gather_bool(0, sizeof(bool), 0, 0,
+ SIDE_TYPE_GATHER_ACCESS_DIRECT, side_attr_list())),
+ ARRAYBOOLLEN, 0, SIDE_TYPE_GATHER_ACCESS_DIRECT, side_attr_list()
+ ),
+ ),
+ side_attr_list()
+);
+
+static
+void test_gather_bool(void)
+{
+ side_event_cond(my_provider_event_structgatherarray) {
+ bool v1 = true;
+ bool v2 = false;
+ uint16_t v3 = 1U << 1;
+ uint16_t v4 = 1U << 2;
+
+ side_event_call(my_provider_event_gatherbool,
+ side_arg_list(
+ side_arg_gather_bool(&v1),
+ side_arg_gather_bool(&v2),
+ side_arg_gather_bool(&v3),
+ side_arg_gather_bool(&v4),
+ side_arg_gather_array(arraybool),
+ )
+ );
+ }
+}
+
+side_static_event(my_provider_event_gatherpointer,
+ "myprovider", "myeventgatherpointer", SIDE_LOGLEVEL_DEBUG,
+ side_field_list(
+ side_field_gather_pointer("ptr", 0, SIDE_TYPE_GATHER_ACCESS_DIRECT, side_attr_list()),
+ side_field_gather_array("array",
+ side_elem(side_type_gather_pointer(0, SIDE_TYPE_GATHER_ACCESS_DIRECT, side_attr_list())),
+ 3, 0, SIDE_TYPE_GATHER_ACCESS_DIRECT, side_attr_list()
+ ),
+ ),
+ side_attr_list()
+);
+
+static
+void test_gather_pointer(void)
+{
+ side_event_cond(my_provider_event_structgatherarray) {
+ void *v = (void *)0x44;
+ void *array[3] = { (void *)0x1, (void *)0x2, (void *)0x3 };
+
+ side_event_call(my_provider_event_gatherpointer,
+ side_arg_list(
+ side_arg_gather_pointer(&v),
+ side_arg_gather_array(array),
+ )
+ );
+ }
+}
int main()
{
test_fields();
test_vla();
test_vla_visitor();
test_vla_visitor_2d();
- test_array_fixint();
- test_vla_fixint();
test_dynamic_basic_type();
test_dynamic_vla();
test_dynamic_null();
test_fmt_string();
test_endian();
test_base();
- test_struct_sg();
+ test_struct_gather();
+ test_struct_gather_nest_ptr();
+ test_struct_gather_float();
+ test_array_gather();
+ test_gather_structnest();
+ test_gather_vla();
+ test_gather_vla_flex();
+ test_gather_byte();
+ test_gather_bool();
+ test_gather_pointer();
return 0;
}