bytecode: handle all integer types of dynamic contexts
authorFrancis Deslauriers <francis.deslauriers@efficios.com>
Tue, 26 May 2020 15:02:19 +0000 (11:02 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Thu, 26 Nov 2020 18:37:54 +0000 (13:37 -0500)
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I86d24abd87bc6ed3fb2fbe659bc2bab877017c08

include/lttng/ust-events.h
liblttng-ust/lttng-bytecode-interpreter.c
tests/compile/test-app-ctx/hello.c

index 4e3163c4328faf625bb098df56e291411926d3d0..5bd158386cdfeba881597d5b1bc3c0b17076ee94 100644 (file)
@@ -315,6 +315,7 @@ struct lttng_ctx_value {
        enum lttng_ust_dynamic_type sel;
        union {
                int64_t s64;
+               uint64_t u64;
                const char *str;
                double d;
        } u;
index 9a2aaa45ec97b63748150c7700dadaac6f49ddc6..ea5eca191d988b45b0d5d5ae1ebf90236130b8ff 100644 (file)
@@ -345,12 +345,25 @@ static int context_get_index(struct lttng_ctx *ctx,
                switch (v.sel) {
                case LTTNG_UST_DYNAMIC_TYPE_NONE:
                        return -EINVAL;
+               case LTTNG_UST_DYNAMIC_TYPE_U8:
+               case LTTNG_UST_DYNAMIC_TYPE_U16:
+               case LTTNG_UST_DYNAMIC_TYPE_U32:
+               case LTTNG_UST_DYNAMIC_TYPE_U64:
+                       ptr->object_type = OBJECT_TYPE_U64;
+                       ptr->u.u64 = v.u.u64;
+                       ptr->ptr = &ptr->u.u64;
+                       dbg_printf("context get index dynamic u64 %" PRIi64 "\n", ptr->u.u64);
+                       break;
+               case LTTNG_UST_DYNAMIC_TYPE_S8:
+               case LTTNG_UST_DYNAMIC_TYPE_S16:
+               case LTTNG_UST_DYNAMIC_TYPE_S32:
                case LTTNG_UST_DYNAMIC_TYPE_S64:
                        ptr->object_type = OBJECT_TYPE_S64;
                        ptr->u.s64 = v.u.s64;
                        ptr->ptr = &ptr->u.s64;
                        dbg_printf("context get index dynamic s64 %" PRIi64 "\n", ptr->u.s64);
                        break;
+               case LTTNG_UST_DYNAMIC_TYPE_FLOAT:
                case LTTNG_UST_DYNAMIC_TYPE_DOUBLE:
                        ptr->object_type = OBJECT_TYPE_DOUBLE;
                        ptr->u.d = v.u.d;
index e9e45ec7c51db46aae588276d14085322136ac06..ec51263572090336db394eb90cbef9cef77b438e 100644 (file)
@@ -240,16 +240,16 @@ void test_get_value(struct lttng_ctx_field *field,
                value->u.s64 = -64;
                break;
        case LTTNG_UST_DYNAMIC_TYPE_U8:
-               value->u.s64 = 8;
+               value->u.u64 = 8;
                break;
        case LTTNG_UST_DYNAMIC_TYPE_U16:
-               value->u.s64 = 16;
+               value->u.u64 = 16;
                break;
        case LTTNG_UST_DYNAMIC_TYPE_U32:
-               value->u.s64 = 32;
+               value->u.u64 = 32;
                break;
        case LTTNG_UST_DYNAMIC_TYPE_U64:
-               value->u.s64 = 64;
+               value->u.u64 = 64;
                break;
        case LTTNG_UST_DYNAMIC_TYPE_FLOAT:
                value->u.d = 22322.0;
This page took 0.027431 seconds and 4 git commands to generate.