From: Jérémie Galarneau Date: Mon, 28 Nov 2022 23:02:44 +0000 (-0500) Subject: sessiond: ust: conditionally enable the underscore prefix variant quirk X-Git-Url: https://git.lttng.org/?a=commitdiff_plain;h=b6bbb1d666531bf061f29884da1b0d7c10f59aa0;hp=b6bbb1d666531bf061f29884da1b0d7c10f59aa0;p=lttng-tools.git sessiond: ust: conditionally enable the underscore prefix variant quirk Application contexts are expressed as variants. LTTng-UST announces those by registering an enumeration named `..._tag`. It then registers a variant as part of the event context that contains the various possible types. Unfortunately, the names used in the enumeration and variant don't match: the enumeration names are all prefixed with an underscore while the variant type tag fields aren't. While the CTF 1.8.3 specification mentions that underscores *should* (not *must*) be removed by CTF readers. Babeltrace 1.x (and possibly others) expect a perfect match between the names used by tags and variants. When the UNDERSCORE_PREFIXED_VARIANT_TAG_MAPPINGS quirk is enabled, the variant's fields are modified to match the mappings of its tag. From ABI version >= 10.x, the variant fields and tag mapping names correctly match, making this work-around unnecessary. However, since the variants produced by LTTng-UST contain TSDL-unsafe names, a variant/selector sanitization pass is performed before serializing a trace class hierarchy to TSDL. The variant_tsdl_keyword_sanitizer visitor is used to visit field before it is handed-over to the actual TSDL-producing visitor. As it visits fields, the variant_tsdl_keyword_sanitizer populates a "type_overrider" with TSDL-safe replacements for any variant or enumeration that uses TSDL-unsafe identifiers (reserved keywords). The type_overrider, in turn, is used by the rest of the TSDL serialization visitor (tsdl_field_visitor) to swap any TSDL-unsafe types with their sanitized version. The tsdl_field_visitor owns the type_overrider and only briefly shares it with the variant_tsdl_keyword_sanitizer which takes a reference to it. Signed-off-by: Jérémie Galarneau Change-Id: Ib61eafc452338a99a02b9829cbd049cb6fa48ead Depends-on: lttng-ust: Ia7e78096a9c31cd4c0574d599c961067d8f03791 ---