static
void tracer_print_vla_visitor(const struct side_type *type_desc, void *app_ctx);
static
-void tracer_print_array_fixint(const struct side_type *type_desc, const struct side_arg *item);
-static
-void tracer_print_vla_fixint(const struct side_type *type_desc, const struct side_arg *item);
-static
void tracer_print_dynamic(const struct side_arg *dynamic_item);
static
uint32_t tracer_print_gather_bool_type(const struct side_type_gather *type_gather, const void *_ptr);
enum side_type_label type;
switch (type_desc->type) {
- case SIDE_TYPE_ARRAY:
- switch (item->type) {
- case SIDE_TYPE_ARRAY_U8:
- case SIDE_TYPE_ARRAY_U16:
- case SIDE_TYPE_ARRAY_U32:
- case SIDE_TYPE_ARRAY_U64:
- case SIDE_TYPE_ARRAY_S8:
- case SIDE_TYPE_ARRAY_S16:
- case SIDE_TYPE_ARRAY_S32:
- case SIDE_TYPE_ARRAY_S64:
- case SIDE_TYPE_ARRAY_POINTER32:
- case SIDE_TYPE_ARRAY_POINTER64:
- case SIDE_TYPE_ARRAY_BYTE:
- case SIDE_TYPE_ARRAY:
- break;
- default:
- fprintf(stderr, "ERROR: type mismatch between description and arguments\n");
- abort();
- break;
- }
- break;
-
- case SIDE_TYPE_VLA:
- switch (item->type) {
- case SIDE_TYPE_VLA_U8:
- case SIDE_TYPE_VLA_U16:
- case SIDE_TYPE_VLA_U32:
- case SIDE_TYPE_VLA_U64:
- case SIDE_TYPE_VLA_S8:
- case SIDE_TYPE_VLA_S16:
- case SIDE_TYPE_VLA_S32:
- case SIDE_TYPE_VLA_S64:
- case SIDE_TYPE_VLA_BYTE:
- case SIDE_TYPE_VLA_POINTER32:
- case SIDE_TYPE_VLA_POINTER64:
- case SIDE_TYPE_VLA:
- break;
- default:
- fprintf(stderr, "ERROR: type mismatch between description and arguments\n");
- abort();
- break;
- }
- break;
-
case SIDE_TYPE_ENUM:
switch (item->type) {
case SIDE_TYPE_U8:
case SIDE_TYPE_VLA_VISITOR:
tracer_print_vla_visitor(type_desc, item->u.side_static.side_vla_app_visitor_ctx);
break;
- case SIDE_TYPE_ARRAY_U8:
- case SIDE_TYPE_ARRAY_U16:
- case SIDE_TYPE_ARRAY_U32:
- case SIDE_TYPE_ARRAY_U64:
- case SIDE_TYPE_ARRAY_S8:
- case SIDE_TYPE_ARRAY_S16:
- case SIDE_TYPE_ARRAY_S32:
- case SIDE_TYPE_ARRAY_S64:
- case SIDE_TYPE_ARRAY_BYTE:
- case SIDE_TYPE_ARRAY_POINTER32:
- case SIDE_TYPE_ARRAY_POINTER64:
- tracer_print_array_fixint(type_desc, item);
- break;
- case SIDE_TYPE_VLA_U8:
- case SIDE_TYPE_VLA_U16:
- case SIDE_TYPE_VLA_U32:
- case SIDE_TYPE_VLA_U64:
- case SIDE_TYPE_VLA_S8:
- case SIDE_TYPE_VLA_S16:
- case SIDE_TYPE_VLA_S32:
- case SIDE_TYPE_VLA_S64:
- case SIDE_TYPE_VLA_BYTE:
- case SIDE_TYPE_VLA_POINTER32:
- case SIDE_TYPE_VLA_POINTER64:
- tracer_print_vla_fixint(type_desc, item);
- break;
/* Dynamic types */
case SIDE_TYPE_DYNAMIC_NULL:
printf(" ]");
}
-void tracer_print_array_fixint(const struct side_type *type_desc, const struct side_arg *item)
-{
- const struct side_type *elem_type = type_desc->u.side_array.elem_type;
- uint32_t i, side_sav_len = type_desc->u.side_array.length;
- void *p = item->u.side_static.side_array_fixint;
- enum side_type_label side_type;
-
- print_attributes("attr", ":", type_desc->u.side_array.attr, type_desc->u.side_array.nr_attr);
- printf("%s", type_desc->u.side_array.nr_attr ? ", " : "");
- printf("elements: ");
- switch (item->type) {
- case SIDE_TYPE_ARRAY_U8:
- if (elem_type->type != SIDE_TYPE_U8)
- goto type_error;
- break;
- case SIDE_TYPE_ARRAY_U16:
- if (elem_type->type != SIDE_TYPE_U16)
- goto type_error;
- break;
- case SIDE_TYPE_ARRAY_U32:
- if (elem_type->type != SIDE_TYPE_U32)
- goto type_error;
- break;
- case SIDE_TYPE_ARRAY_U64:
- if (elem_type->type != SIDE_TYPE_U64)
- goto type_error;
- break;
- case SIDE_TYPE_ARRAY_S8:
- if (elem_type->type != SIDE_TYPE_S8)
- goto type_error;
- break;
- case SIDE_TYPE_ARRAY_S16:
- if (elem_type->type != SIDE_TYPE_S16)
- goto type_error;
- break;
- case SIDE_TYPE_ARRAY_S32:
- if (elem_type->type != SIDE_TYPE_S32)
- goto type_error;
- break;
- case SIDE_TYPE_ARRAY_S64:
- if (elem_type->type != SIDE_TYPE_S64)
- goto type_error;
- break;
- case SIDE_TYPE_ARRAY_BYTE:
- if (elem_type->type != SIDE_TYPE_BYTE)
- goto type_error;
- break;
- case SIDE_TYPE_ARRAY_POINTER32:
- if (elem_type->type != SIDE_TYPE_POINTER32)
- goto type_error;
- case SIDE_TYPE_ARRAY_POINTER64:
- if (elem_type->type != SIDE_TYPE_POINTER64)
- goto type_error;
- break;
- default:
- goto type_error;
- }
- side_type = (enum side_type_label) elem_type->type;
-
- printf("[ ");
- for (i = 0; i < side_sav_len; i++) {
- struct side_arg sav_elem = {
- .type = side_type,
- };
-
- switch (side_type) {
- case SIDE_TYPE_U8:
- sav_elem.u.side_static.integer_value.side_u8 = ((const uint8_t *) p)[i];
- break;
- case SIDE_TYPE_S8:
- sav_elem.u.side_static.integer_value.side_s8 = ((const int8_t *) p)[i];
- break;
- case SIDE_TYPE_U16:
- sav_elem.u.side_static.integer_value.side_u16 = ((const uint16_t *) p)[i];
- break;
- case SIDE_TYPE_S16:
- sav_elem.u.side_static.integer_value.side_s16 = ((const int16_t *) p)[i];
- break;
- case SIDE_TYPE_U32:
- sav_elem.u.side_static.integer_value.side_u32 = ((const uint32_t *) p)[i];
- break;
- case SIDE_TYPE_S32:
- sav_elem.u.side_static.integer_value.side_s32 = ((const int32_t *) p)[i];
- break;
- case SIDE_TYPE_U64:
- sav_elem.u.side_static.integer_value.side_u64 = ((const uint64_t *) p)[i];
- break;
- case SIDE_TYPE_S64:
- sav_elem.u.side_static.integer_value.side_s64 = ((const int64_t *) p)[i];
- break;
- case SIDE_TYPE_BYTE:
- sav_elem.u.side_static.byte_value = ((const uint8_t *) p)[i];
- break;
- case SIDE_TYPE_POINTER32:
- sav_elem.u.side_static.integer_value.side_u32 = ((const uint32_t *) p)[i];
- break;
- case SIDE_TYPE_POINTER64:
- sav_elem.u.side_static.integer_value.side_u64 = ((const uint64_t *) p)[i];
- break;
-
- default:
- fprintf(stderr, "ERROR: Unexpected type\n");
- abort();
- }
-
- printf("%s", i ? ", " : "");
- tracer_print_type(elem_type, &sav_elem);
- }
- printf(" ]");
- return;
-
-type_error:
- fprintf(stderr, "ERROR: type mismatch\n");
- abort();
-}
-
-void tracer_print_vla_fixint(const struct side_type *type_desc, const struct side_arg *item)
-{
- const struct side_type *elem_type = type_desc->u.side_vla.elem_type;
- uint32_t i, side_sav_len = item->u.side_static.side_vla_fixint.length;
- void *p = item->u.side_static.side_vla_fixint.p;
- enum side_type_label side_type;
-
- print_attributes("attr", ":", type_desc->u.side_vla.attr, type_desc->u.side_vla.nr_attr);
- printf("%s", type_desc->u.side_vla.nr_attr ? ", " : "");
- printf("elements: ");
- switch (item->type) {
- case SIDE_TYPE_VLA_U8:
- if (elem_type->type != SIDE_TYPE_U8)
- goto type_error;
- break;
- case SIDE_TYPE_VLA_U16:
- if (elem_type->type != SIDE_TYPE_U16)
- goto type_error;
- break;
- case SIDE_TYPE_VLA_U32:
- if (elem_type->type != SIDE_TYPE_U32)
- goto type_error;
- break;
- case SIDE_TYPE_VLA_U64:
- if (elem_type->type != SIDE_TYPE_U64)
- goto type_error;
- break;
- case SIDE_TYPE_VLA_S8:
- if (elem_type->type != SIDE_TYPE_S8)
- goto type_error;
- break;
- case SIDE_TYPE_VLA_S16:
- if (elem_type->type != SIDE_TYPE_S16)
- goto type_error;
- break;
- case SIDE_TYPE_VLA_S32:
- if (elem_type->type != SIDE_TYPE_S32)
- goto type_error;
- break;
- case SIDE_TYPE_VLA_S64:
- if (elem_type->type != SIDE_TYPE_S64)
- goto type_error;
- break;
- case SIDE_TYPE_VLA_BYTE:
- if (elem_type->type != SIDE_TYPE_BYTE)
- goto type_error;
- break;
- case SIDE_TYPE_VLA_POINTER32:
- if (elem_type->type != SIDE_TYPE_POINTER32)
- goto type_error;
- case SIDE_TYPE_VLA_POINTER64:
- if (elem_type->type != SIDE_TYPE_POINTER64)
- goto type_error;
- break;
- default:
- goto type_error;
- }
- side_type = (enum side_type_label) elem_type->type;
-
- printf("[ ");
- for (i = 0; i < side_sav_len; i++) {
- struct side_arg sav_elem = {
- .type = side_type,
- };
-
- switch (side_type) {
- case SIDE_TYPE_U8:
- sav_elem.u.side_static.integer_value.side_u8 = ((const uint8_t *) p)[i];
- break;
- case SIDE_TYPE_S8:
- sav_elem.u.side_static.integer_value.side_s8 = ((const int8_t *) p)[i];
- break;
- case SIDE_TYPE_U16:
- sav_elem.u.side_static.integer_value.side_u16 = ((const uint16_t *) p)[i];
- break;
- case SIDE_TYPE_S16:
- sav_elem.u.side_static.integer_value.side_s16 = ((const int16_t *) p)[i];
- break;
- case SIDE_TYPE_U32:
- sav_elem.u.side_static.integer_value.side_u32 = ((const uint32_t *) p)[i];
- break;
- case SIDE_TYPE_S32:
- sav_elem.u.side_static.integer_value.side_s32 = ((const int32_t *) p)[i];
- break;
- case SIDE_TYPE_U64:
- sav_elem.u.side_static.integer_value.side_u64 = ((const uint64_t *) p)[i];
- break;
- case SIDE_TYPE_S64:
- sav_elem.u.side_static.integer_value.side_s64 = ((const int64_t *) p)[i];
- break;
- case SIDE_TYPE_BYTE:
- sav_elem.u.side_static.byte_value = ((const uint8_t *) p)[i];
- break;
- case SIDE_TYPE_POINTER32:
- sav_elem.u.side_static.integer_value.side_u32 = ((const uint32_t *) p)[i];
- break;
- case SIDE_TYPE_POINTER64:
- sav_elem.u.side_static.integer_value.side_u64 = ((const uint64_t *) p)[i];
- break;
-
- default:
- fprintf(stderr, "ERROR: Unexpected type\n");
- abort();
- }
-
- printf("%s", i ? ", " : "");
- tracer_print_type(elem_type, &sav_elem);
- }
- printf(" ]");
- return;
-
-type_error:
- fprintf(stderr, "ERROR: type mismatch\n");
- abort();
-}
-
static
void tracer_print_dynamic_struct(const struct side_arg_dynamic_struct *dynamic_struct)
{