X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=src%2Fplugins%2Flttng-utils%2Fdebug-info%2Ftrace-ir-metadata-copy.c;fp=src%2Fplugins%2Flttng-utils%2Fdebug-info%2Ftrace-ir-metadata-copy.c;h=4f14cd6c4473f8b5d57f1aa195e4e7aaa9e76581;hb=db5d746d0a65296562d2b8cb88575b2b5f5c83bd;hp=e1aa3cad09e6973cd1385ac2f57752d6c7ab9b50;hpb=8839434ec07524e32c8940d31e3083cf29d3074a;p=babeltrace.git diff --git a/src/plugins/lttng-utils/debug-info/trace-ir-metadata-copy.c b/src/plugins/lttng-utils/debug-info/trace-ir-metadata-copy.c index e1aa3cad..4f14cd6c 100644 --- a/src/plugins/lttng-utils/debug-info/trace-ir-metadata-copy.c +++ b/src/plugins/lttng-utils/debug-info/trace-ir-metadata-copy.c @@ -39,10 +39,11 @@ #include "utils.h" BT_HIDDEN -int copy_trace_class_content(const bt_trace_class *in_trace_class, - bt_trace_class *out_trace_class, bt_logging_level log_level, - bt_self_component *self_comp) +int copy_trace_class_content(struct trace_ir_maps *ir_maps, + const bt_trace_class *in_trace_class, bt_trace_class *out_trace_class, + bt_logging_level log_level, bt_self_component *self_comp) { + uint64_t sc_number, sc_idx; BT_COMP_LOGD("Copying content of trace class: in-tc-addr=%p, out-tc-addr=%p", in_trace_class, out_trace_class); @@ -56,6 +57,27 @@ int copy_trace_class_content(const bt_trace_class *in_trace_class, /* Use the same stream class ids as in the origin trace class. */ bt_trace_class_set_assigns_automatic_stream_class_id(out_trace_class, BT_FALSE); + + /* Copy stream classes contained in the trace class. */ + sc_number = bt_trace_class_get_stream_class_count(in_trace_class); + for (sc_idx = 0; sc_idx < sc_number; sc_idx++) { + bt_stream_class *out_stream_class; + const bt_stream_class *in_stream_class = + bt_trace_class_borrow_stream_class_by_index_const( + in_trace_class, sc_idx); + + out_stream_class = trace_ir_mapping_borrow_mapped_stream_class( + ir_maps, in_stream_class); + if (!out_stream_class) { + /* + * We don't need the new stream_class yet. We simply + * want to create it and keep it in the map. + */ + (void) trace_ir_mapping_create_new_mapped_stream_class( + ir_maps, in_stream_class); + } + } + BT_COMP_LOGD("Copied content of trace class: in-tc-addr=%p, out-tc-addr=%p", in_trace_class, out_trace_class); return 0; @@ -192,6 +214,7 @@ int copy_stream_class_content(struct trace_ir_maps *ir_maps, const bt_field_class *in_packet_context_fc, *in_common_context_fc; bt_field_class *out_packet_context_fc, *out_common_context_fc; const char *in_name; + uint64_t ec_number, ec_idx; bt_logging_level log_level = ir_maps->log_level; bt_self_component *self_comp = ir_maps->self_comp; int ret = 0; @@ -324,6 +347,25 @@ int copy_stream_class_content(struct trace_ir_maps *ir_maps, } } + /* Copy event classes contained in the stream class. */ + ec_number = bt_stream_class_get_event_class_count(in_stream_class); + for (ec_idx = 0; ec_idx < ec_number; ec_idx++) { + bt_event_class *out_event_class; + const bt_event_class *in_event_class = + bt_stream_class_borrow_event_class_by_id_const( + in_stream_class, ec_idx); + out_event_class = trace_ir_mapping_borrow_mapped_event_class( + ir_maps, in_event_class); + if (!out_event_class) { + /* + * We don't need the new event_class yet. We simply + * want to create it and keep it in the map. + */ + (void) trace_ir_mapping_create_new_mapped_event_class( + ir_maps, in_event_class); + } + } + BT_COMP_LOGD("Copied content of stream class: in-sc-addr=%p, out-sc-addr=%p", in_stream_class, out_stream_class); error: