publish_field_fn publish_field,
lookup_field_fn lookup_field,
lst::field_location::root lookup_root,
- lst::field_location::elements& current_field_location_elements);
+ lst::field_location::elements& current_field_location_elements,
+ lsu::ctl_field_quirks quirks);
void create_field_from_ust_ctl_fields(const lttng_ust_ctl_field *current,
const lttng_ust_ctl_field *end,
publish_field_fn publish_field,
lookup_field_fn lookup_field,
lst::field_location::root lookup_root,
- lst::field_location::elements& current_field_location_elements);
+ lst::field_location::elements& current_field_location_elements,
+ lsu::ctl_field_quirks quirks);
template <class UstCtlEncodingType>
enum lst::null_terminated_string_type::encoding ust_ctl_encoding_to_string_field_encoding(UstCtlEncodingType encoding)
lst::type::cuptr create_integer_type_from_ust_ctl_fields(const lttng_ust_ctl_field *current,
const lttng_ust_ctl_field *end,
const session_attributes& session_attributes,
- const lttng_ust_ctl_field **next_ust_ctl_field)
+ const lttng_ust_ctl_field **next_ust_ctl_field,
+ lsu::ctl_field_quirks quirks __attribute__((unused)))
{
if (current >= end) {
LTTNG_THROW_PROTOCOL_ERROR(
lst::type::cuptr create_floating_point_type_from_ust_ctl_fields(const lttng_ust_ctl_field *current,
const lttng_ust_ctl_field *end,
const session_attributes& session_attributes,
- const lttng_ust_ctl_field **next_ust_ctl_field)
+ const lttng_ust_ctl_field **next_ust_ctl_field,
+ lsu::ctl_field_quirks quirks __attribute__((unused)))
{
if (current >= end) {
LTTNG_THROW_PROTOCOL_ERROR(
lst::type::cuptr create_enumeration_type_from_ust_ctl_fields(const lttng_ust_ctl_field *current,
const lttng_ust_ctl_field *end,
const session_attributes& session_attributes,
- const lttng_ust_ctl_field **next_ust_ctl_field)
+ const lttng_ust_ctl_field **next_ust_ctl_field,
+ lsu::ctl_field_quirks quirks __attribute__((unused)))
{
if (current >= end) {
LTTNG_THROW_PROTOCOL_ERROR(
lst::type::cuptr create_string_type_from_ust_ctl_fields(const lttng_ust_ctl_field *current,
const lttng_ust_ctl_field *end,
const session_attributes& session_attributes __attribute__((unused)),
- const lttng_ust_ctl_field **next_ust_ctl_field)
+ const lttng_ust_ctl_field **next_ust_ctl_field,
+ lsu::ctl_field_quirks quirks __attribute__((unused)))
{
if (current >= end) {
LTTNG_THROW_PROTOCOL_ERROR(
lst::type::cuptr create_array_type_from_ust_ctl_fields(const lttng_ust_ctl_field *current,
const lttng_ust_ctl_field *end,
const session_attributes& session_attributes,
- const lttng_ust_ctl_field **next_ust_ctl_field)
+ const lttng_ust_ctl_field **next_ust_ctl_field,
+ lsu::ctl_field_quirks quirks __attribute__((unused)))
{
if (current >= end) {
LTTNG_THROW_PROTOCOL_ERROR(
publish_field_fn publish_field,
lookup_field_fn lookup_field,
lst::field_location::root lookup_root,
- lst::field_location::elements ¤t_field_location_elements)
+ lst::field_location::elements ¤t_field_location_elements,
+ lsu::ctl_field_quirks quirks)
{
if (current >= end) {
LTTNG_THROW_PROTOCOL_ERROR(
/* next_ust_ctl_field is updated as needed. */
element_type = create_type_from_ust_ctl_fields(&element_uctl_field, end, session_attributes,
next_ust_ctl_field, publish_field, lookup_field, lookup_root,
- current_field_location_elements);
+ current_field_location_elements, quirks);
if (element_uctl_field.type.atype == lttng_ust_ctl_atype_integer &&
element_uctl_field.type.u.integer.encoding != lttng_ust_ctl_encode_none) {
/* Element represents a text character. */
const lttng_ust_ctl_field **next_ust_ctl_field,
publish_field_fn publish_field,
lst::field_location::root lookup_root,
- lst::field_location::elements ¤t_field_location_elements)
+ lst::field_location::elements ¤t_field_location_elements,
+ lsu::ctl_field_quirks quirks __attribute__((unused)))
{
if (current >= end) {
LTTNG_THROW_PROTOCOL_ERROR(
publish_field_fn publish_field,
lookup_field_fn lookup_field,
lst::field_location::root lookup_root,
- lst::field_location::elements ¤t_field_location_elements)
+ lst::field_location::elements ¤t_field_location_elements,
+ lsu::ctl_field_quirks quirks)
{
if (current >= end) {
LTTNG_THROW_PROTOCOL_ERROR(
/* next_ust_ctl_field is updated as needed. */
auto element_type = create_type_from_ust_ctl_fields(&element_uctl_field, end,
session_attributes, next_ust_ctl_field, publish_field, lookup_field,
- lookup_root, current_field_location_elements);
+ lookup_root, current_field_location_elements, quirks);
if (lttng_strnlen(sequence_uctl_field.type.u.sequence_nestable.length_name,
sizeof(sequence_uctl_field.type.u.sequence_nestable.length_name)) ==
lst::type::cuptr create_structure_field_from_ust_ctl_fields(const lttng_ust_ctl_field *current,
const lttng_ust_ctl_field *end,
const session_attributes& session_attributes __attribute__((unused)),
- const lttng_ust_ctl_field **next_ust_ctl_field)
+ const lttng_ust_ctl_field **next_ust_ctl_field,
+ lsu::ctl_field_quirks quirks __attribute__((unused)))
{
if (current >= end) {
LTTNG_THROW_PROTOCOL_ERROR(
lst::field_location::root lookup_root,
lst::field_location::elements& current_field_location_elements,
unsigned int choice_count,
- const lst::field& selector_field)
+ const lst::field& selector_field,
+ lsu::ctl_field_quirks quirks)
{
typename lst::variant_type<VariantSelectorMappingIntegerType>::choices choices;
const auto& typed_enumeration = static_cast<
for (unsigned int i = 0; i < choice_count; i++) {
create_field_from_ust_ctl_fields(
current, end, session_attributes, next_ust_ctl_field,
- [&choices, typed_enumeration, &selector_field](
+ [&choices, typed_enumeration, &selector_field, quirks](
lst::field::uptr field) {
/*
* Find the enumeration mapping that matches the
const auto mapping_it = std::find_if(
typed_enumeration.mappings_->begin(),
typed_enumeration.mappings_->end(),
- [&field](const typename std::remove_reference<
+ [&field, quirks](const typename std::remove_reference<
decltype(typed_enumeration)>::type::
mapping& mapping) {
+ if (static_cast<bool>(quirks & lsu::ctl_field_quirks::UNDERSCORE_PREFIXED_VARIANT_TAG_MAPPINGS)) {
+ /*
+ * Check if they match with
+ * a prepended underscore
+ * and, if not, perform the
+ * regular check.
+ */
+ if ((std::string("_") + field->name) == mapping.name) {
+ return true;
+ }
+ }
+
return mapping.name == field->name;
});
choices.emplace_back(*mapping_it, field->move_type());
},
- lookup_field, lookup_root, current_field_location_elements);
+ lookup_field, lookup_root, current_field_location_elements, quirks);
current = *next_ust_ctl_field;
}
const lttng_ust_ctl_field **next_ust_ctl_field,
lookup_field_fn lookup_field,
lst::field_location::root lookup_root,
- lst::field_location::elements ¤t_field_location_elements)
+ lst::field_location::elements ¤t_field_location_elements,
+ lsu::ctl_field_quirks quirks)
{
if (current >= end) {
LTTNG_THROW_PROTOCOL_ERROR(
end, session_attributes, next_ust_ctl_field,
lookup_field, lookup_root,
current_field_location_elements, choice_count,
- selector_field);
+ selector_field, quirks);
return lttng::make_unique<lst::variant_type<int64_t>>(
alignment, std::move(selector_field_location), std::move(choices));
end, session_attributes, next_ust_ctl_field,
lookup_field, lookup_root,
current_field_location_elements, choice_count,
- selector_field);
+ selector_field, quirks);
return lttng::make_unique<lst::variant_type<uint64_t>>(
alignment, std::move(selector_field_location), std::move(choices));
publish_field_fn publish_field,
lookup_field_fn lookup_field,
lst::field_location::root lookup_root,
- lst::field_location::elements ¤t_field_location_elements)
+ lst::field_location::elements& current_field_location_elements,
+ lsu::ctl_field_quirks quirks)
{
switch (current->type.atype) {
case lttng_ust_ctl_atype_integer:
return create_integer_type_from_ust_ctl_fields(
- current, end, session_attributes, next_ust_ctl_field);
+ current, end, session_attributes, next_ust_ctl_field, quirks);
case lttng_ust_ctl_atype_enum:
case lttng_ust_ctl_atype_enum_nestable:
return create_enumeration_type_from_ust_ctl_fields(
- current, end, session_attributes, next_ust_ctl_field);
+ current, end, session_attributes, next_ust_ctl_field, quirks);
case lttng_ust_ctl_atype_float:
return create_floating_point_type_from_ust_ctl_fields(
- current, end, session_attributes, next_ust_ctl_field);
+ current, end, session_attributes, next_ust_ctl_field, quirks);
case lttng_ust_ctl_atype_string:
return create_string_type_from_ust_ctl_fields(
- current, end, session_attributes, next_ust_ctl_field);
+ current, end, session_attributes, next_ust_ctl_field, quirks);
case lttng_ust_ctl_atype_array:
- return create_array_type_from_ust_ctl_fields(current, end, session_attributes,
- next_ust_ctl_field);
+ return create_array_type_from_ust_ctl_fields(
+ current, end, session_attributes, next_ust_ctl_field, quirks);
case lttng_ust_ctl_atype_array_nestable:
return create_array_nestable_type_from_ust_ctl_fields(current, end,
session_attributes, next_ust_ctl_field, publish_field, lookup_field,
- lookup_root, current_field_location_elements);
+ lookup_root, current_field_location_elements, quirks);
case lttng_ust_ctl_atype_sequence:
return create_sequence_type_from_ust_ctl_fields(current, end, session_attributes,
next_ust_ctl_field, publish_field, lookup_root,
- current_field_location_elements);
+ current_field_location_elements, quirks);
case lttng_ust_ctl_atype_sequence_nestable:
return create_sequence_nestable_type_from_ust_ctl_fields(current, end,
session_attributes, next_ust_ctl_field, publish_field, lookup_field,
- lookup_root, current_field_location_elements);
+ lookup_root, current_field_location_elements, quirks);
case lttng_ust_ctl_atype_struct:
case lttng_ust_ctl_atype_struct_nestable:
return create_structure_field_from_ust_ctl_fields(
- current, end, session_attributes, next_ust_ctl_field);
+ current, end, session_attributes, next_ust_ctl_field, quirks);
case lttng_ust_ctl_atype_variant:
case lttng_ust_ctl_atype_variant_nestable:
return create_variant_field_from_ust_ctl_fields(current, end, session_attributes,
next_ust_ctl_field, lookup_field, lookup_root,
- current_field_location_elements);
+ current_field_location_elements, quirks);
default:
LTTNG_THROW_PROTOCOL_ERROR(fmt::format(
"Unknown {} value `{}` encountered while converting {} to {}",
publish_field_fn publish_field,
lookup_field_fn lookup_field,
lst::field_location::root lookup_root,
- lst::field_location::elements& current_field_location_elements)
+ lst::field_location::elements& current_field_location_elements,
+ lsu::ctl_field_quirks quirks)
{
LTTNG_ASSERT(current < end);
publish_field(lttng::make_unique<lst::field>(current->name,
create_type_from_ust_ctl_fields(current, end, session_attributes,
next_ust_ctl_field, publish_field, lookup_field,
- lookup_root, current_field_location_elements)));
+ lookup_root, current_field_location_elements, quirks)));
}
std::vector<lst::field::cuptr>::iterator lookup_field_in_vector(
const lsu::registry_session& session,
const lttng_ust_ctl_field *current,
const lttng_ust_ctl_field *end,
- lst::field_location::root lookup_root)
+ lst::field_location::root lookup_root,
+ lsu::ctl_field_quirks quirks)
{
std::vector<lst::field::cuptr> fields;
const auto trace_native_byte_order = session.abi.byte_order;
create_field_from_ust_ctl_fields(
current, end, session_attributes, &next_field,
[&fields](lst::field::cuptr field) {
- /* Publishing a field simply adds it to the converted fields. */
+ /* Publishing a field simply adds it to the converted
+ * fields. */
fields.emplace_back(std::move(field));
},
[&fields](const lst::field_location& location)
/* Resolve location to a previously-constructed field. */
return **lookup_field_in_vector(fields, location);
},
- lookup_root, current_field_location_elements);
+ lookup_root, current_field_location_elements, quirks);
current = next_field;
}
const lsu::registry_session& session,
const lttng_ust_ctl_field *fields,
std::size_t field_count,
- lst::field_location::root lookup_root)
+ lst::field_location::root lookup_root,
+ lsu::ctl_field_quirks quirks)
{
- return create_fields_from_ust_ctl_fields(session, fields, fields + field_count, lookup_root);
+ return create_fields_from_ust_ctl_fields(
+ session, fields, fields + field_count, lookup_root, quirks);
}