sessiond: ust: conditionally enable the underscore prefix variant quirk
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Mon, 28 Nov 2022 23:02:44 +0000 (18:02 -0500)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Thu, 12 Jan 2023 21:22:12 +0000 (16:22 -0500)
commitb6bbb1d666531bf061f29884da1b0d7c10f59aa0
treea1d0c7097e713637421b8a22e1a724d8f97e1610
parent88277a52069ed0135254ce29da617ebb6ecddbb8
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 <jeremie.galarneau@efficios.com>
Change-Id: Ib61eafc452338a99a02b9829cbd049cb6fa48ead
Depends-on: lttng-ust: Ia7e78096a9c31cd4c0574d599c961067d8f03791
src/bin/lttng-sessiond/field.cpp
src/bin/lttng-sessiond/field.hpp
src/bin/lttng-sessiond/tsdl-trace-class-visitor.cpp
src/bin/lttng-sessiond/tsdl-trace-class-visitor.hpp
src/bin/lttng-sessiond/ust-app.cpp
src/bin/lttng-sessiond/ust-app.hpp
src/common/Makefile.am
src/common/exception.cpp
src/common/exception.hpp
src/common/scope-exit.hpp [new file with mode: 0644]
This page took 0.025741 seconds and 4 git commands to generate.