2 * Babeltrace - Trace IR field copy
4 * Copyright (c) 2015-2019 EfficiOS Inc. and Linux Foundation
5 * Copyright (c) 2018 Philippe Proulx <pproulx@efficios.com>
6 * Copyright (c) 2019 Francis Deslauriers <francis.deslauriers@efficios.com>
8 * Permission is hereby granted, free of charge, to any person obtaining a copy
9 * of this software and associated documentation files (the "Software"), to deal
10 * in the Software without restriction, including without limitation the rights
11 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12 * copies of the Software, and to permit persons to whom the Software is
13 * furnished to do so, subject to the following conditions:
15 * The above copyright notice and this permission notice shall be included in
16 * all copies or substantial portions of the Software.
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
27 #define BT_COMP_LOG_SELF_COMP (md_maps->self_comp)
28 #define BT_LOG_OUTPUT_LEVEL (md_maps->log_level)
29 #define BT_LOG_TAG "PLUGIN/FLT.LTTNG-UTILS.DEBUG-INFO/TRACE-IR-META-FC-COPY"
30 #include "plugins/comp-logging.h"
32 #include "common/assert.h"
33 #include "common/common.h"
34 #include "compat/compiler.h"
35 #include <babeltrace2/babeltrace.h>
37 #include "trace-ir-metadata-copy.h"
38 #include "trace-ir-metadata-field-class-copy.h"
41 * This fonction walks througth the nested structures field class to resolve a
42 * field path object. A field path is made of indexes inside possibly nested
43 * structures ultimately leading to a field class.
46 const bt_field_class
*walk_field_path(struct trace_ir_metadata_maps
*md_maps
,
47 const bt_field_path
*fp
, const bt_field_class
*fc
)
49 uint64_t i
, fp_item_count
;
50 const bt_field_class
*curr_fc
;
52 BT_ASSERT(bt_field_class_get_type(fc
) == BT_FIELD_CLASS_TYPE_STRUCTURE
);
53 BT_COMP_LOGD("Walking field path on field class: fp-addr=%p, fc-addr=%p",
56 fp_item_count
= bt_field_path_get_item_count(fp
);
58 for (i
= 0; i
< fp_item_count
; i
++) {
59 bt_field_class_type fc_type
= bt_field_class_get_type(curr_fc
);
60 const bt_field_path_item
*fp_item
=
61 bt_field_path_borrow_item_by_index_const(fp
, i
);
64 case BT_FIELD_CLASS_TYPE_STRUCTURE
:
66 const bt_field_class_structure_member
*member
;
68 BT_ASSERT(bt_field_path_item_get_type(fp_item
) ==
69 BT_FIELD_PATH_ITEM_TYPE_INDEX
);
70 member
= bt_field_class_structure_borrow_member_by_index_const(
72 bt_field_path_item_index_get_index(fp_item
));
73 curr_fc
= bt_field_class_structure_member_borrow_field_class_const(
77 case BT_FIELD_CLASS_TYPE_VARIANT_WITHOUT_SELECTOR
:
78 case BT_FIELD_CLASS_TYPE_VARIANT_WITH_UNSIGNED_SELECTOR
:
79 case BT_FIELD_CLASS_TYPE_VARIANT_WITH_SIGNED_SELECTOR
:
81 const bt_field_class_variant_option
*option
;
83 BT_ASSERT(bt_field_path_item_get_type(fp_item
) ==
84 BT_FIELD_PATH_ITEM_TYPE_INDEX
);
85 option
= bt_field_class_variant_borrow_option_by_index_const(
87 bt_field_path_item_index_get_index(fp_item
));
88 curr_fc
= bt_field_class_variant_option_borrow_field_class_const(
92 case BT_FIELD_CLASS_TYPE_STATIC_ARRAY
:
93 case BT_FIELD_CLASS_TYPE_DYNAMIC_ARRAY
:
95 BT_ASSERT(bt_field_path_item_get_type(fp_item
) ==
96 BT_FIELD_PATH_ITEM_TYPE_CURRENT_ARRAY_ELEMENT
);
97 curr_fc
= bt_field_class_array_borrow_element_field_class_const(
110 const bt_field_class
*resolve_field_path_to_field_class(const bt_field_path
*fp
,
111 struct trace_ir_metadata_maps
*md_maps
)
113 struct field_class_resolving_context
*fc_resolving_ctx
;
114 const bt_field_class
*fc
;
115 bt_field_path_scope fp_scope
;
117 BT_COMP_LOGD("Resolving field path: fp-addr=%p", fp
);
119 fc_resolving_ctx
= md_maps
->fc_resolving_ctx
;
120 fp_scope
= bt_field_path_get_root_scope(fp
);
123 case BT_FIELD_PATH_SCOPE_PACKET_CONTEXT
:
124 fc
= walk_field_path(md_maps
, fp
,
125 fc_resolving_ctx
->packet_context
);
127 case BT_FIELD_PATH_SCOPE_EVENT_COMMON_CONTEXT
:
128 fc
= walk_field_path(md_maps
, fp
,
129 fc_resolving_ctx
->event_common_context
);
131 case BT_FIELD_PATH_SCOPE_EVENT_SPECIFIC_CONTEXT
:
132 fc
= walk_field_path(md_maps
, fp
,
133 fc_resolving_ctx
->event_specific_context
);
135 case BT_FIELD_PATH_SCOPE_EVENT_PAYLOAD
:
136 fc
= walk_field_path(md_maps
, fp
,
137 fc_resolving_ctx
->event_payload
);
147 void field_class_integer_set_props(const bt_field_class
*input_fc
,
148 bt_field_class
*output_fc
)
150 bt_field_class_integer_set_preferred_display_base(output_fc
,
151 bt_field_class_integer_get_preferred_display_base(input_fc
));
152 bt_field_class_integer_set_field_value_range(output_fc
,
153 bt_field_class_integer_get_field_value_range(input_fc
));
157 int field_class_unsigned_integer_copy(
158 struct trace_ir_metadata_maps
*md_maps
,
159 const bt_field_class
*in_field_class
,
160 bt_field_class
*out_field_class
)
162 BT_COMP_LOGD("Copying content of unsigned integer field class: "
163 "in-fc-addr=%p, out-fc-addr=%p",
164 in_field_class
, out_field_class
);
166 field_class_integer_set_props(in_field_class
, out_field_class
);
168 BT_COMP_LOGD("Copied content of unsigned integer field class: "
169 "in-fc-addr=%p, out-fc-addr=%p",
170 in_field_class
, out_field_class
);
175 int field_class_signed_integer_copy(
176 struct trace_ir_metadata_maps
*md_maps
,
177 const bt_field_class
*in_field_class
,
178 bt_field_class
*out_field_class
)
180 BT_COMP_LOGD("Copying content of signed integer field class: "
181 "in-fc-addr=%p, out-fc-addr=%p",
182 in_field_class
, out_field_class
);
184 field_class_integer_set_props(in_field_class
, out_field_class
);
186 BT_COMP_LOGD("Copied content of signed integer field class: "
187 "in-fc-addr=%p, out-fc-addr=%p",
188 in_field_class
, out_field_class
);
193 int field_class_unsigned_enumeration_copy(
194 struct trace_ir_metadata_maps
*md_maps
,
195 const bt_field_class
*in_field_class
,
196 bt_field_class
*out_field_class
)
198 uint64_t i
, enum_mapping_count
;
201 BT_COMP_LOGD("Copying content of unsigned enumeration field class: "
202 "in-fc-addr=%p, out-fc-addr=%p",
203 in_field_class
, out_field_class
);
205 /* Copy properties of the inner integer. */
206 field_class_integer_set_props(in_field_class
, out_field_class
);
208 /* Copy all enumeration entries. */
209 enum_mapping_count
= bt_field_class_enumeration_get_mapping_count(in_field_class
);
210 for (i
= 0; i
< enum_mapping_count
; i
++) {
212 const bt_integer_range_set_unsigned
*range_set
;
213 const bt_field_class_enumeration_unsigned_mapping
*u_mapping
;
214 const bt_field_class_enumeration_mapping
*mapping
;
216 u_mapping
= bt_field_class_enumeration_unsigned_borrow_mapping_by_index_const(
218 mapping
= bt_field_class_enumeration_unsigned_mapping_as_mapping_const(
220 label
= bt_field_class_enumeration_mapping_get_label(mapping
);
221 range_set
= bt_field_class_enumeration_unsigned_mapping_borrow_ranges_const(
223 ret
= bt_field_class_enumeration_unsigned_add_mapping(
224 out_field_class
, label
, range_set
);
230 BT_COMP_LOGD("Copied content of unsigned enumeration field class: "
231 "in-fc-addr=%p, out-fc-addr=%p",
232 in_field_class
, out_field_class
);
239 int field_class_signed_enumeration_copy(
240 struct trace_ir_metadata_maps
*md_maps
,
241 const bt_field_class
*in_field_class
,
242 bt_field_class
*out_field_class
)
244 uint64_t i
, enum_mapping_count
;
247 BT_COMP_LOGD("Copying content of signed enumeration field class: "
248 "in-fc-addr=%p, out-fc-addr=%p",
249 in_field_class
, out_field_class
);
251 /* Copy properties of the inner integer. */
252 field_class_integer_set_props(in_field_class
, out_field_class
);
254 /* Copy all enumeration entries. */
256 bt_field_class_enumeration_get_mapping_count(in_field_class
);
257 for (i
= 0; i
< enum_mapping_count
; i
++) {
259 const bt_integer_range_set_signed
*range_set
;
260 const bt_field_class_enumeration_signed_mapping
*s_mapping
;
261 const bt_field_class_enumeration_mapping
*mapping
;
263 s_mapping
= bt_field_class_enumeration_signed_borrow_mapping_by_index_const(
265 mapping
= bt_field_class_enumeration_signed_mapping_as_mapping_const(
267 label
= bt_field_class_enumeration_mapping_get_label(mapping
);
268 range_set
= bt_field_class_enumeration_signed_mapping_borrow_ranges_const(
270 ret
= bt_field_class_enumeration_signed_add_mapping(
271 out_field_class
, label
, range_set
);
277 BT_COMP_LOGD("Copied content of signed enumeration field class: "
278 "in-fc-addr=%p, out-fc-addr=%p",
279 in_field_class
, out_field_class
);
286 int field_class_real_copy(
287 struct trace_ir_metadata_maps
*md_maps
,
288 const bt_field_class
*in_field_class
,
289 bt_field_class
*out_field_class
)
291 BT_COMP_LOGD("Copying content of real field class: "
292 "in-fc-addr=%p, out-fc-addr=%p",
293 in_field_class
, out_field_class
);
295 bt_field_class_real_set_is_single_precision(out_field_class
,
296 bt_field_class_real_is_single_precision(in_field_class
));
298 BT_COMP_LOGD("Copied content real field class: in-fc-addr=%p, "
299 "out-fc-addr=%p", in_field_class
, out_field_class
);
305 int field_class_structure_copy(
306 struct trace_ir_metadata_maps
*md_maps
,
307 const bt_field_class
*in_field_class
,
308 bt_field_class
*out_field_class
)
310 uint64_t i
, struct_member_count
;
313 BT_COMP_LOGD("Copying content of structure field class: "
314 "in-fc-addr=%p, out-fc-addr=%p",
315 in_field_class
, out_field_class
);
316 /* Get the number of member in that struct. */
317 struct_member_count
=
318 bt_field_class_structure_get_member_count(in_field_class
);
320 /* Iterate over all the members of the struct. */
321 for (i
= 0; i
< struct_member_count
; i
++) {
322 const bt_field_class_structure_member
*member
;
323 const char *member_name
;
324 const bt_field_class
*member_fc
;
325 bt_field_class
*out_member_field_class
;
327 member
= bt_field_class_structure_borrow_member_by_index_const(
329 member_fc
= bt_field_class_structure_member_borrow_field_class_const(
331 member_name
= bt_field_class_structure_member_get_name(member
);
332 BT_COMP_LOGD("Copying structure field class's field: "
333 "index=%" PRId64
", "
334 "member-fc-addr=%p, field-name=\"%s\"",
335 i
, member_fc
, member_name
);
337 out_member_field_class
= create_field_class_copy(md_maps
,
339 if (!out_member_field_class
) {
340 BT_COMP_LOGE("Cannot copy structure field class's field: "
341 "index=%" PRId64
", "
342 "field-fc-addr=%p, field-name=\"%s\"",
343 i
, member_fc
, member_name
);
347 ret
= copy_field_class_content(md_maps
, member_fc
,
348 out_member_field_class
);
353 if (bt_field_class_structure_append_member(out_field_class
,
354 member_name
, out_member_field_class
) !=
355 BT_FIELD_CLASS_STRUCTURE_APPEND_MEMBER_STATUS_OK
) {
356 BT_COMP_LOGE("Cannot append structure field class's field: "
357 "index=%" PRId64
", "
358 "field-fc-addr=%p, field-name=\"%s\"",
359 i
, member_fc
, member_name
);
360 BT_FIELD_CLASS_PUT_REF_AND_RESET(out_member_field_class
);
366 BT_COMP_LOGD("Copied structure field class: original-fc-addr=%p, copy-fc-addr=%p",
367 in_field_class
, out_field_class
);
374 int field_class_variant_copy(
375 struct trace_ir_metadata_maps
*md_maps
,
376 const bt_field_class
*in_field_class
,
377 bt_field_class
*out_field_class
)
379 bt_field_class
*out_tag_field_class
= NULL
;
380 uint64_t i
, variant_option_count
;
381 bt_field_class_type fc_type
= bt_field_class_get_type(in_field_class
);
384 BT_COMP_LOGD("Copying content of variant field class: "
385 "in-fc-addr=%p, out-fc-addr=%p",
386 in_field_class
, out_field_class
);
387 variant_option_count
=
388 bt_field_class_variant_get_option_count(in_field_class
);
389 for (i
= 0; i
< variant_option_count
; i
++) {
390 const bt_field_class
*option_fc
;
391 const char *option_name
;
392 bt_field_class
*out_option_field_class
;
393 const bt_field_class_variant_option
*option
;
395 option
= bt_field_class_variant_borrow_option_by_index_const(
397 option_fc
= bt_field_class_variant_option_borrow_field_class_const(
399 option_name
= bt_field_class_variant_option_get_name(option
);
400 out_option_field_class
= create_field_class_copy_internal(
402 if (!out_option_field_class
) {
403 BT_COMP_LOGE_STR("Cannot copy field class.");
407 ret
= copy_field_class_content_internal(md_maps
, option_fc
,
408 out_option_field_class
);
410 BT_COMP_LOGE_STR("Error copying content of option variant "
415 if (fc_type
== BT_FIELD_CLASS_TYPE_VARIANT_WITH_UNSIGNED_SELECTOR
) {
416 const bt_field_class_variant_with_selector_unsigned_option
*spec_opt
=
417 bt_field_class_variant_with_selector_unsigned_borrow_option_by_index_const(
419 const bt_integer_range_set_unsigned
*ranges
=
420 bt_field_class_variant_with_selector_unsigned_option_borrow_ranges_const(
423 if (bt_field_class_variant_with_selector_unsigned_append_option(
424 out_field_class
, option_name
,
425 out_option_field_class
, ranges
) !=
426 BT_FIELD_CLASS_VARIANT_WITH_SELECTOR_APPEND_OPTION_STATUS_OK
) {
427 BT_COMP_LOGE_STR("Cannot append option to variant field class with unsigned selector'");
428 BT_FIELD_CLASS_PUT_REF_AND_RESET(out_tag_field_class
);
432 } else if (fc_type
== BT_FIELD_CLASS_TYPE_VARIANT_WITH_SIGNED_SELECTOR
) {
433 const bt_field_class_variant_with_selector_signed_option
*spec_opt
=
434 bt_field_class_variant_with_selector_signed_borrow_option_by_index_const(
436 const bt_integer_range_set_signed
*ranges
=
437 bt_field_class_variant_with_selector_signed_option_borrow_ranges_const(
440 if (bt_field_class_variant_with_selector_signed_append_option(
441 out_field_class
, option_name
,
442 out_option_field_class
, ranges
) !=
443 BT_FIELD_CLASS_VARIANT_WITH_SELECTOR_APPEND_OPTION_STATUS_OK
) {
444 BT_COMP_LOGE_STR("Cannot append option to variant field class with signed selector'");
445 BT_FIELD_CLASS_PUT_REF_AND_RESET(out_tag_field_class
);
450 BT_ASSERT(fc_type
== BT_FIELD_CLASS_TYPE_VARIANT_WITHOUT_SELECTOR
);
452 if (bt_field_class_variant_without_selector_append_option(
453 out_field_class
, option_name
,
454 out_option_field_class
) !=
455 BT_FIELD_CLASS_VARIANT_WITHOUT_SELECTOR_APPEND_OPTION_STATUS_OK
) {
456 BT_COMP_LOGE_STR("Cannot append option to variant field class'");
457 BT_FIELD_CLASS_PUT_REF_AND_RESET(out_tag_field_class
);
464 BT_COMP_LOGD("Copied content of variant field class: in-fc-addr=%p, "
465 "out-fc-addr=%p", in_field_class
, out_field_class
);
472 int field_class_static_array_copy(
473 struct trace_ir_metadata_maps
*md_maps
,
474 const bt_field_class
*in_field_class
,
475 bt_field_class
*out_field_class
)
477 BT_COMP_LOGD("Copying content of static array field class: in-fc-addr=%p, "
478 "out-fc-addr=%p", in_field_class
, out_field_class
);
480 * There is no content to copy. Keep this function call anyway for
483 BT_COMP_LOGD("Copied content of static array field class: in-fc-addr=%p, "
484 "out-fc-addr=%p", in_field_class
, out_field_class
);
490 int field_class_dynamic_array_copy(
491 struct trace_ir_metadata_maps
*md_maps
,
492 const bt_field_class
*in_field_class
,
493 bt_field_class
*out_field_class
)
495 BT_COMP_LOGD("Copying content of dynamic array field class: "
496 "in-fc-addr=%p, out-fc-addr=%p",
497 in_field_class
, out_field_class
);
500 * There is no content to copy. Keep this function call anyway for
503 BT_COMP_LOGD("Copied dynamic array field class: in-fc-addr=%p, "
504 "out-fc-addr=%p", in_field_class
, out_field_class
);
510 int field_class_string_copy(struct trace_ir_metadata_maps
*md_maps
,
511 const bt_field_class
*in_field_class
,
512 bt_field_class
*out_field_class
)
514 BT_COMP_LOGD("Copying content of string field class: in-fc-addr=%p, "
515 "out-fc-addr=%p", in_field_class
, out_field_class
);
517 * There is no content to copy. Keep this function call anyway for
520 BT_COMP_LOGD("Copied content of string field class: in-fc-addr=%p, "
521 "out-fc-addr=%p", in_field_class
, out_field_class
);
527 bt_field_class
*copy_field_class_array_element(struct trace_ir_metadata_maps
*md_maps
,
528 const bt_field_class
*in_elem_fc
)
531 bt_field_class
*out_elem_fc
=
532 create_field_class_copy_internal(md_maps
, in_elem_fc
);
534 BT_COMP_LOGE("Error creating output elem field class "
535 "from input elem field class for static array: "
536 "in-fc-addr=%p", in_elem_fc
);
540 ret
= copy_field_class_content_internal(md_maps
, in_elem_fc
, out_elem_fc
);
542 BT_COMP_LOGE("Error creating output elem field class "
543 "from input elem field class for static array: "
544 "in-fc-addr=%p", in_elem_fc
);
545 BT_FIELD_CLASS_PUT_REF_AND_RESET(out_elem_fc
);
554 bt_field_class
*create_field_class_copy_internal(struct trace_ir_metadata_maps
*md_maps
,
555 const bt_field_class
*in_field_class
)
557 bt_field_class
*out_field_class
= NULL
;
558 bt_field_class_type fc_type
= bt_field_class_get_type(in_field_class
);
560 BT_COMP_LOGD("Creating bare field class based on field class: in-fc-addr=%p",
564 case BT_FIELD_CLASS_TYPE_UNSIGNED_INTEGER
:
565 out_field_class
= bt_field_class_integer_unsigned_create(
566 md_maps
->output_trace_class
);
568 case BT_FIELD_CLASS_TYPE_SIGNED_INTEGER
:
569 out_field_class
= bt_field_class_integer_signed_create(
570 md_maps
->output_trace_class
);
572 case BT_FIELD_CLASS_TYPE_UNSIGNED_ENUMERATION
:
573 out_field_class
= bt_field_class_enumeration_unsigned_create(
574 md_maps
->output_trace_class
);
576 case BT_FIELD_CLASS_TYPE_SIGNED_ENUMERATION
:
577 out_field_class
= bt_field_class_enumeration_signed_create(
578 md_maps
->output_trace_class
);
580 case BT_FIELD_CLASS_TYPE_REAL
:
581 out_field_class
= bt_field_class_real_create(
582 md_maps
->output_trace_class
);
584 case BT_FIELD_CLASS_TYPE_STRING
:
585 out_field_class
= bt_field_class_string_create(
586 md_maps
->output_trace_class
);
588 case BT_FIELD_CLASS_TYPE_STRUCTURE
:
589 out_field_class
= bt_field_class_structure_create(
590 md_maps
->output_trace_class
);
592 case BT_FIELD_CLASS_TYPE_STATIC_ARRAY
:
594 const bt_field_class
*in_elem_fc
=
595 bt_field_class_array_borrow_element_field_class_const(
598 bt_field_class_array_static_get_length(in_field_class
);
600 bt_field_class
*out_elem_fc
= copy_field_class_array_element(
601 md_maps
, in_elem_fc
);
603 out_field_class
= NULL
;
607 out_field_class
= bt_field_class_array_static_create(
608 md_maps
->output_trace_class
,
609 out_elem_fc
, array_len
);
612 case BT_FIELD_CLASS_TYPE_DYNAMIC_ARRAY
:
614 const bt_field_class
*in_elem_fc
=
615 bt_field_class_array_borrow_element_field_class_const(
617 const bt_field_path
*length_fp
=
618 bt_field_class_array_dynamic_borrow_length_field_path_const(
620 bt_field_class
*out_length_fc
= NULL
;
622 bt_field_class
*out_elem_fc
= copy_field_class_array_element(
623 md_maps
, in_elem_fc
);
625 out_field_class
= NULL
;
630 const bt_field_class
*in_length_fc
=
631 resolve_field_path_to_field_class(length_fp
,
634 BT_ASSERT(in_length_fc
);
635 out_length_fc
= g_hash_table_lookup(md_maps
->field_class_map
,
637 BT_ASSERT(out_length_fc
);
640 out_field_class
= bt_field_class_array_dynamic_create(
641 md_maps
->output_trace_class
,
642 out_elem_fc
, out_length_fc
);
645 case BT_FIELD_CLASS_TYPE_VARIANT_WITHOUT_SELECTOR
:
646 case BT_FIELD_CLASS_TYPE_VARIANT_WITH_UNSIGNED_SELECTOR
:
647 case BT_FIELD_CLASS_TYPE_VARIANT_WITH_SIGNED_SELECTOR
:
649 bt_field_class
*out_sel_fc
= NULL
;
651 if (fc_type
== BT_FIELD_CLASS_TYPE_VARIANT_WITH_UNSIGNED_SELECTOR
||
652 fc_type
== BT_FIELD_CLASS_TYPE_VARIANT_WITH_SIGNED_SELECTOR
) {
653 const bt_field_class
*in_sel_fc
;
654 const bt_field_path
*sel_fp
=
655 bt_field_class_variant_with_selector_borrow_selector_field_path_const(
659 in_sel_fc
= resolve_field_path_to_field_class(sel_fp
,
661 BT_ASSERT(in_sel_fc
);
662 out_sel_fc
= g_hash_table_lookup(
663 md_maps
->field_class_map
, in_sel_fc
);
664 BT_ASSERT(out_sel_fc
);
667 out_field_class
= bt_field_class_variant_create(
668 md_maps
->output_trace_class
, out_sel_fc
);
676 * Add mapping from in_field_class to out_field_class. This simplifies
677 * the resolution of field paths in variant and dynamic array field
680 g_hash_table_insert(md_maps
->field_class_map
,
681 (gpointer
) in_field_class
, out_field_class
);
685 BT_COMP_LOGD("Created bare field class based on field class: in-fc-addr=%p, "
686 "out-fc-addr=%p", in_field_class
, out_field_class
);
688 BT_COMP_LOGE("Error creating output field class from input field "
689 "class: in-fc-addr=%p", in_field_class
);
692 return out_field_class
;
696 int copy_field_class_content_internal(
697 struct trace_ir_metadata_maps
*md_maps
,
698 const bt_field_class
*in_field_class
,
699 bt_field_class
*out_field_class
)
702 switch(bt_field_class_get_type(in_field_class
)) {
703 case BT_FIELD_CLASS_TYPE_UNSIGNED_INTEGER
:
704 ret
= field_class_unsigned_integer_copy(md_maps
,
705 in_field_class
, out_field_class
);
707 case BT_FIELD_CLASS_TYPE_SIGNED_INTEGER
:
708 ret
= field_class_signed_integer_copy(md_maps
,
709 in_field_class
, out_field_class
);
711 case BT_FIELD_CLASS_TYPE_UNSIGNED_ENUMERATION
:
712 ret
= field_class_unsigned_enumeration_copy(md_maps
,
713 in_field_class
, out_field_class
);
715 case BT_FIELD_CLASS_TYPE_SIGNED_ENUMERATION
:
716 ret
= field_class_signed_enumeration_copy(md_maps
,
717 in_field_class
, out_field_class
);
719 case BT_FIELD_CLASS_TYPE_REAL
:
720 ret
= field_class_real_copy(md_maps
,
721 in_field_class
, out_field_class
);
723 case BT_FIELD_CLASS_TYPE_STRING
:
724 ret
= field_class_string_copy(md_maps
,
725 in_field_class
, out_field_class
);
727 case BT_FIELD_CLASS_TYPE_STRUCTURE
:
728 ret
= field_class_structure_copy(md_maps
,
729 in_field_class
, out_field_class
);
731 case BT_FIELD_CLASS_TYPE_STATIC_ARRAY
:
732 ret
= field_class_static_array_copy(md_maps
,
733 in_field_class
, out_field_class
);
735 case BT_FIELD_CLASS_TYPE_DYNAMIC_ARRAY
:
736 ret
= field_class_dynamic_array_copy(md_maps
,
737 in_field_class
, out_field_class
);
739 case BT_FIELD_CLASS_TYPE_VARIANT_WITHOUT_SELECTOR
:
740 case BT_FIELD_CLASS_TYPE_VARIANT_WITH_UNSIGNED_SELECTOR
:
741 case BT_FIELD_CLASS_TYPE_VARIANT_WITH_SIGNED_SELECTOR
:
742 ret
= field_class_variant_copy(md_maps
,
743 in_field_class
, out_field_class
);