From: Mathieu Desnoyers Date: Thu, 21 Sep 2023 06:35:19 +0000 (+0100) Subject: Use side_ptr_t for other attribute pointers X-Git-Url: https://git.efficios.com/?a=commitdiff_plain;h=12d787db89ee67972c83213dd0a45ca3c014d699;p=libside.git Use side_ptr_t for other attribute pointers Signed-off-by: Mathieu Desnoyers --- diff --git a/include/side/trace.h b/include/side/trace.h index 839db69..b3b8f6e 100644 --- a/include/side/trace.h +++ b/include/side/trace.h @@ -296,19 +296,19 @@ struct side_type_bool { } SIDE_PACKED; struct side_type_byte { - const struct side_attr *attr; + side_ptr_t(const struct side_attr) attr; uint32_t nr_attr; } SIDE_PACKED; struct side_type_string { - const struct side_attr *attr; + side_ptr_t(const struct side_attr) attr; uint32_t nr_attr; uint8_t unit_size; /* 1, 2, or 4 bytes */ uint8_t byte_order; /* enum side_type_label_byte_order */ } SIDE_PACKED; struct side_type_integer { - const struct side_attr *attr; + side_ptr_t(const struct side_attr) attr; uint32_t nr_attr; uint16_t integer_size; /* bytes */ uint16_t len_bits; /* bits. 0 for (integer_size * CHAR_BITS) */ @@ -317,7 +317,7 @@ struct side_type_integer { } SIDE_PACKED; struct side_type_float { - const struct side_attr *attr; + side_ptr_t(const struct side_attr) attr; uint32_t nr_attr; uint16_t float_size; /* bytes */ uint8_t byte_order; /* enum side_type_label_byte_order */ @@ -331,7 +331,7 @@ struct side_enum_mapping { struct side_enum_mappings { const struct side_enum_mapping *mappings; - const struct side_attr *attr; + side_ptr_t(const struct side_attr) attr; uint32_t nr_mappings; uint32_t nr_attr; } SIDE_PACKED; @@ -344,35 +344,35 @@ struct side_enum_bitmap_mapping { struct side_enum_bitmap_mappings { const struct side_enum_bitmap_mapping *mappings; - const struct side_attr *attr; + side_ptr_t(const struct side_attr) attr; uint32_t nr_mappings; uint32_t nr_attr; } SIDE_PACKED; struct side_type_struct { const struct side_event_field *fields; - const struct side_attr *attr; + side_ptr_t(const struct side_attr) attr; uint32_t nr_fields; uint32_t nr_attr; } SIDE_PACKED; struct side_type_array { const struct side_type *elem_type; - const struct side_attr *attr; + side_ptr_t(const struct side_attr) attr; uint32_t length; uint32_t nr_attr; } SIDE_PACKED; struct side_type_vla { const struct side_type *elem_type; - const struct side_attr *attr; + side_ptr_t(const struct side_attr) attr; uint32_t nr_attr; } SIDE_PACKED; struct side_type_vla_visitor { const struct side_type *elem_type; side_visitor_func visitor; - const struct side_attr *attr; + side_ptr_t(const struct side_attr) attr; uint32_t nr_attr; } SIDE_PACKED; @@ -494,7 +494,7 @@ struct side_variant_option { struct side_type_variant { const struct side_type selector; const struct side_variant_option *options; - const struct side_attr *attr; + side_ptr_t(const struct side_attr) attr; uint32_t nr_options; uint32_t nr_attr; } SIDE_PACKED; @@ -554,14 +554,14 @@ union side_arg_static { struct side_arg_dynamic_vla { const struct side_arg *sav; - const struct side_attr *attr; + side_ptr_t(const struct side_attr) attr; uint32_t len; uint32_t nr_attr; } SIDE_PACKED; struct side_arg_dynamic_struct { const struct side_arg_dynamic_field *fields; - const struct side_attr *attr; + side_ptr_t(const struct side_attr) attr; uint32_t len; uint32_t nr_attr; } SIDE_PACKED; @@ -569,14 +569,14 @@ struct side_arg_dynamic_struct { struct side_dynamic_struct_visitor { void *app_ctx; side_dynamic_struct_visitor_func visitor; - const struct side_attr *attr; + side_ptr_t(const struct side_attr) attr; uint32_t nr_attr; } SIDE_PACKED; struct side_dynamic_vla_visitor { void *app_ctx; side_visitor_func visitor; - const struct side_attr *attr; + side_ptr_t(const struct side_attr) attr; uint32_t nr_attr; } SIDE_PACKED; @@ -665,7 +665,7 @@ struct side_event_description { const char *provider_name; const char *event_name; const struct side_event_field *fields; - const struct side_attr *attr; + side_ptr_t(const struct side_attr) attr; uint64_t flags; uint32_t version; uint32_t loglevel; /* enum side_loglevel */ @@ -724,7 +724,7 @@ struct side_event_description { #define side_define_enum(_identifier, _mappings, _attr...) \ const struct side_enum_mappings _identifier = { \ .mappings = _mappings, \ - .attr = SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list()), \ + .attr = SIDE_PTR_INIT(SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list())), \ .nr_mappings = SIDE_ARRAY_SIZE(SIDE_PARAM(_mappings)), \ .nr_attr = SIDE_ARRAY_SIZE(SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list())), \ } @@ -757,7 +757,7 @@ struct side_event_description { #define side_define_enum_bitmap(_identifier, _mappings, _attr...) \ const struct side_enum_bitmap_mappings _identifier = { \ .mappings = _mappings, \ - .attr = SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list()), \ + .attr = SIDE_PTR_INIT(SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list())), \ .nr_mappings = SIDE_ARRAY_SIZE(SIDE_PARAM(_mappings)), \ .nr_attr = SIDE_ARRAY_SIZE(SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list())), \ } @@ -819,7 +819,7 @@ struct side_event_description { .type = SIDE_TYPE_BYTE, \ .u = { \ .side_byte = { \ - .attr = SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list()), \ + .attr = SIDE_PTR_INIT(SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list())), \ .nr_attr = SIDE_ARRAY_SIZE(SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list())), \ }, \ }, \ @@ -830,7 +830,7 @@ struct side_event_description { .type = _type, \ .u = { \ .side_string = { \ - .attr = _attr, \ + .attr = SIDE_PTR_INIT(_attr), \ .nr_attr = SIDE_ARRAY_SIZE(SIDE_PARAM(_attr)), \ .unit_size = _unit_size, \ .byte_order = _byte_order, \ @@ -848,7 +848,7 @@ struct side_event_description { .type = _type, \ .u = { \ .side_integer = { \ - .attr = _attr, \ + .attr = SIDE_PTR_INIT(_attr), \ .nr_attr = SIDE_ARRAY_SIZE(SIDE_PARAM(_attr)), \ .integer_size = _integer_size, \ .len_bits = _len_bits, \ @@ -863,7 +863,7 @@ struct side_event_description { .type = _type, \ .u = { \ .side_float = { \ - .attr = _attr, \ + .attr = SIDE_PTR_INIT(_attr), \ .nr_attr = SIDE_ARRAY_SIZE(SIDE_PARAM(_attr)), \ .float_size = _float_size, \ .byte_order = _byte_order, \ @@ -1023,7 +1023,7 @@ struct side_event_description { #define _side_type_struct_define(_fields, _attr) \ { \ .fields = _fields, \ - .attr = _attr, \ + .attr = SIDE_PTR_INIT(_attr), \ .nr_fields = SIDE_ARRAY_SIZE(SIDE_PARAM(_fields)), \ .nr_attr = SIDE_ARRAY_SIZE(SIDE_PARAM(_attr)), \ } @@ -1049,7 +1049,7 @@ struct side_event_description { { \ .selector = _selector, \ .options = _options, \ - .attr = _attr, \ + .attr = SIDE_PTR_INIT(_attr), \ .nr_options = SIDE_ARRAY_SIZE(SIDE_PARAM(_options)), \ .nr_attr = SIDE_ARRAY_SIZE(SIDE_PARAM(_attr)), \ } @@ -1068,7 +1068,7 @@ struct side_event_description { .u = { \ .side_array = { \ .elem_type = _elem_type, \ - .attr = SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list()), \ + .attr = SIDE_PTR_INIT(SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list())), \ .length = _length, \ .nr_attr = SIDE_ARRAY_SIZE(SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list())), \ }, \ @@ -1083,7 +1083,7 @@ struct side_event_description { .u = { \ .side_vla = { \ .elem_type = _elem_type, \ - .attr = SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list()), \ + .attr = SIDE_PTR_INIT(SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list())), \ .nr_attr = SIDE_ARRAY_SIZE(SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list())), \ }, \ }, \ @@ -1098,7 +1098,7 @@ struct side_event_description { .side_vla_visitor = { \ .elem_type = SIDE_PARAM(_elem_type), \ .visitor = _visitor, \ - .attr = SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list()), \ + .attr = SIDE_PTR_INIT(SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list())), \ .nr_attr = SIDE_ARRAY_SIZE(SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list())), \ }, \ }, \ @@ -1118,7 +1118,7 @@ struct side_event_description { .offset = _offset, \ .access_mode = _access_mode, \ .type = { \ - .attr = SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list()), \ + .attr = SIDE_PTR_INIT(SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list())), \ .nr_attr = SIDE_ARRAY_SIZE(SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list())), \ }, \ }, \ @@ -1176,7 +1176,7 @@ struct side_event_description { .offset = _offset, \ .access_mode = _access_mode, \ .type = { \ - .attr = SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list()), \ + .attr = SIDE_PTR_INIT(SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list())), \ .nr_attr = SIDE_ARRAY_SIZE(SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list())), \ .integer_size = _integer_size, \ .len_bits = _len_bits, \ @@ -1254,7 +1254,7 @@ struct side_event_description { .offset = _offset, \ .access_mode = _access_mode, \ .type = { \ - .attr = SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list()), \ + .attr = SIDE_PTR_INIT(SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list())), \ .nr_attr = SIDE_ARRAY_SIZE(SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list())), \ .float_size = _float_size, \ .byte_order = _byte_order, \ @@ -1289,7 +1289,7 @@ struct side_event_description { .offset = _offset, \ .access_mode = _access_mode, \ .type = { \ - .attr = SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list()), \ + .attr = SIDE_PTR_INIT(SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list())), \ .nr_attr = SIDE_ARRAY_SIZE(SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list())), \ .unit_size = _unit_size, \ .byte_order = _byte_order, \ @@ -1375,7 +1375,7 @@ struct side_event_description { .access_mode = _access_mode, \ .type = { \ .elem_type = _elem_type_gather, \ - .attr = SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list()), \ + .attr = SIDE_PTR_INIT(SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list())), \ .length = _length, \ .nr_attr = SIDE_ARRAY_SIZE(SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list())), \ }, \ @@ -1399,7 +1399,7 @@ struct side_event_description { .access_mode = _access_mode, \ .type = { \ .elem_type = _elem_type_gather, \ - .attr = SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list()), \ + .attr = SIDE_PTR_INIT(SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list())), \ .nr_attr = SIDE_ARRAY_SIZE(SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list())), \ }, \ }, \ @@ -1521,7 +1521,7 @@ struct side_event_description { .side_dynamic = { \ .side_byte = { \ .type = { \ - .attr = SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list()), \ + .attr = SIDE_PTR_INIT(SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list())), \ .nr_attr = SIDE_ARRAY_SIZE(SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list())), \ }, \ .value = (_val), \ @@ -1537,7 +1537,7 @@ struct side_event_description { .side_dynamic = { \ .side_string = { \ .type = { \ - .attr = SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list()), \ + .attr = SIDE_PTR_INIT(SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list())), \ .nr_attr = SIDE_ARRAY_SIZE(SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list())), \ .unit_size = _unit_size, \ .byte_order = _byte_order, \ @@ -1569,7 +1569,7 @@ struct side_event_description { .side_dynamic = { \ .side_integer = { \ .type = { \ - .attr = SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list()), \ + .attr = SIDE_PTR_INIT(SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list())), \ .nr_attr = SIDE_ARRAY_SIZE(SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list())), \ .integer_size = _integer_size, \ .len_bits = _len_bits, \ @@ -1614,7 +1614,7 @@ struct side_event_description { .side_dynamic = { \ .side_float = { \ .type = { \ - .attr = SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list()), \ + .attr = SIDE_PTR_INIT(SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list())), \ .nr_attr = SIDE_ARRAY_SIZE(SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list())), \ .float_size = _float_size, \ .byte_order = _byte_order, \ @@ -1693,7 +1693,7 @@ struct side_event_description { .side_dynamic_vla_visitor = { \ .app_ctx = _ctx, \ .visitor = _dynamic_vla_visitor, \ - .attr = SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list()), \ + .attr = SIDE_PTR_INIT(SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list())), \ .nr_attr = SIDE_ARRAY_SIZE(SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list())), \ }, \ }, \ @@ -1718,7 +1718,7 @@ struct side_event_description { .side_dynamic_struct_visitor = { \ .app_ctx = _ctx, \ .visitor = _dynamic_struct_visitor, \ - .attr = SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list()), \ + .attr = SIDE_PTR_INIT(SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list())), \ .nr_attr = SIDE_ARRAY_SIZE(SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list())), \ }, \ }, \ @@ -1729,7 +1729,7 @@ struct side_event_description { const struct side_arg _identifier##_vec[] = { _sav }; \ const struct side_arg_dynamic_vla _identifier = { \ .sav = _identifier##_vec, \ - .attr = SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list()), \ + .attr = SIDE_PTR_INIT(SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list())), \ .len = SIDE_ARRAY_SIZE(_identifier##_vec), \ .nr_attr = SIDE_ARRAY_SIZE(SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list())), \ } @@ -1738,7 +1738,7 @@ struct side_event_description { const struct side_arg_dynamic_field _identifier##_fields[] = { _struct_fields }; \ const struct side_arg_dynamic_struct _identifier = { \ .fields = _identifier##_fields, \ - .attr = SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list()), \ + .attr = SIDE_PTR_INIT(SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list())), \ .len = SIDE_ARRAY_SIZE(_identifier##_fields), \ .nr_attr = SIDE_ARRAY_SIZE(SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list())), \ } @@ -1791,7 +1791,7 @@ struct side_event_description { const struct side_arg_dynamic_field side_fields[] = { _var_fields }; \ const struct side_arg_dynamic_struct var_struct = { \ .fields = side_fields, \ - .attr = SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list()), \ + .attr = SIDE_PTR_INIT(SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list())), \ .len = SIDE_ARRAY_SIZE(side_fields), \ .nr_attr = SIDE_ARRAY_SIZE(SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list())), \ }; \ @@ -1815,7 +1815,7 @@ struct side_event_description { .provider_name = _provider, \ .event_name = _event, \ .fields = _fields, \ - .attr = SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list()), \ + .attr = SIDE_PTR_INIT(SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list())), \ .flags = (_flags), \ .version = 0, \ .loglevel = _loglevel, \ diff --git a/src/tracer.c b/src/tracer.c index 55b1341..59f1b1a 100644 --- a/src/tracer.c +++ b/src/tracer.c @@ -481,7 +481,7 @@ void tracer_print_enum(const struct side_type *type_desc, const struct side_arg } v64 = tracer_load_integer_value(&elem_type->u.side_integer, &item->u.side_static.integer_value, 0, NULL); - print_attributes("attr", ":", mappings->attr, mappings->nr_attr); + print_attributes("attr", ":", side_ptr_get(mappings->attr), mappings->nr_attr); printf("%s", mappings->nr_attr ? ", " : ""); tracer_print_type(elem_type, item); print_enum_labels(mappings, v64); @@ -552,7 +552,7 @@ void tracer_print_enum_bitmap(const struct side_type *type_desc, } stride_bit = elem_type_to_stride(elem_type); - print_attributes("attr", ":", side_enum_mappings->attr, side_enum_mappings->nr_attr); + print_attributes("attr", ":", side_ptr_get(side_enum_mappings->attr), side_enum_mappings->nr_attr); printf("%s", side_enum_mappings->nr_attr ? ", " : ""); printf("labels: [ "); for (i = 0; i < side_enum_mappings->nr_mappings; i++) { @@ -692,8 +692,8 @@ void tracer_print_type_integer(const char *separator, uint16_t len_bits; v64 = tracer_load_integer_value(type_integer, value, offset_bits, &len_bits); - tracer_print_type_header(separator, type_integer->attr, type_integer->nr_attr); - base = get_attr_display_base(type_integer->attr, type_integer->nr_attr, default_base); + tracer_print_type_header(separator, side_ptr_get(type_integer->attr), type_integer->nr_attr); + base = get_attr_display_base(side_ptr_get(type_integer->attr), type_integer->nr_attr, default_base); switch (base) { case TRACER_DISPLAY_BASE_2: print_integer_binary(v64.u, len_bits); @@ -728,7 +728,7 @@ void tracer_print_type_float(const char *separator, { bool reverse_bo; - tracer_print_type_header(separator, type_float->attr, type_float->nr_attr); + tracer_print_type_header(separator, side_ptr_get(type_float->attr), type_float->nr_attr); reverse_bo = type_float->byte_order != SIDE_TYPE_FLOAT_WORD_ORDER_HOST; switch (type_float->float_size) { case 2: @@ -926,7 +926,7 @@ void tracer_print_type(const struct side_type *type_desc, const struct side_arg break; case SIDE_TYPE_BYTE: - tracer_print_type_header(":", type_desc->u.side_byte.attr, type_desc->u.side_byte.nr_attr); + tracer_print_type_header(":", side_ptr_get(type_desc->u.side_byte.attr), type_desc->u.side_byte.nr_attr); printf("0x%" PRIx8, item->u.side_static.byte_value); break; @@ -945,7 +945,7 @@ void tracer_print_type(const struct side_type *type_desc, const struct side_arg case SIDE_TYPE_STRING_UTF8: case SIDE_TYPE_STRING_UTF16: case SIDE_TYPE_STRING_UTF32: - tracer_print_type_header(":", type_desc->u.side_string.attr, type_desc->u.side_string.nr_attr); + tracer_print_type_header(":", side_ptr_get(type_desc->u.side_string.attr), type_desc->u.side_string.nr_attr); tracer_print_string((const void *)(uintptr_t) item->u.side_static.string_value, type_desc->u.side_string.unit_size, type_desc->u.side_string.byte_order, NULL); break; @@ -1054,7 +1054,7 @@ void tracer_print_struct(const struct side_type *type_desc, const struct side_ar fprintf(stderr, "ERROR: number of fields mismatch between description and arguments of structure\n"); abort(); } - print_attributes("attr", ":", type_desc->u.side_struct->attr, type_desc->u.side_struct->nr_attr); + print_attributes("attr", ":", side_ptr_get(type_desc->u.side_struct->attr), type_desc->u.side_struct->nr_attr); printf("%s", type_desc->u.side_struct->nr_attr ? ", " : ""); printf("fields: { "); for (i = 0; i < side_sav_len; i++) { @@ -1114,7 +1114,7 @@ void tracer_print_array(const struct side_type *type_desc, const struct side_arg fprintf(stderr, "ERROR: length mismatch between description and arguments of array\n"); abort(); } - print_attributes("attr", ":", type_desc->u.side_array.attr, type_desc->u.side_array.nr_attr); + print_attributes("attr", ":", side_ptr_get(type_desc->u.side_array.attr), type_desc->u.side_array.nr_attr); printf("%s", type_desc->u.side_array.nr_attr ? ", " : ""); printf("elements: "); printf("[ "); @@ -1131,7 +1131,7 @@ void tracer_print_vla(const struct side_type *type_desc, const struct side_arg_v const struct side_arg *sav = side_arg_vec->sav; uint32_t i, side_sav_len = side_arg_vec->len; - print_attributes("attr", ":", type_desc->u.side_vla.attr, type_desc->u.side_vla.nr_attr); + print_attributes("attr", ":", side_ptr_get(type_desc->u.side_vla.attr), type_desc->u.side_vla.nr_attr); printf("%s", type_desc->u.side_vla.nr_attr ? ", " : ""); printf("elements: "); printf("[ "); @@ -1221,7 +1221,7 @@ uint32_t tracer_print_gather_byte_type(const struct side_type_gather *type_gathe ptr = tracer_gather_access(access_mode, ptr + type_gather->u.side_byte.offset); memcpy(&value, ptr, 1); - tracer_print_type_header(":", type_gather->u.side_byte.type.attr, + tracer_print_type_header(":", side_ptr_get(type_gather->u.side_byte.type.attr), type_gather->u.side_byte.type.nr_attr); printf("0x%" PRIx8, value); return tracer_gather_size(access_mode, 1); @@ -1286,7 +1286,7 @@ uint32_t tracer_print_gather_string_type(const struct side_type_gather *type_gat size_t string_len; ptr = tracer_gather_access(access_mode, ptr + type_gather->u.side_string.offset); - tracer_print_type_header(":", type_gather->u.side_string.type.attr, + tracer_print_type_header(":", side_ptr_get(type_gather->u.side_string.type.attr), type_gather->u.side_string.type.nr_attr); if (ptr) { tracer_print_string(ptr, type_gather->u.side_string.type.unit_size, @@ -1375,7 +1375,7 @@ uint32_t tracer_print_gather_enum_type(const struct side_type_gather *type_gathe ptr = tracer_gather_access(access_mode, ptr + side_integer->offset); memcpy(&value, ptr, integer_size_bytes); v64 = tracer_load_gather_integer_value(side_integer, &value); - print_attributes("attr", ":", mappings->attr, mappings->nr_attr); + print_attributes("attr", ":", side_ptr_get(mappings->attr), mappings->nr_attr); printf("%s", mappings->nr_attr ? ", " : ""); tracer_print_gather_type(enum_elem_type, ptr); print_enum_labels(mappings, v64); @@ -1398,7 +1398,7 @@ uint32_t tracer_print_gather_struct(const struct side_type_gather *type_gather, uint32_t i; ptr = tracer_gather_access(access_mode, ptr + type_gather->u.side_struct.offset); - print_attributes("attr", ":", type_gather->u.side_struct.type->attr, type_gather->u.side_struct.type->nr_attr); + print_attributes("attr", ":", side_ptr_get(type_gather->u.side_struct.type->attr), type_gather->u.side_struct.type->nr_attr); printf("%s", type_gather->u.side_struct.type->nr_attr ? ", " : ""); printf("fields: { "); for (i = 0; i < type_gather->u.side_struct.type->nr_fields; i++) { @@ -1419,7 +1419,7 @@ uint32_t tracer_print_gather_array(const struct side_type_gather *type_gather, c ptr = tracer_gather_access(access_mode, ptr + type_gather->u.side_array.offset); orig_ptr = ptr; - print_attributes("attr", ":", type_gather->u.side_array.type.attr, type_gather->u.side_array.type.nr_attr); + print_attributes("attr", ":", side_ptr_get(type_gather->u.side_array.type.attr), type_gather->u.side_array.type.nr_attr); printf("%s", type_gather->u.side_array.type.nr_attr ? ", " : ""); printf("elements: "); printf("[ "); @@ -1462,7 +1462,7 @@ uint32_t tracer_print_gather_vla(const struct side_type_gather *type_gather, con length = (uint32_t) v64.u; ptr = tracer_gather_access(access_mode, ptr + type_gather->u.side_vla.offset); orig_ptr = ptr; - print_attributes("attr", ":", type_gather->u.side_vla.type.attr, type_gather->u.side_vla.type.nr_attr); + print_attributes("attr", ":", side_ptr_get(type_gather->u.side_vla.type.attr), type_gather->u.side_vla.type.nr_attr); printf("%s", type_gather->u.side_vla.type.nr_attr ? ", " : ""); printf("elements: "); printf("[ "); @@ -1510,7 +1510,7 @@ void tracer_print_vla_visitor(const struct side_type *type_desc, void *app_ctx) .priv = &tracer_priv, }; - print_attributes("attr", ":", type_desc->u.side_vla_visitor.attr, type_desc->u.side_vla_visitor.nr_attr); + print_attributes("attr", ":", side_ptr_get(type_desc->u.side_vla_visitor.attr), type_desc->u.side_vla_visitor.nr_attr); printf("%s", type_desc->u.side_vla_visitor.nr_attr ? ", " : ""); printf("elements: "); printf("[ "); @@ -1531,7 +1531,7 @@ void tracer_print_dynamic_struct(const struct side_arg_dynamic_struct *dynamic_s const struct side_arg_dynamic_field *fields = dynamic_struct->fields; uint32_t i, len = dynamic_struct->len; - print_attributes("attr", "::", dynamic_struct->attr, dynamic_struct->nr_attr); + print_attributes("attr", "::", side_ptr_get(dynamic_struct->attr), dynamic_struct->nr_attr); printf("%s", dynamic_struct->nr_attr ? ", " : ""); printf("fields:: "); printf("[ "); @@ -1574,7 +1574,7 @@ void tracer_print_dynamic_struct_visitor(const struct side_arg *item) }; void *app_ctx = item->u.side_dynamic.side_dynamic_struct_visitor.app_ctx; - print_attributes("attr", "::", item->u.side_dynamic.side_dynamic_struct_visitor.attr, item->u.side_dynamic.side_dynamic_struct_visitor.nr_attr); + print_attributes("attr", "::", side_ptr_get(item->u.side_dynamic.side_dynamic_struct_visitor.attr), item->u.side_dynamic.side_dynamic_struct_visitor.nr_attr); printf("%s", item->u.side_dynamic.side_dynamic_struct_visitor.nr_attr ? ", " : ""); printf("fields:: "); printf("[ "); @@ -1595,7 +1595,7 @@ void tracer_print_dynamic_vla(const struct side_arg_dynamic_vla *vla) const struct side_arg *sav = vla->sav; uint32_t i, side_sav_len = vla->len; - print_attributes("attr", "::", vla->attr, vla->nr_attr); + print_attributes("attr", "::", side_ptr_get(vla->attr), vla->nr_attr); printf("%s", vla->nr_attr ? ", " : ""); printf("elements:: "); printf("[ "); @@ -1636,7 +1636,7 @@ void tracer_print_dynamic_vla_visitor(const struct side_arg *item) }; void *app_ctx = item->u.side_dynamic.side_dynamic_vla_visitor.app_ctx; - print_attributes("attr", "::", item->u.side_dynamic.side_dynamic_vla_visitor.attr, item->u.side_dynamic.side_dynamic_vla_visitor.nr_attr); + print_attributes("attr", "::", side_ptr_get(item->u.side_dynamic.side_dynamic_vla_visitor.attr), item->u.side_dynamic.side_dynamic_vla_visitor.nr_attr); printf("%s", item->u.side_dynamic.side_dynamic_vla_visitor.nr_attr ? ", " : ""); printf("elements:: "); printf("[ "); @@ -1670,7 +1670,7 @@ void tracer_print_dynamic(const struct side_arg *item) TRACER_DISPLAY_BASE_10); break; case SIDE_TYPE_DYNAMIC_BYTE: - tracer_print_type_header("::", item->u.side_dynamic.side_byte.type.attr, item->u.side_dynamic.side_byte.type.nr_attr); + tracer_print_type_header("::", side_ptr_get(item->u.side_dynamic.side_byte.type.attr), item->u.side_dynamic.side_byte.type.nr_attr); printf("0x%" PRIx8, item->u.side_dynamic.side_byte.value); break; case SIDE_TYPE_DYNAMIC_POINTER: @@ -1682,7 +1682,7 @@ void tracer_print_dynamic(const struct side_arg *item) &item->u.side_dynamic.side_float.value); break; case SIDE_TYPE_DYNAMIC_STRING: - tracer_print_type_header("::", item->u.side_dynamic.side_string.type.attr, item->u.side_dynamic.side_string.type.nr_attr); + tracer_print_type_header("::", side_ptr_get(item->u.side_dynamic.side_string.type.attr), item->u.side_dynamic.side_string.type.nr_attr); tracer_print_string((const char *)(uintptr_t) item->u.side_dynamic.side_string.value, item->u.side_dynamic.side_string.type.unit_size, item->u.side_dynamic.side_string.type.byte_order, NULL); @@ -1721,7 +1721,7 @@ void tracer_print_static_fields(const struct side_event_description *desc, fprintf(stderr, "ERROR: number of fields mismatch between description and arguments\n"); abort(); } - print_attributes(", attr", ":", desc->attr, desc->nr_attr); + print_attributes(", attr", ":", side_ptr_get(desc->attr), desc->nr_attr); printf("%s", side_sav_len ? ", fields: [ " : ""); for (i = 0; i < side_sav_len; i++) { printf("%s", i ? ", " : ""); @@ -1758,7 +1758,7 @@ void tracer_call_variadic(const struct side_event_description *desc, fprintf(stderr, "ERROR: unexpected non-variadic event description\n"); abort(); } - print_attributes(", attr ", "::", var_struct->attr, var_struct->nr_attr); + print_attributes(", attr ", "::", side_ptr_get(var_struct->attr), var_struct->nr_attr); printf("%s", var_struct_len ? ", fields:: [ " : ""); for (i = 0; i < var_struct_len; i++, nr_fields++) { printf("%s", i ? ", " : "");