CTF2 requires type references (a sequence's length, a variant's
selector) to be expressed as absolute field locations.
The `field` API currently expresses these references as names directly
since those are provided by the tracer.
This change introduces the notion of a field location and adapts
the tsdl visitor to serialize those as expected.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I56f603062d6748051adf3fa31bc08422c47c144d
+lst::field_location::field_location(lst::field_location::root in_lookup_root,
+ lst::field_location::elements in_elements) :
+ root_{in_lookup_root}, elements_{std::move(in_elements)}
+{
+}
+
+bool lst::field_location::operator==(const lst::field_location& other) const noexcept
+{
+ return root_ == other.root_ &&
+ elements_ == other.elements_;
+}
+
lst::type::type(unsigned int in_alignment) : alignment{in_alignment}
{
}
lst::type::type(unsigned int in_alignment) : alignment{in_alignment}
{
}
lst::dynamic_length_array_type::dynamic_length_array_type(unsigned int in_alignment,
type::cuptr in_element_type,
lst::dynamic_length_array_type::dynamic_length_array_type(unsigned int in_alignment,
type::cuptr in_element_type,
- std::string in_length_field_name) :
+ lst::field_location in_length_field_location) :
array_type(in_alignment, std::move(in_element_type)),
array_type(in_alignment, std::move(in_element_type)),
- length_field_name{std::move(in_length_field_name)}
+ length_field_location{std::move(in_length_field_location)}
const auto& other = static_cast<decltype(*this)&>(base_other);
return array_type::_is_equal(base_other) &&
const auto& other = static_cast<decltype(*this)&>(base_other);
return array_type::_is_equal(base_other) &&
- this->length_field_name == other.length_field_name;
+ this->length_field_location == other.length_field_location;
}
void lst::dynamic_length_array_type::accept(type_visitor& visitor) const
}
void lst::dynamic_length_array_type::accept(type_visitor& visitor) const
}
lst::dynamic_length_blob_type::dynamic_length_blob_type(
}
lst::dynamic_length_blob_type::dynamic_length_blob_type(
- unsigned int in_alignment, std::string in_length_field_name) :
- type(in_alignment), length_field_name{std::move(in_length_field_name)}
+ unsigned int in_alignment, lst::field_location in_length_field_location) :
+ type(in_alignment), length_field_location{std::move(in_length_field_location)}
{
const auto& other = dynamic_cast<decltype(*this)&>(base_other);
{
const auto& other = dynamic_cast<decltype(*this)&>(base_other);
- return length_field_name == other.length_field_name;
+ return length_field_location == other.length_field_location;
}
void lst::dynamic_length_blob_type::accept(type_visitor& visitor) const
}
void lst::dynamic_length_blob_type::accept(type_visitor& visitor) const
lst::dynamic_length_string_type::dynamic_length_string_type(unsigned int in_alignment,
enum encoding in_encoding,
lst::dynamic_length_string_type::dynamic_length_string_type(unsigned int in_alignment,
enum encoding in_encoding,
- std::string in_length_field_name) :
- string_type(in_alignment, in_encoding), length_field_name{std::move(in_length_field_name)}
+ field_location in_length_field_location) :
+ string_type(in_alignment, in_encoding),
+ length_field_location{std::move(in_length_field_location)}
const auto& other = static_cast<decltype(*this)&>(base_other);
return string_type::_is_equal(base_other) &&
const auto& other = static_cast<decltype(*this)&>(base_other);
return string_type::_is_equal(base_other) &&
- this->length_field_name == other.length_field_name;
+ this->length_field_location == other.length_field_location;
}
void lst::dynamic_length_string_type::accept(type_visitor& visitor) const
}
void lst::dynamic_length_string_type::accept(type_visitor& visitor) const
}
lst::variant_type::variant_type(unsigned int in_alignment,
}
lst::variant_type::variant_type(unsigned int in_alignment,
- std::string in_tag_name,
+ field_location in_selector_field_location,
choices in_choices) :
type(in_alignment),
choices in_choices) :
type(in_alignment),
- tag_name{std::move(in_tag_name)},
- _choices{std::move(in_choices)}
+ selector_field_location{std::move(in_selector_field_location)},
+ _choices
+{std::move(in_choices)}
{
const auto &other = static_cast<decltype(*this)&>(base_other);
{
const auto &other = static_cast<decltype(*this)&>(base_other);
- return this->tag_name == other.tag_name &&
- fields_are_equal(this->_choices, other._choices);
+ return this->selector_field_location == other.selector_field_location &&
+ fields_are_equal(this->_choices
+, other._choices
+);
}
void lst::variant_type::accept(type_visitor& visitor) const
}
void lst::variant_type::accept(type_visitor& visitor) const
+class field_location {
+public:
+ enum class root {
+ PACKET_HEADER,
+ PACKET_CONTEXT,
+ EVENT_RECORD_HEADER,
+ EVENT_RECORD_COMMON_CONTEXT,
+ EVENT_RECORD_SPECIFIC_CONTEXT,
+ EVENT_RECORD_PAYLOAD,
+ };
+
+ using elements = std::vector<std::string>;
+
+ field_location(root lookup_root, elements elements);
+ bool operator==(const field_location& other) const noexcept;
+
+ const root root_;
+ const elements elements_;
+};
+
/*
* Field, and the various field types, represents fields as exposed by the
* LTTng tracers. These classes do not attempt to describe the complete spectrum of the CTF
/*
* Field, and the various field types, represents fields as exposed by the
* LTTng tracers. These classes do not attempt to describe the complete spectrum of the CTF
public:
dynamic_length_array_type(unsigned int alignment,
type::cuptr element_type,
public:
dynamic_length_array_type(unsigned int alignment,
type::cuptr element_type,
- std::string length_field_name);
+ field_location length_field_location);
virtual void accept(type_visitor& visitor) const override final;
virtual void accept(type_visitor& visitor) const override final;
- const std::string length_field_name;
+ const field_location length_field_location;
private:
virtual bool _is_equal(const type& base_other) const noexcept override final;
private:
virtual bool _is_equal(const type& base_other) const noexcept override final;
class dynamic_length_blob_type : public type {
public:
class dynamic_length_blob_type : public type {
public:
- dynamic_length_blob_type(unsigned int alignment, std::string length_field_name);
+ dynamic_length_blob_type(unsigned int alignment, field_location length_field_location);
virtual void accept(type_visitor& visitor) const override final;
virtual void accept(type_visitor& visitor) const override final;
- const std::string length_field_name;
+ const field_location length_field_location;
private:
virtual bool _is_equal(const type& base_other) const noexcept override final;
private:
virtual bool _is_equal(const type& base_other) const noexcept override final;
public:
dynamic_length_string_type(unsigned int alignment,
enum encoding in_encoding,
public:
dynamic_length_string_type(unsigned int alignment,
enum encoding in_encoding,
- std::string length_field_name);
+ field_location length_field_location);
virtual void accept(type_visitor& visitor) const override final;
virtual void accept(type_visitor& visitor) const override final;
- const std::string length_field_name;
+ const field_location length_field_location;
private:
virtual bool _is_equal(const type& base_other) const noexcept override final;
private:
virtual bool _is_equal(const type& base_other) const noexcept override final;
public:
using choices = std::vector<field::cuptr>;
public:
using choices = std::vector<field::cuptr>;
- variant_type(unsigned int alignment, std::string tag_name, choices in_choices);
+ variant_type(unsigned int alignment,
+ field_location selector_field_location,
+ choices in_choices);
virtual void accept(type_visitor& visitor) const override final;
virtual void accept(type_visitor& visitor) const override final;
- const std::string tag_name;
+ const field_location selector_field_location;
private:
virtual bool _is_equal(const type& base_other) const noexcept override final;
private:
virtual bool _is_equal(const type& base_other) const noexcept override final;
type.element_type->accept(*this);
_type_suffixes.emplace(fmt::format("[{}]",
_bypass_identifier_escape ?
type.element_type->accept(*this);
_type_suffixes.emplace(fmt::format("[{}]",
_bypass_identifier_escape ?
- type.length_field_name :
- escape_tsdl_identifier(type.length_field_name)));
+ *(type.length_field_location.elements_.end() - 1) :
+ escape_tsdl_identifier(*(type.length_field_location.elements_.end() - 1))));
}
virtual void visit(const lst::static_length_blob_type& type) override final
}
virtual void visit(const lst::static_length_blob_type& type) override final
_trace_abi.byte_order, 8, lst::integer_type::signedness::UNSIGNED,
lst::integer_type::base::HEXADECIMAL);
const auto array = lttng::make_unique<lst::dynamic_length_array_type>(
_trace_abi.byte_order, 8, lst::integer_type::signedness::UNSIGNED,
lst::integer_type::base::HEXADECIMAL);
const auto array = lttng::make_unique<lst::dynamic_length_array_type>(
- type.alignment, std::move(uint8_element), type.length_field_name);
+ type.alignment, std::move(uint8_element), type.length_field_location);
_indentation_level++;
_description += fmt::format("variant <{}> {{\n",
_bypass_identifier_escape ?
_indentation_level++;
_description += fmt::format("variant <{}> {{\n",
_bypass_identifier_escape ?
- type.tag_name :
- escape_tsdl_identifier(type.tag_name));
+ *(type.selector_field_location.elements_.end() - 1) :
+ escape_tsdl_identifier(*(type.selector_field_location.elements_.end() - 1)));
/*
* The CTF 1.8 specification only recommends that implementations ignore
/*
* The CTF 1.8 specification only recommends that implementations ignore
*/
const auto char_sequence = lttng::make_unique<lst::dynamic_length_array_type>(
type.alignment, create_character_type(type.encoding_),
*/
const auto char_sequence = lttng::make_unique<lst::dynamic_length_array_type>(
type.alignment, create_character_type(type.encoding_),
- type.length_field_name);
+ type.length_field_location);
try {
auto app_context_fields = lsu::create_trace_fields_from_ust_ctl_fields(
*locked_registry_session, ust_ctl_context_fields.get(),
try {
auto app_context_fields = lsu::create_trace_fields_from_ust_ctl_fields(
*locked_registry_session, ust_ctl_context_fields.get(),
+ context_field_count,
+ lst::field_location::root::EVENT_RECORD_COMMON_CONTEXT);
if (!ust_reg_chan.is_registered()) {
lst::type::cuptr event_context = app_context_fields.size() ?
if (!ust_reg_chan.is_registered()) {
lst::type::cuptr event_context = app_context_fields.size() ?
channel.add_event(sobjd, cobjd, name, signature.get(),
lsu::create_trace_fields_from_ust_ctl_fields(
*locked_registry, fields.get(),
channel.add_event(sobjd, cobjd, name, signature.get(),
lsu::create_trace_fields_from_ust_ctl_fields(
*locked_registry, fields.get(),
+ nr_fields,
+ lst::field_location::root::
+ EVENT_RECORD_PAYLOAD),
loglevel_value,
model_emf_uri.get() ?
nonstd::optional<std::string>(
model_emf_uri.get()) :
loglevel_value,
model_emf_uri.get() ?
nonstd::optional<std::string>(
model_emf_uri.get()) :
ua_sess->buffer_type, *app, event_id);
ret_code = 0;
} catch (const std::exception& ex) {
ua_sess->buffer_type, *app, event_id);
ret_code = 0;
} catch (const std::exception& ex) {
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 *end,
const session_attributes& session_attributes,
const lttng_ust_ctl_field **next_ust_ctl_field,
- publish_field_fn publish_field);
+ publish_field_fn publish_field,
+ lst::field_location::root lookup_root,
+ lst::field_location::elements& current_field_location_elements);
void create_field_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,
void create_field_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,
- publish_field_fn publish_field);
+ publish_field_fn publish_field,
+ lst::field_location::root lookup_root,
+ lst::field_location::elements& current_field_location_elements);
template <class UstCtlEncodingType>
enum lst::null_terminated_string_type::encoding ust_ctl_encoding_to_string_field_encoding(UstCtlEncodingType encoding)
template <class UstCtlEncodingType>
enum lst::null_terminated_string_type::encoding ust_ctl_encoding_to_string_field_encoding(UstCtlEncodingType encoding)
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 *end,
const session_attributes& session_attributes,
const lttng_ust_ctl_field **next_ust_ctl_field,
- publish_field_fn publish_field)
+ publish_field_fn publish_field,
+ lst::field_location::root lookup_root,
+ lst::field_location::elements ¤t_field_location_elements)
{
if (current >= end) {
LTTNG_THROW_PROTOCOL_ERROR(
{
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 is updated as needed. */
element_type = create_type_from_ust_ctl_fields(&element_uctl_field, end, session_attributes,
- next_ust_ctl_field, publish_field);
+ next_ust_ctl_field, publish_field, lookup_root,
+ current_field_location_elements);
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. */
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 *end,
const session_attributes& session_attributes,
const lttng_ust_ctl_field **next_ust_ctl_field,
const lttng_ust_ctl_field *end,
const session_attributes& session_attributes,
const lttng_ust_ctl_field **next_ust_ctl_field,
- publish_field_fn publish_field)
+ publish_field_fn publish_field,
+ lst::field_location::root lookup_root,
+ lst::field_location::elements ¤t_field_location_elements)
{
if (current >= end) {
LTTNG_THROW_PROTOCOL_ERROR(
{
if (current >= end) {
LTTNG_THROW_PROTOCOL_ERROR(
auto length_type = create_integer_type_from_ust_ctl_basic_type(
length_uctl_type, session_attributes);
auto length_type = create_integer_type_from_ust_ctl_basic_type(
length_uctl_type, session_attributes);
+ lst::field_location::elements length_field_location_elements =
+ current_field_location_elements;
+ length_field_location_elements.emplace_back(length_field_name);
+
+ const lst::field_location length_field_location{
+ lookup_root, std::move(length_field_location_elements)};
+
/* Publish an implicit length field _before_ the sequence field. */
/* Publish an implicit length field _before_ the sequence field. */
- publish_field(lttng::make_unique<lst::field>(length_field_name, std::move(length_type)));
+ publish_field(lttng::make_unique<lst::field>(std::move(length_field_name), std::move(length_type)));
*next_ust_ctl_field = current + 1;
*next_ust_ctl_field = current + 1;
/* Sequence is a dynamic-length string. */
return lttng::make_unique<lst::dynamic_length_string_type>(sequence_alignment,
/* Sequence is a dynamic-length string. */
return lttng::make_unique<lst::dynamic_length_string_type>(sequence_alignment,
- *element_encoding, std::move(length_field_name));
+ *element_encoding, std::move(length_field_location));
- return lttng::make_unique<lst::dynamic_length_array_type>(
- sequence_alignment, std::move(element_type), std::move(length_field_name));
+ return lttng::make_unique<lst::dynamic_length_array_type>(sequence_alignment,
+ std::move(element_type), std::move(length_field_location));
}
lst::type::cuptr create_sequence_nestable_type_from_ust_ctl_fields(
}
lst::type::cuptr create_sequence_nestable_type_from_ust_ctl_fields(
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 *end,
const session_attributes& session_attributes,
const lttng_ust_ctl_field **next_ust_ctl_field,
- publish_field_fn publish_field)
+ publish_field_fn publish_field,
+ lst::field_location::root lookup_root,
+ lst::field_location::elements ¤t_field_location_elements)
{
if (current >= end) {
LTTNG_THROW_PROTOCOL_ERROR(
{
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,
/* 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);
+ session_attributes, next_ust_ctl_field, publish_field, lookup_root,
+ current_field_location_elements);
if (lttng_strnlen(sequence_uctl_field.type.u.sequence_nestable.length_name,
sizeof(sequence_uctl_field.type.u.sequence_nestable.length_name)) ==
if (lttng_strnlen(sequence_uctl_field.type.u.sequence_nestable.length_name,
sizeof(sequence_uctl_field.type.u.sequence_nestable.length_name)) ==
LTTNG_THROW_PROTOCOL_ERROR("Sequence length field name is not null terminated");
}
LTTNG_THROW_PROTOCOL_ERROR("Sequence length field name is not null terminated");
}
+
+ lst::field_location::elements length_field_location_elements =
+ current_field_location_elements;
+ length_field_location_elements.emplace_back(std::move(length_field_name));
+
+ const lst::field_location length_field_location{
+ lookup_root, std::move(length_field_location_elements)};
+
if (element_encoding) {
const auto integer_element_size =
static_cast<const lst::integer_type&>(*element_type).size;
if (element_encoding) {
const auto integer_element_size =
static_cast<const lst::integer_type&>(*element_type).size;
/* Sqeuence is a dynamic-length string. */
return lttng::make_unique<lst::dynamic_length_string_type>(sequence_alignment,
/* Sqeuence is a dynamic-length string. */
return lttng::make_unique<lst::dynamic_length_string_type>(sequence_alignment,
- *element_encoding, std::move(length_field_name));
+ *element_encoding, std::move(length_field_location));
- return lttng::make_unique<lst::dynamic_length_array_type>(
- sequence_alignment, std::move(element_type), std::move(length_field_name));
+ return lttng::make_unique<lst::dynamic_length_array_type>(sequence_alignment,
+ std::move(element_type), std::move(length_field_location));
}
lst::type::cuptr create_structure_field_from_ust_ctl_fields(const lttng_ust_ctl_field *current,
}
lst::type::cuptr create_structure_field_from_ust_ctl_fields(const lttng_ust_ctl_field *current,
lst::type::cuptr create_variant_field_from_ust_ctl_fields(const lttng_ust_ctl_field *current,
const lttng_ust_ctl_field *end,
const session_attributes& session_attributes,
lst::type::cuptr create_variant_field_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,
+ lst::field_location::root lookup_root,
+ lst::field_location::elements ¤t_field_location_elements)
{
if (current >= end) {
LTTNG_THROW_PROTOCOL_ERROR(
{
if (current >= end) {
LTTNG_THROW_PROTOCOL_ERROR(
tag_name = variant_uctl_field.type.u.variant_nestable.tag_name;
}
tag_name = variant_uctl_field.type.u.variant_nestable.tag_name;
}
+ lst::field_location::elements selector_field_location_elements =
+ current_field_location_elements;
+ selector_field_location_elements.emplace_back(tag_name);
+
+ const lst::field_location selector_field_location{
+ lookup_root, std::move(selector_field_location_elements)};
+
/* Choices follow. next_ust_ctl_field is updated as needed. */
lst::variant_type::choices choices;
for (unsigned int i = 0; i < choice_count; i++) {
/* Choices follow. next_ust_ctl_field is updated as needed. */
lst::variant_type::choices choices;
for (unsigned int i = 0; i < choice_count; i++) {
- create_field_from_ust_ctl_fields(current, end, session_attributes,
- next_ust_ctl_field, [&choices](lst::field::cuptr field) {
+ create_field_from_ust_ctl_fields(
+ current, end, session_attributes, next_ust_ctl_field,
+ [&choices](lst::field::cuptr field) {
choices.emplace_back(std::move(field));
choices.emplace_back(std::move(field));
+ },
+ lookup_root, current_field_location_elements);
current = *next_ust_ctl_field;
}
current = *next_ust_ctl_field;
}
- return lttng::make_unique<lst::variant_type>(alignment, tag_name, std::move(choices));
+ return lttng::make_unique<lst::variant_type>(
+ alignment, std::move(selector_field_location), std::move(choices));
}
lst::type::cuptr create_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,
}
lst::type::cuptr create_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,
- publish_field_fn publish_field)
+ publish_field_fn publish_field,
+ lst::field_location::root lookup_root,
+ lst::field_location::elements ¤t_field_location_elements)
{
switch (current->type.atype) {
case lttng_ust_ctl_atype_integer:
{
switch (current->type.atype) {
case lttng_ust_ctl_atype_integer:
next_ust_ctl_field);
case lttng_ust_ctl_atype_array_nestable:
return create_array_nestable_type_from_ust_ctl_fields(current, end,
next_ust_ctl_field);
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);
+ session_attributes, next_ust_ctl_field, publish_field, lookup_root,
+ current_field_location_elements);
case lttng_ust_ctl_atype_sequence:
return create_sequence_type_from_ust_ctl_fields(current, end, session_attributes,
case lttng_ust_ctl_atype_sequence:
return create_sequence_type_from_ust_ctl_fields(current, end, session_attributes,
- next_ust_ctl_field, publish_field);
+ next_ust_ctl_field, publish_field, lookup_root,
+ current_field_location_elements);
case lttng_ust_ctl_atype_sequence_nestable:
return create_sequence_nestable_type_from_ust_ctl_fields(current, end,
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);
+ session_attributes, next_ust_ctl_field, publish_field, lookup_root,
+ current_field_location_elements);
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);
case lttng_ust_ctl_atype_variant:
case lttng_ust_ctl_atype_variant_nestable:
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);
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);
+ return create_variant_field_from_ust_ctl_fields(current, end, session_attributes,
+ next_ust_ctl_field, lookup_root, current_field_location_elements);
default:
LTTNG_THROW_PROTOCOL_ERROR(fmt::format(
"Unknown {} value `{}` encountered while converting {} to {}",
default:
LTTNG_THROW_PROTOCOL_ERROR(fmt::format(
"Unknown {} value `{}` encountered while converting {} to {}",
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 *end,
const session_attributes& session_attributes,
const lttng_ust_ctl_field **next_ust_ctl_field,
- publish_field_fn publish_field)
+ publish_field_fn publish_field,
+ lst::field_location::root lookup_root,
+ lst::field_location::elements& current_field_location_elements)
{
LTTNG_ASSERT(current < end);
{
LTTNG_ASSERT(current < end);
publish_field(lttng::make_unique<lst::field>(current->name,
create_type_from_ust_ctl_fields(current, end, session_attributes,
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)));
+ next_ust_ctl_field, publish_field,
+ lookup_root,
+ current_field_location_elements)));
std::vector<lst::field::cuptr> create_fields_from_ust_ctl_fields(
const lsu::registry_session& session,
const lttng_ust_ctl_field *current,
std::vector<lst::field::cuptr> create_fields_from_ust_ctl_fields(
const lsu::registry_session& session,
const lttng_ust_ctl_field *current,
- const lttng_ust_ctl_field *end)
+ const lttng_ust_ctl_field *end,
+ lst::field_location::root lookup_root)
{
std::vector<lst::field::cuptr> fields;
const auto trace_native_byte_order = session.abi.byte_order;
{
std::vector<lst::field::cuptr> fields;
const auto trace_native_byte_order = session.abi.byte_order;
return session.get_enumeration(enum_name, enum_id);
},
trace_native_byte_order};
return session.get_enumeration(enum_name, enum_id);
},
trace_native_byte_order};
+ /* Location of field being created. */
+ lst::field_location::elements current_field_location_elements;
while (current < end) {
auto *next_field = current;
while (current < end) {
auto *next_field = current;
create_field_from_ust_ctl_fields(current, end, session_attributes, &next_field,
[&fields](lst::field::cuptr field) {
fields.emplace_back(std::move(field));
create_field_from_ust_ctl_fields(current, end, session_attributes, &next_field,
[&fields](lst::field::cuptr field) {
fields.emplace_back(std::move(field));
+ },
+ lookup_root,
+ current_field_location_elements);
std::vector<lst::field::cuptr> lsu::create_trace_fields_from_ust_ctl_fields(
const lsu::registry_session& session,
const lttng_ust_ctl_field *fields,
std::vector<lst::field::cuptr> lsu::create_trace_fields_from_ust_ctl_fields(
const lsu::registry_session& session,
const lttng_ust_ctl_field *fields,
- std::size_t field_count)
+ std::size_t field_count,
+ lst::field_location::root lookup_root)
- return create_fields_from_ust_ctl_fields(session, fields, fields + field_count);
+ return create_fields_from_ust_ctl_fields(session, fields, fields + field_count, lookup_root);
std::vector<trace::field::cuptr> create_trace_fields_from_ust_ctl_fields(
const lttng::sessiond::ust::registry_session& session,
const lttng_ust_ctl_field *fields,
std::vector<trace::field::cuptr> create_trace_fields_from_ust_ctl_fields(
const lttng::sessiond::ust::registry_session& session,
const lttng_ust_ctl_field *fields,
- std::size_t field_count);
+ std::size_t field_count,
+ trace::field_location::root lookup_root);
} /* namespace ust */
} /* namespace sessiond */
} /* namespace ust */
} /* namespace sessiond */
lst::type::cuptr extended = lttng::make_unique<lst::structure_type>(0, std::move(extended_fields));
variant_choices.emplace_back(lttng::make_unique<lst::field>("extended", std::move(extended)));
lst::type::cuptr extended = lttng::make_unique<lst::structure_type>(0, std::move(extended_fields));
variant_choices.emplace_back(lttng::make_unique<lst::field>("extended", std::move(extended)));
- lst::type::cuptr variant = lttng::make_unique<lst::variant_type>(
- 0, "id", std::move(variant_choices));
+ lst::type::cuptr variant = lttng::make_unique<lst::variant_type>(0,
+ lst::field_location(lst::field_location::root::EVENT_RECORD_HEADER,
+ {"id"}),
+ std::move(variant_choices));
event_header_fields.emplace_back(lttng::make_unique<lst::field>("id", std::move(choice_enum)));
event_header_fields.emplace_back(
event_header_fields.emplace_back(lttng::make_unique<lst::field>("id", std::move(choice_enum)));
event_header_fields.emplace_back(
lst::type::cuptr extended = lttng::make_unique<lst::structure_type>(0, std::move(extended_fields));
variant_choices.emplace_back(lttng::make_unique<lst::field>("extended", std::move(extended)));
lst::type::cuptr extended = lttng::make_unique<lst::structure_type>(0, std::move(extended_fields));
variant_choices.emplace_back(lttng::make_unique<lst::field>("extended", std::move(extended)));
- lst::type::cuptr variant = lttng::make_unique<lst::variant_type>(
- 0, "id", std::move(variant_choices));
+ lst::type::cuptr variant = lttng::make_unique<lst::variant_type>(0,
+ lst::field_location(lst::field_location::root::EVENT_RECORD_HEADER,
+ {"id"}),
+ std::move(variant_choices));
event_header_fields.emplace_back(lttng::make_unique<lst::field>("id", std::move(choice_enum)));
event_header_fields.emplace_back(
event_header_fields.emplace_back(lttng::make_unique<lst::field>("id", std::move(choice_enum)));
event_header_fields.emplace_back(