insn->op = FILTER_OP_LOAD_FIELD_U64;
break;
case OBJECT_TYPE_DOUBLE:
- printk(KERN_WARNING "Double type unsupported\n\n");
+ printk(KERN_WARNING "LTTng: filter: Double type unsupported\n\n");
ret = -EINVAL;
goto end;
case OBJECT_TYPE_STRING:
case OBJECT_TYPE_ARRAY:
case OBJECT_TYPE_STRUCT:
case OBJECT_TYPE_VARIANT:
- printk(KERN_WARNING "Sequences, arrays, struct and variant cannot be loaded (nested types).\n");
+ printk(KERN_WARNING "LTTng: filter: Sequences, arrays, struct and variant cannot be loaded (nested types).\n");
ret = -EINVAL;
goto end;
}
/* Only generated by the specialize phase. */
case OBJECT_TYPE_VARIANT: /* Fall-through */
default:
- printk(KERN_WARNING "Unexpected get index type %d",
+ printk(KERN_WARNING "LTTng: filter: Unexpected get index type %d",
(int) stack_top->load.object_type);
ret = -EINVAL;
goto end;
case LOAD_ROOT_CONTEXT:
case LOAD_ROOT_APP_CONTEXT:
case LOAD_ROOT_PAYLOAD:
- printk(KERN_WARNING "Index lookup for root field not implemented yet.\n");
+ printk(KERN_WARNING "LTTng: filter: Index lookup for root field not implemented yet.\n");
ret = -EINVAL;
goto end;
}
return ret;
}
-static int specialize_context_lookup_name(struct bytecode_runtime *bytecode,
+static int specialize_context_lookup_name(struct lttng_ctx *ctx,
+ struct bytecode_runtime *bytecode,
struct load_op *insn)
{
uint16_t offset;
offset = ((struct get_symbol *) insn->data)->offset;
name = bytecode->p.bc->bc.data + bytecode->p.bc->bc.reloc_offset + offset;
- return lttng_get_context_index(lttng_static_ctx, name);
+ return lttng_get_context_index(ctx, name);
}
static int specialize_load_object(const struct lttng_event_field *field,
}
case atype_array_nestable:
if (!lttng_is_bytewise_integer(field->type.u.array_nestable.elem_type)) {
- printk(KERN_WARNING "Array nesting only supports integer types.\n");
+ printk(KERN_WARNING "LTTng: filter Array nesting only supports integer types.\n");
return -EINVAL;
}
if (is_context) {
break;
case atype_sequence_nestable:
if (!lttng_is_bytewise_integer(field->type.u.sequence_nestable.elem_type)) {
- printk(KERN_WARNING "Sequence nesting only supports integer types.\n");
+ printk(KERN_WARNING "LTTng: filter Sequence nesting only supports integer types.\n");
return -EINVAL;
}
if (is_context) {
load->object_type = OBJECT_TYPE_STRING;
break;
case atype_struct_nestable:
- printk(KERN_WARNING "Structure type cannot be loaded.\n");
+ printk(KERN_WARNING "LTTng: filter: Structure type cannot be loaded.\n");
return -EINVAL;
case atype_variant_nestable:
- printk(KERN_WARNING "Variant type cannot be loaded.\n");
+ printk(KERN_WARNING "LTTng: filter: Variant type cannot be loaded.\n");
return -EINVAL;
default:
- printk(KERN_WARNING "Unknown type: %d", (int) field->type.atype);
+ printk(KERN_WARNING "LTTng: filter: Unknown type: %d", (int) field->type.atype);
return -EINVAL;
}
return 0;
}
-static int specialize_context_lookup(struct bytecode_runtime *runtime,
+static int specialize_context_lookup(struct lttng_ctx *ctx,
+ struct bytecode_runtime *runtime,
struct load_op *insn,
struct vstack_load *load)
{
struct filter_get_index_data gid;
ssize_t data_offset;
- idx = specialize_context_lookup_name(runtime, insn);
+ idx = specialize_context_lookup_name(ctx, runtime, insn);
if (idx < 0) {
return -ENOENT;
}
return 0;
}
-static int specialize_event_payload_lookup(struct lttng_event *event,
+static int specialize_payload_lookup(const struct lttng_event_desc *event_desc,
struct bytecode_runtime *runtime,
struct load_op *insn,
struct vstack_load *load)
{
const char *name;
uint16_t offset;
- const struct lttng_event_desc *desc = event->desc;
unsigned int i, nr_fields;
bool found = false;
uint32_t field_offset = 0;
struct filter_get_index_data gid;
ssize_t data_offset;
- nr_fields = desc->nr_fields;
+ nr_fields = event_desc->nr_fields;
offset = ((struct get_symbol *) insn->data)->offset;
name = runtime->p.bc->bc.data + runtime->p.bc->bc.reloc_offset + offset;
for (i = 0; i < nr_fields; i++) {
- field = &desc->fields[i];
+ field = &event_desc->fields[i];
if (field->nofilter) {
continue;
}
return ret;
}
-int lttng_filter_specialize_bytecode(struct lttng_event *event,
+int lttng_filter_specialize_bytecode(const struct lttng_event_desc *event_desc,
struct bytecode_runtime *bytecode)
{
void *pc, *next_pc, *start_pc;
int ret = -EINVAL;
struct vstack _stack;
struct vstack *stack = &_stack;
+ struct lttng_ctx *ctx = bytecode->p.ctx;
vstack_init(stack);
switch (*(filter_opcode_t *) pc) {
case FILTER_OP_UNKNOWN:
default:
- printk(KERN_WARNING "unknown bytecode op %u\n",
+ printk(KERN_WARNING "LTTng: filter: unknown bytecode op %u\n",
(unsigned int) *(filter_opcode_t *) pc);
ret = -EINVAL;
goto end;
case FILTER_OP_MOD:
case FILTER_OP_PLUS:
case FILTER_OP_MINUS:
- printk(KERN_WARNING "unsupported bytecode op %u\n",
+ printk(KERN_WARNING "LTTng: filter: unsupported bytecode op %u\n",
(unsigned int) *(filter_opcode_t *) pc);
ret = -EINVAL;
goto end;
switch(vstack_ax(stack)->type) {
default:
- printk(KERN_WARNING "unknown register type\n");
+ printk(KERN_WARNING "LTTng: filter: unknown register type\n");
ret = -EINVAL;
goto end;
switch(vstack_ax(stack)->type) {
default:
- printk(KERN_WARNING "unknown register type\n");
+ printk(KERN_WARNING "LTTng: filter: unknown register type\n");
ret = -EINVAL;
goto end;
switch(vstack_ax(stack)->type) {
default:
- printk(KERN_WARNING "unknown register type\n");
+ printk(KERN_WARNING "LTTng: filter: unknown register type\n");
ret = -EINVAL;
goto end;
case REG_STAR_GLOB_STRING:
- printk(KERN_WARNING "invalid register type for > binary operator\n");
+ printk(KERN_WARNING "LTTng: filter: invalid register type for '>' binary operator\n");
ret = -EINVAL;
goto end;
case REG_STRING:
switch(vstack_ax(stack)->type) {
default:
- printk(KERN_WARNING "unknown register type\n");
+ printk(KERN_WARNING "LTTng: filter: unknown register type\n");
ret = -EINVAL;
goto end;
case REG_STAR_GLOB_STRING:
- printk(KERN_WARNING "invalid register type for < binary operator\n");
+ printk(KERN_WARNING "LTTng: filter: invalid register type for '<' binary operator\n");
ret = -EINVAL;
goto end;
case REG_STRING:
switch(vstack_ax(stack)->type) {
default:
- printk(KERN_WARNING "unknown register type\n");
+ printk(KERN_WARNING "LTTng: filter: unknown register type\n");
ret = -EINVAL;
goto end;
case REG_STAR_GLOB_STRING:
- printk(KERN_WARNING "invalid register type for >= binary operator\n");
+ printk(KERN_WARNING "LTTng: filter: invalid register type for '>=' binary operator\n");
ret = -EINVAL;
goto end;
case REG_STRING:
switch(vstack_ax(stack)->type) {
default:
- printk(KERN_WARNING "unknown register type\n");
+ printk(KERN_WARNING "LTTng: filter: unknown register type\n");
ret = -EINVAL;
goto end;
case REG_STAR_GLOB_STRING:
- printk(KERN_WARNING "invalid register type for <= binary operator\n");
+ printk(KERN_WARNING "LTTng: filter: invalid register type for '<=' binary operator\n");
ret = -EINVAL;
goto end;
case REG_STRING:
switch(vstack_ax(stack)->type) {
default:
- printk(KERN_WARNING "unknown register type\n");
+ printk(KERN_WARNING "LTTng: filter: unknown register type\n");
ret = -EINVAL;
goto end;
switch(vstack_ax(stack)->type) {
default:
- printk(KERN_WARNING "unknown register type\n");
+ printk(KERN_WARNING "LTTng: filter: unknown register type\n");
ret = -EINVAL;
goto end;
switch(vstack_ax(stack)->type) {
default:
- printk(KERN_WARNING "unknown register type\n");
+ printk(KERN_WARNING "LTTng: filter: unknown register type\n");
ret = -EINVAL;
goto end;
/* load field ref */
case FILTER_OP_LOAD_FIELD_REF:
{
- printk(KERN_WARNING "Unknown field ref type\n");
+ printk(KERN_WARNING "LTTng: filter: Unknown field ref type\n");
ret = -EINVAL;
goto end;
}
/* get context ref */
case FILTER_OP_GET_CONTEXT_REF:
{
- printk(KERN_WARNING "Unknown get context ref type\n");
+ printk(KERN_WARNING "LTTng: filter: Unknown get context ref type\n");
ret = -EINVAL;
goto end;
}
switch (vstack_ax(stack)->type) {
default:
- printk(KERN_WARNING "unknown register type\n");
+ printk(KERN_WARNING "LTTng: filter: unknown register type\n");
ret = -EINVAL;
goto end;
case REG_STRING:
case REG_STAR_GLOB_STRING:
- printk(KERN_WARNING "Cast op can only be applied to numeric or floating point registers\n");
+ printk(KERN_WARNING "LTTng: filter: Cast op can only be applied to numeric or floating point registers\n");
ret = -EINVAL;
goto end;
case REG_S64:
dbg_printk("op get symbol\n");
switch (vstack_ax(stack)->load.type) {
case LOAD_OBJECT:
- printk(KERN_WARNING "Nested fields not implemented yet.\n");
+ printk(KERN_WARNING "LTTng: filter: Nested fields not implemented yet.\n");
ret = -EINVAL;
goto end;
case LOAD_ROOT_CONTEXT:
/* Lookup context field. */
- ret = specialize_context_lookup(bytecode, insn,
+ ret = specialize_context_lookup(ctx, bytecode, insn,
&vstack_ax(stack)->load);
if (ret)
goto end;
goto end;
case LOAD_ROOT_PAYLOAD:
/* Lookup event payload field. */
- ret = specialize_event_payload_lookup(event,
+ ret = specialize_payload_lookup(event_desc,
bytecode, insn,
&vstack_ax(stack)->load);
if (ret)