summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
3615ef9)
Observed Issue
==============
When using the event notification capture feature to capture a context
field, e.g. '$ctx.cpu_id', the captured value is often observed in
reverse byte order.
Cause
=====
Within the bytecode interpreter, context_get_index() leaves the "rev_bo"
field uninitialized in the top of stack.
This only affects the event notification capture bytecode because the
BYTECODE_OP_GET_SYMBOL bytecode instruction (as of lttng-tools 2.13)
is only generated for capture bytecode in lttng-tools. Therefore, only
capture bytecode targeting contexts are affected by this issue. The
reason why lttng-tools uses the "legacy" bytecode instruction to get
context (BYTECODE_OP_GET_CONTEXT_REF) for the filter bytecode is to
preserve backward compatibility of filtering when interacting with
applications linked against LTTng-UST 2.12.
Solution
========
Initialize the rev_bo field based on the context field type
reserve_byte_order field.
Known drawbacks
===============
None.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I74996d501cee3c269658d98dfc0d0050b74c5ddb
ptr->u.u64 = v.u.s64; /* Cast. */
ptr->ptr = &ptr->u.u64;
}
ptr->u.u64 = v.u.s64; /* Cast. */
ptr->ptr = &ptr->u.u64;
}
+ ptr->rev_bo = lttng_ust_get_type_integer(field->type)->reverse_byte_order;
break;
case lttng_ust_type_enum:
{
break;
case lttng_ust_type_enum:
{
ptr->u.u64 = v.u.s64; /* Cast. */
ptr->ptr = &ptr->u.u64;
}
ptr->u.u64 = v.u.s64; /* Cast. */
ptr->ptr = &ptr->u.u64;
}
+ ptr->rev_bo = itype->reverse_byte_order;
break;
}
case lttng_ust_type_array:
break;
}
case lttng_ust_type_array:
ctx_field->get_value(ctx_field->priv, probe_ctx, &v);
ptr->u.d = v.u.d;
ptr->ptr = &ptr->u.d;
ctx_field->get_value(ctx_field->priv, probe_ctx, &v);
ptr->u.d = v.u.d;
ptr->ptr = &ptr->u.d;
+ ptr->rev_bo = lttng_ust_get_type_float(field->type)->reverse_byte_order;
break;
case lttng_ust_type_dynamic:
ctx_field->get_value(ctx_field->priv, probe_ctx, &v);
break;
case lttng_ust_type_dynamic:
ctx_field->get_value(ctx_field->priv, probe_ctx, &v);
ptr->object_type = OBJECT_TYPE_U64;
ptr->u.u64 = v.u.u64;
ptr->ptr = &ptr->u.u64;
ptr->object_type = OBJECT_TYPE_U64;
ptr->u.u64 = v.u.u64;
ptr->ptr = &ptr->u.u64;
+ /*
+ * struct lttng_ust_ctx_value does not currently
+ * feature a byte order field.
+ */
+ ptr->rev_bo = false;
dbg_printf("context get index dynamic u64 %" PRIi64 "\n", ptr->u.u64);
break;
case LTTNG_UST_DYNAMIC_TYPE_S8:
dbg_printf("context get index dynamic u64 %" PRIi64 "\n", ptr->u.u64);
break;
case LTTNG_UST_DYNAMIC_TYPE_S8:
ptr->object_type = OBJECT_TYPE_S64;
ptr->u.s64 = v.u.s64;
ptr->ptr = &ptr->u.s64;
ptr->object_type = OBJECT_TYPE_S64;
ptr->u.s64 = v.u.s64;
ptr->ptr = &ptr->u.s64;
+ /*
+ * struct lttng_ust_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_FLOAT:
dbg_printf("context get index dynamic s64 %" PRIi64 "\n", ptr->u.s64);
break;
case LTTNG_UST_DYNAMIC_TYPE_FLOAT:
ptr->object_type = OBJECT_TYPE_DOUBLE;
ptr->u.d = v.u.d;
ptr->ptr = &ptr->u.d;
ptr->object_type = OBJECT_TYPE_DOUBLE;
ptr->u.d = v.u.d;
ptr->ptr = &ptr->u.d;
+ /*
+ * struct lttng_ust_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:
dbg_printf("context get index dynamic double %g\n", ptr->u.d);
break;
case LTTNG_UST_DYNAMIC_TYPE_STRING: