From: Mathieu Desnoyers Date: Mon, 3 Dec 2012 15:11:24 +0000 (-0500) Subject: Fix: handle enablers without bytecode X-Git-Tag: v2.1.0~19 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=dcdeaff04c5b8f2c0e69ab896bd170e2762b7f53;p=lttng-ust.git Fix: handle enablers without bytecode to reproduce issue with the upstream "hello" program: lttng create lttng enable-event -u -a --filter 'intfield==42' lttng enable-event -u -a lttng start ./hello lttng stop lttng view only shows event with 42 intfield. We expect all events. Fixes #406 Signed-off-by: Mathieu Desnoyers --- diff --git a/include/lttng/ust-events.h b/include/lttng/ust-events.h index 331506bd..c900b894 100644 --- a/include/lttng/ust-events.h +++ b/include/lttng/ust-events.h @@ -351,7 +351,7 @@ struct lttng_event { /* LTTng-UST 2.1 starts here */ /* list of struct lttng_bytecode_runtime, sorted by seqnum */ struct cds_list_head bytecode_runtime_head; - + int has_enablers_without_bytecode; /* Backward references: list of lttng_enabler_ref (ref to enablers) */ struct cds_list_head enablers_ref_head; }; diff --git a/include/lttng/ust-tracepoint-event.h b/include/lttng/ust-tracepoint-event.h index c341e043..63d5af03 100644 --- a/include/lttng/ust-tracepoint-event.h +++ b/include/lttng/ust-tracepoint-event.h @@ -489,7 +489,7 @@ void __event_probe__##_provider##___##_name(_TP_ARGS_DATA_PROTO(_args)) \ return; \ if (caa_unlikely(!cds_list_empty(&__event->bytecode_runtime_head))) { \ struct lttng_bytecode_runtime *bc_runtime; \ - int __filter_record = 0; \ + int __filter_record = __event->has_enablers_without_bytecode; \ \ __event_prepare_filter_stack__##_provider##___##_name(__stackvar.__filter_stack_data, \ _TP_ARGS_DATA_VAR(_args)); \ diff --git a/liblttng-ust/lttng-events.c b/liblttng-ust/lttng-events.c index 95082ced..790d14b2 100644 --- a/liblttng-ust/lttng-events.c +++ b/liblttng-ust/lttng-events.c @@ -1379,7 +1379,7 @@ void lttng_session_sync_enablers(struct lttng_session *session) cds_list_for_each_entry(event, &session->events_head, node) { struct lttng_enabler_ref *enabler_ref; struct lttng_bytecode_runtime *runtime; - int enabled = 0; + int enabled = 0, has_enablers_without_bytecode = 0; /* Enable events */ cds_list_for_each_entry(enabler_ref, @@ -1391,6 +1391,17 @@ void lttng_session_sync_enablers(struct lttng_session *session) } event->enabled = enabled; + /* Check if has enablers without bytecode */ + cds_list_for_each_entry(enabler_ref, + &event->enablers_ref_head, node) { + if (cds_list_empty(&enabler_ref->ref->filter_bytecode_head)) { + has_enablers_without_bytecode = 1; + break; + } + } + event->has_enablers_without_bytecode = + has_enablers_without_bytecode; + /* Enable filters */ cds_list_for_each_entry(runtime, &event->bytecode_runtime_head, node) {