dynamic-type: remove underscore prefix from mapping names
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Fri, 29 Jul 2022 19:32:57 +0000 (15:32 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fri, 13 Jan 2023 14:46:31 +0000 (09:46 -0500)
Dynamic types are expressed by LTTng-UST as a variant + its tag.
Currenly (v2.13 and older), the names of the variant's choices and the
enumeration's entries do not match: enumeration entry names are prefixed
with an underscore.

This worked with older versions of LTTng-tools since all fields in the
TSDL metadata were "escaped" by prepending an underscore, causing the
variant choices to match the enumeration mapping names.

Following a rewrite of the TSDL producer, that no longer systematically
prepends an underscore, I noticed this discrepancy.

Newer LTTng-tools versions using the v10 protocol will assume that a
variant field's choices matches its tag's mapping names exactly, while a
work-around for older supported versions (8 and 9) will strip the
leading underscores from the enumeration mapping names when this
specified combination is found.

Note that the "oldest compatible" version remains unchanged as this
change is not ABI breaking.

There is one scenario where this fix can cause problem: running an older
LTTng-tools (e.g. 2.13) linked against a recent LTTng-UST (2.14+). This
configuration is _not_ supported and versions are properly checked at
build time by LTTng-tools.

In that problematic case, the older LTTng-tools would expect the
enumeration mappings to be prefixed with an underscore and produce an
invalid CTF trace.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Ia7e78096a9c31cd4c0574d599c961067d8f03791

include/lttng/ust-abi.h
src/common/dynamic-type.c

index bc699a0c708942de399b158ad299b7af0cf8f979..1342ca168e74aa6552cf877496436dde4d9836fd 100644 (file)
@@ -19,7 +19,7 @@
 #define LTTNG_UST_ABI_COMM_MAGIC                       0xC57C57C5
 
 /* Version for ABI between liblttng-ust, sessiond, consumerd */
-#define LTTNG_UST_ABI_MAJOR_VERSION                    9
+#define LTTNG_UST_ABI_MAJOR_VERSION                    10
 #define LTTNG_UST_ABI_MAJOR_VERSION_OLDEST_COMPATIBLE  8
 #define LTTNG_UST_ABI_MINOR_VERSION            0
 
index 9350265c733becf95db13add7463f305260b948b..830894b8e758993f7235c0bcf4fad45880e09f1f 100644 (file)
        }),
 
 static const struct lttng_ust_enum_entry *dt_enum[_NR_LTTNG_UST_DYNAMIC_TYPES] = {
-       [LTTNG_UST_DYNAMIC_TYPE_NONE] = lttng_ust_field_enum_value("_none", 0)
-       [LTTNG_UST_DYNAMIC_TYPE_S8] = lttng_ust_field_enum_value("_int8", 1)
-       [LTTNG_UST_DYNAMIC_TYPE_S16] = lttng_ust_field_enum_value("_int16", 2)
-       [LTTNG_UST_DYNAMIC_TYPE_S32] = lttng_ust_field_enum_value("_int32", 3)
-       [LTTNG_UST_DYNAMIC_TYPE_S64] = lttng_ust_field_enum_value("_int64", 4)
-       [LTTNG_UST_DYNAMIC_TYPE_U8] = lttng_ust_field_enum_value("_uint8", 5)
-       [LTTNG_UST_DYNAMIC_TYPE_U16] = lttng_ust_field_enum_value("_uint16", 6)
-       [LTTNG_UST_DYNAMIC_TYPE_U32] = lttng_ust_field_enum_value("_uint32", 7)
-       [LTTNG_UST_DYNAMIC_TYPE_U64] = lttng_ust_field_enum_value("_uint64", 8)
-       [LTTNG_UST_DYNAMIC_TYPE_FLOAT] = lttng_ust_field_enum_value("_float", 9)
-       [LTTNG_UST_DYNAMIC_TYPE_DOUBLE] = lttng_ust_field_enum_value("_double", 10)
-       [LTTNG_UST_DYNAMIC_TYPE_STRING] = lttng_ust_field_enum_value("_string", 11)
+       [LTTNG_UST_DYNAMIC_TYPE_NONE] = lttng_ust_field_enum_value("none", 0)
+       [LTTNG_UST_DYNAMIC_TYPE_S8] = lttng_ust_field_enum_value("int8", 1)
+       [LTTNG_UST_DYNAMIC_TYPE_S16] = lttng_ust_field_enum_value("int16", 2)
+       [LTTNG_UST_DYNAMIC_TYPE_S32] = lttng_ust_field_enum_value("int32", 3)
+       [LTTNG_UST_DYNAMIC_TYPE_S64] = lttng_ust_field_enum_value("int64", 4)
+       [LTTNG_UST_DYNAMIC_TYPE_U8] = lttng_ust_field_enum_value("uint8", 5)
+       [LTTNG_UST_DYNAMIC_TYPE_U16] = lttng_ust_field_enum_value("uint16", 6)
+       [LTTNG_UST_DYNAMIC_TYPE_U32] = lttng_ust_field_enum_value("uint32", 7)
+       [LTTNG_UST_DYNAMIC_TYPE_U64] = lttng_ust_field_enum_value("uint64", 8)
+       [LTTNG_UST_DYNAMIC_TYPE_FLOAT] = lttng_ust_field_enum_value("float", 9)
+       [LTTNG_UST_DYNAMIC_TYPE_DOUBLE] = lttng_ust_field_enum_value("double", 10)
+       [LTTNG_UST_DYNAMIC_TYPE_STRING] = lttng_ust_field_enum_value("string", 11)
 };
 
 static struct lttng_ust_enum_desc dt_enum_desc = {
This page took 0.026065 seconds and 4 git commands to generate.