X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=include%2Flttng%2Fust-tracepoint-event.h;h=398f3efae5d44fcc0193e8e37016b6314dd7e06e;hb=fa0994718a5855f67bc73546558df0ee742e376a;hp=aac32b96833413fe66add9a52097a4e5221fb344;hpb=2c44f5b96c30c96daf1c4b988d7498b5ee5fc009;p=lttng-ust.git diff --git a/include/lttng/ust-tracepoint-event.h b/include/lttng/ust-tracepoint-event.h index aac32b96..398f3efa 100644 --- a/include/lttng/ust-tracepoint-event.h +++ b/include/lttng/ust-tracepoint-event.h @@ -275,36 +275,50 @@ size_t __event_get_size__##_provider##___##_name(size_t *__dynamic_len, _TP_ARGS #undef _ctf_integer_ext #define _ctf_integer_ext(_type, _item, _src, _byte_order, _base, _written) \ - if (lttng_is_signed_type(_type)) \ - *(int64_t *) __stack_data = (int64_t) (_type) (_src); \ - else \ - *(uint64_t *) __stack_data = (uint64_t) (_type) (_src); \ + if (lttng_is_signed_type(_type)) { \ + int64_t __ctf_tmp_int64 = (int64_t) (_type) (_src); \ + memcpy(__stack_data, &__ctf_tmp_int64, sizeof(int64_t)); \ + } else { \ + uint64_t __ctf_tmp_uint64 = (uint64_t) (_type) (_src); \ + memcpy(__stack_data, &__ctf_tmp_uint64, sizeof(uint64_t)); \ + } \ __stack_data += sizeof(int64_t); #undef _ctf_float #define _ctf_float(_type, _item, _src, _written) \ - *(double *) __stack_data = (double) (_type) (_src); \ - __stack_data += sizeof(double); + { \ + double __ctf_tmp_double = (double) (_type) (_src); \ + memcpy(__stack_data, &__ctf_tmp_double, sizeof(double)); \ + __stack_data += sizeof(double); \ + } #undef _ctf_array_encoded #define _ctf_array_encoded(_type, _item, _src, _length, _encoding, _written) \ - *(unsigned long *) __stack_data = (unsigned long) (_length); \ - __stack_data += sizeof(unsigned long); \ - *(const void **) __stack_data = (_src); \ - __stack_data += sizeof(void *); + { \ + unsigned long __ctf_tmp_ulong = (unsigned long) (_length); \ + memcpy(__stack_data, &__ctf_tmp_ulong, sizeof(unsigned long)); \ + __stack_data += sizeof(unsigned long); \ + memcpy(__stack_data, (_src), sizeof(void **)); \ + __stack_data += sizeof(void **); \ + } #undef _ctf_sequence_encoded #define _ctf_sequence_encoded(_type, _item, _src, _length_type, \ _src_length, _encoding, _written) \ - *(unsigned long *) __stack_data = (unsigned long) (_src_length); \ - __stack_data += sizeof(unsigned long); \ - *(const void **) __stack_data = (_src); \ - __stack_data += sizeof(void *); + { \ + unsigned long __ctf_tmp_ulong = (unsigned long) (_src_length); \ + memcpy(__stack_data, &__ctf_tmp_ulong, sizeof(unsigned long)); \ + __stack_data += sizeof(unsigned long); \ + memcpy(__stack_data, (_src), sizeof(void **)); \ + __stack_data += sizeof(void **); \ + } #undef _ctf_string #define _ctf_string(_item, _src, _written) \ - *(const void **) __stack_data = (_src); \ - __stack_data += sizeof(void *); + { \ + memcpy(__stack_data, (_src), sizeof(void **)); \ + __stack_data += sizeof(void *); \ + } #undef TP_ARGS #define TP_ARGS(...) __VA_ARGS__