ust-fd: Add close_range declaration
[lttng-ust.git] / liblttng-ust / lttng-filter-interpreter.c
index 1354d9c1062e5bebf1d764cf31e9116f32124116..f991ebb7ed95d9956e9ec523308067684243cae5 100644 (file)
@@ -173,7 +173,7 @@ uint64_t lttng_filter_false(void *filter_data,
  */
 
 #define START_OP                                                       \
-       start_pc = &bytecode->data[0];                                  \
+       start_pc = &bytecode->code[0];                                  \
        for (pc = next_pc = start_pc; pc - start_pc < bytecode->len;    \
                        pc = next_pc) {                                 \
                dbg_printf("Executing op %s (%u)\n",                    \
@@ -246,6 +246,7 @@ static int context_get_index(struct lttng_ctx *ctx,
                        ptr->u.u64 = v.u.s64;   /* Cast. */
                        ptr->ptr = &ptr->u.u64;
                }
+               ptr->rev_bo = field->type.u.basic.integer.reverse_byte_order;
                break;
        case atype_enum:
        {
@@ -262,6 +263,7 @@ static int context_get_index(struct lttng_ctx *ctx,
                        ptr->u.u64 = v.u.s64;   /* Cast. */
                        ptr->ptr = &ptr->u.u64;
                }
+               ptr->rev_bo = itype->reverse_byte_order;
                break;
        }
        case atype_array:
@@ -297,8 +299,10 @@ static int context_get_index(struct lttng_ctx *ctx,
                break;
        case atype_float:
                ptr->object_type = OBJECT_TYPE_DOUBLE;
+               ctx_field->get_value(ctx_field, &v);
                ptr->u.d = v.u.d;
                ptr->ptr = &ptr->u.d;
+               ptr->rev_bo = field->type.u.basic._float.reverse_byte_order;
                break;
        case atype_dynamic:
                ctx_field->get_value(ctx_field, &v);
@@ -309,12 +313,22 @@ static int context_get_index(struct lttng_ctx *ctx,
                        ptr->object_type = OBJECT_TYPE_S64;
                        ptr->u.s64 = v.u.s64;
                        ptr->ptr = &ptr->u.s64;
+                       /*
+                        * struct lttng_ctx_value does not currently
+                        * feature a byte order field.
+                        */
+                       ptr->rev_bo = false;
                        dbg_printf("context get index dynamic s64 %" PRIi64 "\n", ptr->u.s64);
                        break;
                case LTTNG_UST_DYNAMIC_TYPE_DOUBLE:
                        ptr->object_type = OBJECT_TYPE_DOUBLE;
                        ptr->u.d = v.u.d;
                        ptr->ptr = &ptr->u.d;
+                       /*
+                        * struct lttng_ctx_value does not currently
+                        * feature a byte order field.
+                        */
+                       ptr->rev_bo = false;
                        dbg_printf("context get index dynamic double %g\n", ptr->u.d);
                        break;
                case LTTNG_UST_DYNAMIC_TYPE_STRING:
@@ -742,6 +756,8 @@ uint64_t lttng_filter_interpret_bytecode(void *filter_data,
                [ FILTER_OP_LOAD_FIELD_DOUBLE ] = &&LABEL_FILTER_OP_LOAD_FIELD_DOUBLE,
 
                [ FILTER_OP_UNARY_BIT_NOT ] = &&LABEL_FILTER_OP_UNARY_BIT_NOT,
+
+               [ FILTER_OP_RETURN_S64 ] = &&LABEL_FILTER_OP_RETURN_S64,
        };
 #endif /* #ifndef INTERPRETER_USE_SWITCH */
 
@@ -774,6 +790,12 @@ uint64_t lttng_filter_interpret_bytecode(void *filter_data,
                        ret = 0;
                        goto end;
 
+               OP(FILTER_OP_RETURN_S64):
+                       /* LTTNG_FILTER_DISCARD  or LTTNG_FILTER_RECORD_FLAG */
+                       retval = !!estack_ax_v;
+                       ret = 0;
+                       goto end;
+
                /* binary */
                OP(FILTER_OP_MUL):
                OP(FILTER_OP_DIV):
@@ -1562,7 +1584,7 @@ uint64_t lttng_filter_interpret_bytecode(void *filter_data,
                                ret = -EINVAL;
                                goto end;
                        }
-                       res = (estack_bx_v >> estack_ax_v);
+                       res = ((uint64_t) estack_bx_v >> (uint32_t) estack_ax_v);
                        estack_pop(stack, top, ax, bx, ax_t, bx_t);
                        estack_ax_v = res;
                        estack_ax_t = REG_S64;
@@ -1583,7 +1605,7 @@ uint64_t lttng_filter_interpret_bytecode(void *filter_data,
                                ret = -EINVAL;
                                goto end;
                        }
-                       res = (estack_bx_v << estack_ax_v);
+                       res = ((uint64_t) estack_bx_v << (uint32_t) estack_ax_v);
                        estack_pop(stack, top, ax, bx, ax_t, bx_t);
                        estack_ax_v = res;
                        estack_ax_t = REG_S64;
@@ -1600,7 +1622,7 @@ uint64_t lttng_filter_interpret_bytecode(void *filter_data,
                                goto end;
                        }
 
-                       res = (estack_bx_v & estack_ax_v);
+                       res = ((uint64_t) estack_bx_v & (uint64_t) estack_ax_v);
                        estack_pop(stack, top, ax, bx, ax_t, bx_t);
                        estack_ax_v = res;
                        estack_ax_t = REG_S64;
@@ -1617,7 +1639,7 @@ uint64_t lttng_filter_interpret_bytecode(void *filter_data,
                                goto end;
                        }
 
-                       res = (estack_bx_v | estack_ax_v);
+                       res = ((uint64_t) estack_bx_v | (uint64_t) estack_ax_v);
                        estack_pop(stack, top, ax, bx, ax_t, bx_t);
                        estack_ax_v = res;
                        estack_ax_t = REG_S64;
@@ -1634,7 +1656,7 @@ uint64_t lttng_filter_interpret_bytecode(void *filter_data,
                                goto end;
                        }
 
-                       res = (estack_bx_v ^ estack_ax_v);
+                       res = ((uint64_t) estack_bx_v ^ (uint64_t) estack_ax_v);
                        estack_pop(stack, top, ax, bx, ax_t, bx_t);
                        estack_ax_v = res;
                        estack_ax_t = REG_S64;
@@ -1711,7 +1733,7 @@ uint64_t lttng_filter_interpret_bytecode(void *filter_data,
                                goto end;
                        }
 
-                       estack_ax_v = ~estack_ax_v;
+                       estack_ax_v = ~(uint64_t) estack_ax_v;
                        next_pc += sizeof(struct unary_op);
                        PO;
                }
This page took 0.025255 seconds and 4 git commands to generate.