From: Mathieu Desnoyers Date: Wed, 5 May 2021 20:08:19 +0000 (-0400) Subject: Add probe descriptor field to enum and event class X-Git-Url: https://git.lttng.org/?p=lttng-ust.git;a=commitdiff_plain;h=2e7160d2113f6f0c5af599963a59ebaab0751320 Add probe descriptor field to enum and event class If future event instances can refer to event classes located in different probe providers, the tracer needs to be able to query the major/minor version of the probe provider containing the class. Likewise for enumerations. Signed-off-by: Mathieu Desnoyers Change-Id: Ifb39a52c70e14ce4d77c247d237d456257072b34 --- diff --git a/include/lttng/ust-events.h b/include/lttng/ust-events.h index b09a6718..6a918f4d 100644 --- a/include/lttng/ust-events.h +++ b/include/lttng/ust-events.h @@ -230,6 +230,7 @@ struct lttng_ust_enum_desc { const char *name; const struct lttng_ust_enum_entry * const *entries; unsigned int nr_entries; + const struct lttng_ust_probe_desc *probe_desc; /* End of base ABI. Fields below should be used after checking struct_size. */ }; @@ -276,6 +277,7 @@ struct lttng_ust_tracepoint_class { size_t nr_fields; void (*probe_callback)(void); const char *signature; /* Argument types/names received */ + const struct lttng_ust_probe_desc *probe_desc; /* End of base ABI. Fields below should be used after checking struct_size. */ }; diff --git a/include/lttng/ust-tracepoint-event.h b/include/lttng/ust-tracepoint-event.h index c6dfed7d..c68f7d98 100644 --- a/include/lttng/ust-tracepoint-event.h +++ b/include/lttng/ust-tracepoint-event.h @@ -329,6 +329,19 @@ static void lttng_ust__event_probe__##_provider##___##_name(LTTNG_UST__TP_ARGS_D #include LTTNG_UST_TRACEPOINT_INCLUDE +/* + * Stage 1.1 of tracepoint event generation. + * + * Declare toplevel descriptor for the whole probe. + * Unlike C, C++ does not allow tentative definitions. Therefore, we + * need to explicitly declare the variable with "extern", using hidden + * visibility to keep this symbol from being exported to the global + * symbol table. + */ + +extern const struct lttng_ust_probe_desc LTTNG_UST__TP_COMBINE_TOKENS(lttng_ust__probe_desc___, LTTNG_UST_TRACEPOINT_PROVIDER) + __attribute__((visibility("hidden"))); + /* * Stage 2 of tracepoint event generation. * @@ -461,6 +474,7 @@ static void lttng_ust__event_probe__##_provider##___##_name(LTTNG_UST__TP_ARGS_D .nr_fields = LTTNG_UST__TP_ARRAY_SIZE(lttng_ust__event_fields___##_provider##___##_name) - 1, \ .probe_callback = (void (*)(void)) <tng_ust__event_probe__##_provider##___##_name, \ .signature = __tp_event_signature___##_provider##___##_name, \ + .probe_desc = <tng_ust__probe_desc___##_provider, \ }; #undef LTTNG_UST_TRACEPOINT_ENUM @@ -470,6 +484,7 @@ static void lttng_ust__event_probe__##_provider##___##_name(LTTNG_UST__TP_ARGS_D .name = #_provider "_" #_name, \ .entries = __enum_values__##_provider##_##_name, \ .nr_entries = LTTNG_UST__TP_ARRAY_SIZE(__enum_values__##_provider##_##_name) - 1, \ + .probe_desc = <tng_ust__probe_desc___##_provider, \ }; #include LTTNG_UST_TRACEPOINT_INCLUDE @@ -1075,19 +1090,6 @@ LTTNG_UST_TP_EXTERN_C const char * const _model_emf_uri___##__provider##___##__n /* * Stage 7.0 of tracepoint event generation. * - * Declare toplevel descriptor for the whole probe. - * Unlike C, C++ does not allow tentative definitions. Therefore, we - * need to explicitly declare the variable with "extern", using hidden - * visibility to keep this symbol from being exported to the global - * symbol table. - */ - -extern const struct lttng_ust_probe_desc LTTNG_UST__TP_COMBINE_TOKENS(lttng_ust__probe_desc___, LTTNG_UST_TRACEPOINT_PROVIDER) - __attribute__((visibility("hidden"))); - -/* - * Stage 7.1 of tracepoint event generation. - * * Create events description structures. We use a weakref because * loglevels are optional. If not declared, the event will point to * a loglevel that contains NULL. @@ -1122,7 +1124,7 @@ static const struct lttng_ust_event_desc lttng_ust__event_desc___##_provider##_# #include LTTNG_UST_TRACEPOINT_INCLUDE /* - * Stage 7.2 of tracepoint event generation. + * Stage 7.1 of tracepoint event generation. * * Create array of events. */