Implement capturing payload on event notifier
[lttng-modules.git] / include / lttng / tracepoint-event-impl.h
index d6448f0bdb37e742cb9c2155193070f83e47a471..079d7d37006e9e677f1ae5d16d33e680378993f7 100644 (file)
@@ -822,7 +822,7 @@ error:                                                                            \
 #undef LTTNG_TRACEPOINT_EVENT_CLASS_CODE_NOARGS
 #define LTTNG_TRACEPOINT_EVENT_CLASS_CODE_NOARGS(_name, _locvar, _code_pre, _fields, _code_post) \
 static inline                                                                \
-void __event_prepare_filter_stack__##_name(char *__stack_data,               \
+void __event_prepare_interpreter_stack__##_name(char *__stack_data,                  \
                void *__tp_locvar)                                            \
 {                                                                            \
        struct { _locvar } *tp_locvar __attribute__((unused)) = __tp_locvar;  \
@@ -833,7 +833,7 @@ void __event_prepare_filter_stack__##_name(char *__stack_data,                    \
 #undef LTTNG_TRACEPOINT_EVENT_CLASS_CODE
 #define LTTNG_TRACEPOINT_EVENT_CLASS_CODE(_name, _proto, _args, _locvar, _code_pre, _fields, _code_post) \
 static inline                                                                \
-void __event_prepare_filter_stack__##_name(char *__stack_data,               \
+void __event_prepare_interpreter_stack__##_name(char *__stack_data,                  \
                void *__tp_locvar, _proto)                                    \
 {                                                                            \
        struct { _locvar } *tp_locvar __attribute__((unused)) = __tp_locvar;  \
@@ -1242,15 +1242,15 @@ static void __event_probe__##_name(void *__data, _proto)                      \
        __orig_dynamic_len_offset = this_cpu_ptr(&lttng_dynamic_len_stack)->offset; \
        __dynamic_len_idx = __orig_dynamic_len_offset;                        \
        _code_pre                                                             \
-       if (unlikely(!list_empty(&__event->bytecode_runtime_head))) {         \
+       if (unlikely(!list_empty(&__event->filter_bytecode_runtime_head))) {          \
                struct lttng_bytecode_runtime *bc_runtime;                    \
                int __filter_record = __event->has_enablers_without_bytecode; \
                                                                              \
-               __event_prepare_filter_stack__##_name(__stackvar.__filter_stack_data, \
+               __event_prepare_interpreter_stack__##_name(__stackvar.__filter_stack_data, \
                                tp_locvar, _args);                                    \
-               lttng_list_for_each_entry_rcu(bc_runtime, &__event->bytecode_runtime_head, node) { \
-                       if (unlikely(bc_runtime->filter(bc_runtime, &__lttng_probe_ctx,       \
-                                       __stackvar.__filter_stack_data) & LTTNG_FILTER_RECORD_FLAG)) { \
+               lttng_list_for_each_entry_rcu(bc_runtime, &__event->filter_bytecode_runtime_head, node) { \
+                       if (unlikely(bc_runtime->interpreter_funcs.filter(bc_runtime, &__lttng_probe_ctx,             \
+                                       __stackvar.__filter_stack_data) & LTTNG_INTERPRETER_RECORD_FLAG)) { \
                                __filter_record = 1;                          \
                                break;                                        \
                        }                                                     \
@@ -1338,15 +1338,15 @@ static void __event_probe__##_name(void *__data)                              \
        __orig_dynamic_len_offset = this_cpu_ptr(&lttng_dynamic_len_stack)->offset; \
        __dynamic_len_idx = __orig_dynamic_len_offset;                        \
        _code_pre                                                             \
-       if (unlikely(!list_empty(&__event->bytecode_runtime_head))) {         \
+       if (unlikely(!list_empty(&__event->filter_bytecode_runtime_head))) {          \
                struct lttng_bytecode_runtime *bc_runtime;                    \
                int __filter_record = __event->has_enablers_without_bytecode; \
                                                                              \
-               __event_prepare_filter_stack__##_name(__stackvar.__filter_stack_data, \
+               __event_prepare_interpreter_stack__##_name(__stackvar.__filter_stack_data, \
                                tp_locvar);                                   \
-               lttng_list_for_each_entry_rcu(bc_runtime, &__event->bytecode_runtime_head, node) { \
-                       if (unlikely(bc_runtime->filter(bc_runtime, &__lttng_probe_ctx, \
-                                       __stackvar.__filter_stack_data) & LTTNG_FILTER_RECORD_FLAG)) { \
+               lttng_list_for_each_entry_rcu(bc_runtime, &__event->filter_bytecode_runtime_head, node) { \
+                       if (unlikely(bc_runtime->interpreter_funcs.filter(bc_runtime, &__lttng_probe_ctx,       \
+                                       __stackvar.__filter_stack_data) & LTTNG_INTERPRETER_RECORD_FLAG)) { \
                                __filter_record = 1;                          \
                                break;                                        \
                        }                                                     \
@@ -1425,7 +1425,7 @@ static void __event_notifier_probe__##_name(void *__data, _proto)       \
        };                                                                    \
        union {                                                               \
                size_t __dynamic_len_removed[ARRAY_SIZE(__event_fields___##_name)];   \
-               char __filter_stack_data[2 * sizeof(unsigned long) * ARRAY_SIZE(__event_fields___##_name)]; \
+               char __interpreter_stack_data[2 * sizeof(unsigned long) * ARRAY_SIZE(__event_fields___##_name)]; \
        } __stackvar;                                                         \
        struct probe_local_vars __tp_locvar;                                  \
        struct probe_local_vars *tp_locvar __attribute__((unused)) =          \
@@ -1434,22 +1434,30 @@ static void __event_notifier_probe__##_name(void *__data, _proto)             \
        if (unlikely(!READ_ONCE(__event_notifier->enabled)))                  \
                return;                                                       \
        _code_pre                                                             \
-       if (unlikely(!list_empty(&__event_notifier->bytecode_runtime_head))) {          \
-               struct lttng_bytecode_runtime *bc_runtime;                              \
+       if (unlikely(!list_empty(&__event_notifier->filter_bytecode_runtime_head))) {   \
+               struct lttng_bytecode_runtime *bc_runtime;                    \
                int __filter_record = __event_notifier->has_enablers_without_bytecode;  \
-                                                                                       \
-               __event_prepare_filter_stack__##_name(__stackvar.__filter_stack_data,   \
-                               tp_locvar, _args);                                      \
-               lttng_list_for_each_entry_rcu(bc_runtime, &__event_notifier->bytecode_runtime_head, node) { \
-                       if (unlikely(bc_runtime->filter(bc_runtime, &__lttng_probe_ctx, \
-                                       __stackvar.__filter_stack_data) & LTTNG_FILTER_RECORD_FLAG)) \
+                                                                             \
+               __event_prepare_interpreter_stack__##_name(__stackvar.__interpreter_stack_data, \
+                               tp_locvar, _args);                            \
+               lttng_list_for_each_entry_rcu(bc_runtime, &__event_notifier->filter_bytecode_runtime_head, node) { \
+                       if (unlikely(bc_runtime->interpreter_funcs.filter(bc_runtime, &__lttng_probe_ctx,       \
+                                       __stackvar.__interpreter_stack_data) & LTTNG_INTERPRETER_RECORD_FLAG))  \
                                __filter_record = 1;                          \
                }                                                             \
                if (likely(!__filter_record))                                 \
                        goto __post;                                          \
        }                                                                     \
                                                                              \
-       __event_notifier->send_notification(__event_notifier);                \
+       if (unlikely(!list_empty(&__event_notifier->capture_bytecode_runtime_head)))    \
+               __event_prepare_interpreter_stack__##_name(                   \
+                               __stackvar.__interpreter_stack_data,          \
+                               tp_locvar, _args);                            \
+                                                                             \
+       __event_notifier->send_notification(__event_notifier,                 \
+                       &__lttng_probe_ctx,                                   \
+                       __stackvar.__interpreter_stack_data);                 \
+                                                                             \
 __post:                                                                              \
        _code_post                                                            \
        return;                                                               \
@@ -1468,7 +1476,7 @@ static void __event_notifier_probe__##_name(void *__data)               \
        };                                                                    \
        union {                                                               \
                size_t __dynamic_len_removed[ARRAY_SIZE(__event_fields___##_name)];   \
-               char __filter_stack_data[2 * sizeof(unsigned long) * ARRAY_SIZE(__event_fields___##_name)]; \
+               char __interpreter_stack_data[2 * sizeof(unsigned long) * ARRAY_SIZE(__event_fields___##_name)]; \
        } __stackvar;                                                         \
        struct probe_local_vars __tp_locvar;                                  \
        struct probe_local_vars *tp_locvar __attribute__((unused)) =          \
@@ -1477,22 +1485,29 @@ static void __event_notifier_probe__##_name(void *__data)                     \
        if (unlikely(!READ_ONCE(__event_notifier->enabled)))                  \
                return;                                                       \
        _code_pre                                                             \
-       if (unlikely(!list_empty(&__event_notifier->bytecode_runtime_head))) {                \
-               struct lttng_bytecode_runtime *bc_runtime;                                    \
-               int __filter_record = __event_notifier->has_enablers_without_bytecode;        \
-                                                                                             \
-               __event_prepare_filter_stack__##_name(__stackvar.__filter_stack_data,         \
-                               tp_locvar);                                                   \
-               lttng_list_for_each_entry_rcu(bc_runtime, &__event_notifier->bytecode_runtime_head, node) { \
-                       if (unlikely(bc_runtime->filter(bc_runtime, &__lttng_probe_ctx,       \
-                                       __stackvar.__filter_stack_data) & LTTNG_FILTER_RECORD_FLAG)) \
+       if (unlikely(!list_empty(&__event_notifier->filter_bytecode_runtime_head))) {   \
+               struct lttng_bytecode_runtime *bc_runtime;                    \
+               int __filter_record = __event_notifier->has_enablers_without_bytecode;  \
+                                                                             \
+               __event_prepare_interpreter_stack__##_name(__stackvar.__interpreter_stack_data, \
+                               tp_locvar);                                   \
+               lttng_list_for_each_entry_rcu(bc_runtime, &__event_notifier->filter_bytecode_runtime_head, node) { \
+                       if (unlikely(bc_runtime->interpreter_funcs.filter(bc_runtime, &__lttng_probe_ctx,       \
+                                       __stackvar.__interpreter_stack_data) & LTTNG_INTERPRETER_RECORD_FLAG))  \
                                __filter_record = 1;                          \
                }                                                             \
                if (likely(!__filter_record))                                 \
                        goto __post;                                          \
        }                                                                     \
                                                                              \
-       __event_notifier->send_notification(__event_notifier);                \
+       if (unlikely(!list_empty(&__event_notifier->capture_bytecode_runtime_head)))  \
+               __event_prepare_interpreter_stack__##_name(                   \
+                               __stackvar.__interpreter_stack_data,          \
+                               tp_locvar);                                   \
+                                                                             \
+       __event_notifier->send_notification(__event_notifier,                 \
+                       &__lttng_probe_ctx,                                   \
+                       __stackvar.__interpreter_stack_data);                 \
 __post:                                                                              \
        _code_post                                                            \
        return;                                                               \
This page took 0.027831 seconds and 4 git commands to generate.