X-Git-Url: http://git.lttng.org./?a=blobdiff_plain;ds=sidebyside;f=src%2Fbin%2Flttng%2Fcommands%2Fadd_trigger.c;h=9ae8263c64a3a396e1b385d459ba996bf93474f1;hb=a3c516531ffff69b8d5f6564c8e4d00b4f18e7da;hp=19a1c59e76e80a960f95d8223711a91465206aa9;hpb=20a01d1592c8e83d2dfe51cbd192857537ae7d4e;p=lttng-tools.git diff --git a/src/bin/lttng/commands/add_trigger.c b/src/bin/lttng/commands/add_trigger.c index 19a1c59e7..9ae8263c6 100644 --- a/src/bin/lttng/commands/add_trigger.c +++ b/src/bin/lttng/commands/add_trigger.c @@ -237,7 +237,7 @@ static int parse_kernel_probe_opts(const char *source, *location = lttng_kernel_probe_location_symbol_create( symbol_name, offset); - if (!location) { + if (!*location) { ERR("Failed to create symbol kernel probe location."); goto error; } @@ -301,13 +301,16 @@ end: static struct lttng_event_expr *ir_op_load_expr_to_event_expr( - const struct ir_load_expression *load_exp, const char *capture_str) + const struct ir_load_expression *load_expr, + const char *capture_str) { char *provider_name = NULL; struct lttng_event_expr *event_expr = NULL; - const struct ir_load_expression_op *load_expr_op = load_exp->child; + const struct ir_load_expression_op *load_expr_op = load_expr->child; + const enum ir_load_expression_type load_expr_child_type = + load_expr_op->type; - switch (load_expr_op->type) { + switch (load_expr_child_type) { case IR_LOAD_EXPRESSION_GET_PAYLOAD_ROOT: case IR_LOAD_EXPRESSION_GET_CONTEXT_ROOT: { @@ -319,12 +322,12 @@ struct lttng_event_expr *ir_op_load_expr_to_event_expr( field_name = load_expr_op->u.symbol; assert(field_name); - event_expr = load_expr_op->type == IR_LOAD_EXPRESSION_GET_PAYLOAD_ROOT ? + event_expr = load_expr_child_type == IR_LOAD_EXPRESSION_GET_PAYLOAD_ROOT ? lttng_event_expr_event_payload_field_create(field_name) : lttng_event_expr_channel_context_field_create(field_name); if (!event_expr) { ERR("Failed to create %s event expression: field name = `%s`.", - load_expr_op->type == IR_LOAD_EXPRESSION_GET_PAYLOAD_ROOT ? + load_expr_child_type == IR_LOAD_EXPRESSION_GET_PAYLOAD_ROOT ? "payload field" : "channel context", field_name); goto error; @@ -631,7 +634,7 @@ struct parse_event_rule_res parse_event_rule(int *argc, const char ***argv) break; case OPT_PROBE: if (!assign_event_rule_type(&event_rule_type, - LTTNG_EVENT_RULE_TYPE_KPROBE)) { + LTTNG_EVENT_RULE_TYPE_KERNEL_PROBE)) { goto error; } @@ -814,7 +817,7 @@ struct parse_event_rule_res parse_event_rule(int *argc, const char ***argv) /* Validate event rule type against domain. */ switch (event_rule_type) { - case LTTNG_EVENT_RULE_TYPE_KPROBE: + case LTTNG_EVENT_RULE_TYPE_KERNEL_PROBE: case LTTNG_EVENT_RULE_TYPE_KRETPROBE: case LTTNG_EVENT_RULE_TYPE_UPROBE: case LTTNG_EVENT_RULE_TYPE_SYSCALL: @@ -952,12 +955,12 @@ struct parse_event_rule_res parse_event_rule(int *argc, const char ***argv) break; } - case LTTNG_EVENT_RULE_TYPE_KPROBE: + case LTTNG_EVENT_RULE_TYPE_KERNEL_PROBE: { int ret; enum lttng_event_rule_status event_rule_status; - res.er = lttng_event_rule_kprobe_create(); + res.er = lttng_event_rule_kernel_probe_create(); if (!res.er) { ERR("Failed to create kprobe event rule."); goto error; @@ -969,14 +972,14 @@ struct parse_event_rule_res parse_event_rule(int *argc, const char ***argv) goto error; } - event_rule_status = lttng_event_rule_kprobe_set_name(res.er, tracepoint_name); + event_rule_status = lttng_event_rule_kernel_probe_set_name(res.er, tracepoint_name); if (event_rule_status != LTTNG_EVENT_RULE_STATUS_OK) { ERR("Failed to set kprobe event rule's name to '%s'.", tracepoint_name); goto error; } assert(kernel_probe_location); - event_rule_status = lttng_event_rule_kprobe_set_location(res.er, kernel_probe_location); + event_rule_status = lttng_event_rule_kernel_probe_set_location(res.er, kernel_probe_location); if (event_rule_status != LTTNG_EVENT_RULE_STATUS_OK) { ERR("Failed to set kprobe event rule's location."); goto error; @@ -1112,6 +1115,10 @@ struct lttng_condition *handle_condition_event(int *argc, const char ***argv) status = lttng_condition_event_rule_append_capture_descriptor( c, *expr); if (status != LTTNG_CONDITION_STATUS_OK) { + if (status == LTTNG_CONDITION_STATUS_UNSUPPORTED) { + ERR("The capture feature is unsupported by the event-rule condition type"); + } + goto error; }