X-Git-Url: http://git.lttng.org./?a=blobdiff_plain;ds=inline;f=include%2Flttng%2Fust-tracepoint-event.h;h=92edc455f3ddde03bd3817b82bf7d7d3ae177667;hb=d6792eab0e93399a26c6bea6d337ab4df1b95374;hp=2c037dca204cbd4570b13eb3f4d9cf543afbbf42;hpb=97904b41390563c6ad2134c522b5ba44ef1ae3b2;p=lttng-ust.git diff --git a/include/lttng/ust-tracepoint-event.h b/include/lttng/ust-tracepoint-event.h index 2c037dca..92edc455 100644 --- a/include/lttng/ust-tracepoint-event.h +++ b/include/lttng/ust-tracepoint-event.h @@ -30,6 +30,8 @@ #include #include +#define __LTTNG_UST_NULL_STRING "(null)" + #undef tp_list_for_each_entry_rcu #define tp_list_for_each_entry_rcu(pos, head, member) \ for (pos = cds_list_entry(tp_rcu_dereference_bp((head)->next), __typeof__(*pos), member); \ @@ -127,12 +129,36 @@ static const char \ /* Enumeration entry (single value) */ #undef ctf_enum_value #define ctf_enum_value(_string, _value) \ - { _value, _value, _string }, + { \ + .start = { \ + .signedness = lttng_is_signed_type(__typeof__(_value)), \ + .value = lttng_is_signed_type(__typeof__(_value)) ? \ + (long long) (_value) : (_value), \ + }, \ + .end = { \ + .signedness = lttng_is_signed_type(__typeof__(_value)), \ + .value = lttng_is_signed_type(__typeof__(_value)) ? \ + (long long) (_value) : (_value), \ + }, \ + .string = (_string), \ + }, /* Enumeration entry (range) */ #undef ctf_enum_range #define ctf_enum_range(_string, _range_start, _range_end) \ - { _range_start, _range_end, _string }, + { \ + .start = { \ + .signedness = lttng_is_signed_type(__typeof__(_range_start)), \ + .value = lttng_is_signed_type(__typeof__(_range_start)) ? \ + (long long) (_range_start) : (_range_start), \ + }, \ + .end = { \ + .signedness = lttng_is_signed_type(__typeof__(_range_end)), \ + .value = lttng_is_signed_type(__typeof__(_range_end)) ? \ + (long long) (_range_end) : (_range_end), \ + }, \ + .string = (_string), \ + }, #undef TP_ENUM_VALUES #define TP_ENUM_VALUES(...) \ @@ -328,7 +354,8 @@ static void __event_probe__##_provider##___##_name(_TP_ARGS_DATA_PROTO(_args)); #undef _ctf_string #define _ctf_string(_item, _src, _nowrite) \ - __event_len += __dynamic_len[__dynamic_len_idx++] = strlen(_src) + 1; + __event_len += __dynamic_len[__dynamic_len_idx++] = \ + strlen((_src) ? (_src) : __LTTNG_UST_NULL_STRING) + 1; #undef _ctf_enum #define _ctf_enum(_provider, _name, _type, _item, _src, _nowrite) \ @@ -471,7 +498,8 @@ size_t __event_get_size__##_provider##___##_name(size_t *__dynamic_len, _TP_ARGS #undef _ctf_string #define _ctf_string(_item, _src, _nowrite) \ { \ - const void *__ctf_tmp_ptr = (_src); \ + const void *__ctf_tmp_ptr = \ + ((_src) ? (_src) : __LTTNG_UST_NULL_STRING); \ memcpy(__stack_data, &__ctf_tmp_ptr, sizeof(void *)); \ __stack_data += sizeof(void *); \ } @@ -608,13 +636,19 @@ size_t __event_get_align__##_provider##___##_name(_TP_ARGS_PROTO(_args)) \ #undef _ctf_string #define _ctf_string(_item, _src, _nowrite) \ - lib_ring_buffer_align_ctx(&__ctx, lttng_alignof(*(_src))); \ - if (__chan->ops->u.has_strcpy) \ - __chan->ops->event_strcpy(&__ctx, _src, \ - __get_dynamic_len(dest)); \ - else \ - __chan->ops->event_write(&__ctx, _src, \ - __get_dynamic_len(dest)); + { \ + const char *__ctf_tmp_string = \ + ((_src) ? (_src) : __LTTNG_UST_NULL_STRING); \ + lib_ring_buffer_align_ctx(&__ctx, \ + lttng_alignof(*__ctf_tmp_string)); \ + if (__chan->ops->u.has_strcpy) \ + __chan->ops->event_strcpy(&__ctx, __ctf_tmp_string, \ + __get_dynamic_len(dest)); \ + else \ + __chan->ops->event_write(&__ctx, __ctf_tmp_string, \ + __get_dynamic_len(dest)); \ + } + #undef _ctf_enum #define _ctf_enum(_provider, _name, _type, _item, _src, _nowrite) \