From 513fc97ee8790f552a761f6d99926a567779d4bc Mon Sep 17 00:00:00 2001 From: Mathieu Desnoyers Date: Thu, 11 Aug 2011 19:51:57 -0400 Subject: [PATCH] Fix float/double handling Signed-off-by: Mathieu Desnoyers --- include/ust/lttng-events.h | 1 - include/ust/lttng-tracepoint-event.h | 2 ++ tests/hello/hello.c | 4 +++- tests/hello/ust_tests_hello.h | 8 ++++++-- 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/include/ust/lttng-events.h b/include/ust/lttng-events.h index b15182c8..8f1c98d3 100644 --- a/include/ust/lttng-events.h +++ b/include/ust/lttng-events.h @@ -87,7 +87,6 @@ struct lttng_integer_type { - _float_mant_dig(_type), \ .mant_dig = _float_mant_dig(_type), \ .alignment = lttng_alignof(_type) * CHAR_BIT, \ - .signedness = lttng_is_signed_type(_type), \ .reverse_byte_order = __BYTE_ORDER != __FLOAT_WORD_ORDER, \ }, \ } \ diff --git a/include/ust/lttng-tracepoint-event.h b/include/ust/lttng-tracepoint-event.h index a83cc545..de145ebe 100644 --- a/include/ust/lttng-tracepoint-event.h +++ b/include/ust/lttng-tracepoint-event.h @@ -43,6 +43,8 @@ #define ctf_integer_network_hex(_type, _item, _src) \ ctf_integer_ext(_type, _item, _src, BIG_ENDIAN, 16) +/* ctf_float is redefined at each step */ + #undef ctf_array #define ctf_array(_type, _item, _src, _length) \ ctf_array_encoded(_type, _item, _src, _length, none) diff --git a/tests/hello/hello.c b/tests/hello/hello.c index 07251636..9cbe149b 100644 --- a/tests/hello/hello.c +++ b/tests/hello/hello.c @@ -66,6 +66,8 @@ int main(int argc, char **argv) int i; long values[] = { 1, 2, 3 }; char text[10] = "test"; + double dbl = 2.0; + float flt = 2222.0; init_int_handler(); @@ -75,7 +77,7 @@ int main(int argc, char **argv) for (i = 0; i < 50; i++) { tracepoint(ust_tests_hello_tptest, i, values, - text, strlen(text)); + text, strlen(text), dbl, flt); usleep(100000); } return 0; diff --git a/tests/hello/ust_tests_hello.h b/tests/hello/ust_tests_hello.h index 9ee132b7..0f709cb0 100644 --- a/tests/hello/ust_tests_hello.h +++ b/tests/hello/ust_tests_hello.h @@ -26,8 +26,10 @@ TRACEPOINT_EVENT(ust_tests_hello_tptest, TP_PROTO(int anint, long *values, - char *text, size_t textlen), - TP_ARGS(anint, values, text, textlen), + char *text, size_t textlen, + double doublearg, float floatarg), + TP_ARGS(anint, values, text, textlen, + doublearg, floatarg), TP_FIELDS( ctf_integer(int, intfield, anint) ctf_integer_hex(int, intfield2, anint) @@ -40,6 +42,8 @@ TRACEPOINT_EVENT(ust_tests_hello_tptest, ctf_sequence_text(char, seqfield2, text, size_t, textlen) ctf_string(stringfield, text) + ctf_float(float, floatfield, floatarg) + ctf_float(double, doublefield, doublearg) )) TRACEPOINT_EVENT_NOARGS(ust_tests_hello_tptest_sighandler, -- 2.34.1