+
#undef __field_full
#define __field_full(_type, _item, _order, _base)
@@ -35,6 +38,9 @@
#undef __string
#define __string(_item, _src)
+#undef __struct
+#define __struct(_provider, _type, _item, _params)
+
#undef tp_assign
#define tp_assign(dest, src)
@@ -47,6 +53,9 @@
#undef tp_strcpy
#define tp_strcpy(dest, src)
+#undef tp_memcpy_struct
+#define tp_memcpy_struct(provider, name, dest, src)
+
#undef __get_str
#define __get_str(field)
@@ -65,6 +74,9 @@
#undef TP_STRUCT__entry
#define TP_STRUCT__entry(args...)
+#undef TP_FIELDS
+#define TP_FIELDS(args...)
+
#undef TP_fast_assign
#define TP_fast_assign(args...)
@@ -94,3 +106,6 @@
#undef TRACE_EVENT_FLAGS
#define TRACE_EVENT_FLAGS(name, value)
+
+#undef TRACEPOINT_STRUCT
+#define TRACEPOINT_STRUCT(_provider, _name, _proto, _args, _fields)
diff --git a/probes/lttng-events.h b/probes/lttng-events.h
index 8a3a886..93f4abc 100644
--- a/probes/lttng-events.h
+++ b/probes/lttng-events.h
@@ -263,9 +263,31 @@ void trace_##_name(void *__data);
#define __string_from_user(_item, _src) \
__string(_item, _src)
+#undef __struct
+#define __struct(_provider, _type, _item, _params) \
+ { \
+ .name = #_item, \
+ .type = \
+ { \
+ .atype = atype_struct, \
+ .u.ctf_struct.provider = #_provider, \
+ .u.ctf_struct.name = #_type, \
+ }, \
+ },
+
#undef TP_STRUCT__entry
#define TP_STRUCT__entry(args...) args /* Only one used in this phase
*/
+#undef TP_FIELDS
+#define TP_FIELDS(args...) args /* Only one used in this phase */
+
+#undef TRACEPOINT_STRUCT
+#define TRACEPOINT_STRUCT(_provider, _name, _proto, _args, _fields) \
+ static const struct lttng_event_field \
+ __struct_fields___##_provider##_##_name[] = { \
+ _fields \
+ };
+
#undef DECLARE_EVENT_CLASS_NOARGS
#define DECLARE_EVENT_CLASS_NOARGS(_name, _tstruct, _assign, _print) \
static const struct lttng_event_field __event_fields___##_name[] = { \
@@ -301,6 +323,74 @@ static void __event_probe__##_name(void *__data);
#include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
/*
+ * Stage 3.2 of the trace events.
+ *
+ * Create type metadata description
+ */
+
+#include "lttng-events-reset.h" /* Reset all macros within TRACE_EVENT */
+
+#undef TRACEPOINT_STRUCT
+#define TRACEPOINT_STRUCT(_provider, _name, _proto, _args, _fields) \
+static struct lttng_struct_desc __struct_desc___##_provider##_##_name = {\
+ .fields = __struct_fields___##_provider##_##_name, \
+ .nr_fields =
ARRAY_SIZE(__struct_fields___##_provider##_##_name),\
+ .provider = #_provider, \
+ .name = #_name, \
+ .owner = THIS_MODULE, \
+ };
+
+#include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
+
+/*
+ * Stage 3.3 of the trace events.
+ *
+ * Associate metadata description to event or event template or other struct
+ */
+
+/* Named field types must be defined in lttng-types.h */
+
+#include "lttng-events-reset.h" /* Reset all macros within TRACE_EVENT */
+
+#undef __struct
+#define __struct(_provider, _type, _item, _params) \
+ { \
+ .mtype = mtype_struct, \
+ .m.ctf_st.struct_desc = &__struct_desc___##_provider##_##_type,\
+ .m.ctf_st.type_metadata =
__type_metadata_for__##_provider##_##_type,\
+ .m.ctf_st.nr_metadata =
ARRAY_SIZE(__type_metadata_for__##_provider##_##_type),\
+ },
+
+
+#undef TP_STRUCT__entry
+#define TP_STRUCT__entry(args...) args /* Only one used in this phase */
+
+#undef TP_FIELDS
+#define TP_FIELDS(args...) args
+
+#undef TRACEPOINT_STRUCT
+#define TRACEPOINT_STRUCT(_provider, _name, _proto, _args, _fields) \
+static const struct lttng_metadata
__type_metadata_for__##_provider##_##_name[] = {\
+ _fields \
+};
+
+
+
+#undef DECLARE_EVENT_CLASS_NOARGS
+#define DECLARE_EVENT_CLASS_NOARGS(_name, _tstruct, _assign, _print) \
+static const struct lttng_metadata __type_metadata_for__##_name[] = { \
+ _tstruct \
+};
+
+#undef DECLARE_EVENT_CLASS
+#define DECLARE_EVENT_CLASS(_name, _proto, _args, _tstruct, _assign, _print) \
+ DECLARE_EVENT_CLASS_NOARGS(_name, PARAMS(_tstruct), PARAMS(_assign), \
+ PARAMS(_print))
+
+#include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
+
+
+/*
* Stage 3.9 of the trace events.
*
* Create event descriptions.
@@ -318,9 +408,11 @@ static void __event_probe__##_name(void *__data);
#define DEFINE_EVENT_MAP_NOARGS(_template, _name, _map)
\
static const struct lttng_event_desc __event_desc___##_map = {
\
.fields = __event_fields___##_template, \
+ .type_metadata = __type_metadata_for__##_template, \
.name = #_map, \
.probe_callback = (void *) TP_PROBE_CB(_template), \
.nr_fields = ARRAY_SIZE(__event_fields___##_template), \
+ .nr_metadata = ARRAY_SIZE(__type_metadata_for__##_template), \
.owner = THIS_MODULE, \
};
@@ -379,9 +471,12 @@ static __used struct lttng_probe_desc TP_ID(__probe_desc___, TRACE_SYSTEM) = {
#undef TP_ID
/*
- * Stage 6 of the trace events.
+ * Stage 6.0 of the trace events.
*
* Create static inline function that calculates event size.
+ *
+ * First stage creates function to calculate sizes of sub-metadata
+ * (with no effect on the dynamic length values)