X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=src%2Fplugins%2Flttng-utils%2Fdebug-info%2Fdebug-info.c;h=fe3424146fe3b719a79ac7d2247d77c560cdb465;hb=a3f0c7db90f4cfc81090a83a7442b7bc624d5789;hp=7a57704201b9017062497d525818c16e8decdeed;hpb=03df65b73219609f0b41bec07080a5d055f35cff;p=babeltrace.git diff --git a/src/plugins/lttng-utils/debug-info/debug-info.c b/src/plugins/lttng-utils/debug-info/debug-info.c index 7a577042..fe342414 100644 --- a/src/plugins/lttng-utils/debug-info/debug-info.c +++ b/src/plugins/lttng-utils/debug-info/debug-info.c @@ -31,6 +31,8 @@ #define BT_LOG_TAG "PLUGIN/FLT.LTTNG-UTILS.DEBUG-INFO" #include "logging/comp-logging.h" +#include + #include #include "common/assert.h" @@ -60,6 +62,7 @@ struct debug_info_component { bt_logging_level log_level; bt_self_component *self_comp; + bt_self_component_filter *self_comp_filter; gchar *arg_debug_dir; gchar *arg_debug_info_field_name; gchar *arg_target_prefix; @@ -856,6 +859,7 @@ end: return; } +static void trace_debug_info_remove_func(const bt_trace *in_trace, void *data) { struct debug_info_msg_iter *debug_it = data; @@ -1694,13 +1698,14 @@ const bt_message *handle_message(struct debug_info_msg_iter *debug_it, out_message = handle_discarded_packets_message(debug_it, in_message); break; default: - abort(); + bt_common_abort(); break; } return out_message; } +static struct bt_param_validation_map_value_entry_descr debug_info_params[] = { { "debug-info-field-name", BT_PARAM_VALIDATION_MAP_VALUE_ENTRY_OPTIONAL, { .type = BT_VALUE_TYPE_STRING } }, { "debug-info-dir", BT_PARAM_VALIDATION_MAP_VALUE_ENTRY_OPTIONAL, { .type = BT_VALUE_TYPE_STRING } }, @@ -1803,6 +1808,7 @@ bt_component_class_initialize_method_status debug_info_comp_init( debug_info_comp->log_level = log_level; debug_info_comp->self_comp = self_comp; + debug_info_comp->self_comp_filter = self_comp_flt; bt_self_component_set_data(self_comp, debug_info_comp); add_port_status = bt_self_component_filter_add_input_port( @@ -1858,7 +1864,7 @@ void debug_info_comp_finalize(bt_self_component_filter *self_comp_flt) } BT_HIDDEN -bt_component_class_message_iterator_next_method_status debug_info_msg_iter_next( +bt_message_iterator_class_next_method_status debug_info_msg_iter_next( bt_self_message_iterator *self_msg_iter, const bt_message_array_const msgs, uint64_t capacity, uint64_t *count) @@ -1867,13 +1873,13 @@ bt_component_class_message_iterator_next_method_status debug_info_msg_iter_next( bt_message_iterator_next_status upstream_iterator_ret_status; struct debug_info_msg_iter *debug_info_msg_iter; struct debug_info_component *debug_info = NULL; - bt_component_class_message_iterator_next_method_status status; + bt_message_iterator_class_next_method_status status; bt_self_component *self_comp = NULL; bt_message_array_const input_msgs; const bt_message *out_message; uint64_t curr_msg_idx, i; - status = BT_COMPONENT_CLASS_MESSAGE_ITERATOR_NEXT_METHOD_STATUS_OK; + status = BT_MESSAGE_ITERATOR_CLASS_NEXT_METHOD_STATUS_OK; self_comp = bt_self_message_iterator_borrow_component(self_msg_iter); BT_ASSERT_DBG(self_comp); @@ -1941,7 +1947,7 @@ handle_msg_error: bt_message_put_ref(input_msgs[i]); } - status = BT_COMPONENT_CLASS_MESSAGE_ITERATOR_NEXT_METHOD_STATUS_MEMORY_ERROR; + status = BT_MESSAGE_ITERATOR_CLASS_NEXT_METHOD_STATUS_MEMORY_ERROR; end: return status; @@ -1975,13 +1981,13 @@ end: } BT_HIDDEN -bt_component_class_message_iterator_initialize_method_status debug_info_msg_iter_init( +bt_message_iterator_class_initialize_method_status debug_info_msg_iter_init( bt_self_message_iterator *self_msg_iter, bt_self_message_iterator_configuration *config, - bt_self_component_filter *self_comp_flt, + bt_self_component *self_comp, bt_self_component_port_output *self_port) { - bt_component_class_message_iterator_initialize_method_status status; + bt_message_iterator_class_initialize_method_status status; bt_self_component_port_input_message_iterator_create_from_message_iterator_status msg_iter_status; struct bt_self_component_port_input *input_port = NULL; @@ -1989,28 +1995,30 @@ bt_component_class_message_iterator_initialize_method_status debug_info_msg_iter struct debug_info_msg_iter *debug_info_msg_iter = NULL; gchar *debug_info_field_name; int ret; - bt_self_component *self_comp = - bt_self_component_filter_as_self_component(self_comp_flt); bt_logging_level log_level = bt_component_get_logging_level( bt_self_component_as_component(self_comp)); - /* Borrow the upstream input port. */ - input_port = bt_self_component_filter_borrow_input_port_by_name( - self_comp_flt, "in"); - if (!input_port) { - status = BT_COMPONENT_CLASS_MESSAGE_ITERATOR_INITIALIZE_METHOD_STATUS_ERROR; - goto error; - } - debug_info_msg_iter = g_new0(struct debug_info_msg_iter, 1); if (!debug_info_msg_iter) { - status = BT_COMPONENT_CLASS_MESSAGE_ITERATOR_INITIALIZE_METHOD_STATUS_MEMORY_ERROR; + status = BT_MESSAGE_ITERATOR_CLASS_INITIALIZE_METHOD_STATUS_MEMORY_ERROR; goto error; } debug_info_msg_iter->log_level = log_level; debug_info_msg_iter->self_comp = self_comp; + debug_info_msg_iter->debug_info_component = + bt_self_component_get_data(self_comp); + + /* Borrow the upstream input port. */ + input_port = bt_self_component_filter_borrow_input_port_by_name( + debug_info_msg_iter->debug_info_component->self_comp_filter, + "in"); + if (!input_port) { + status = BT_MESSAGE_ITERATOR_CLASS_INITIALIZE_METHOD_STATUS_ERROR; + goto error; + } + /* Create an iterator on the upstream component. */ msg_iter_status = bt_self_component_port_input_message_iterator_create_from_message_iterator( self_msg_iter, input_port, &upstream_iterator); @@ -2027,26 +2035,23 @@ bt_component_class_message_iterator_initialize_method_status debug_info_msg_iter g_direct_hash, g_direct_equal, (GDestroyNotify) NULL, (GDestroyNotify) debug_info_destroy); if (!debug_info_msg_iter->debug_info_map) { - status = BT_COMPONENT_CLASS_MESSAGE_ITERATOR_INITIALIZE_METHOD_STATUS_MEMORY_ERROR; + status = BT_MESSAGE_ITERATOR_CLASS_INITIALIZE_METHOD_STATUS_MEMORY_ERROR; goto error; } - debug_info_msg_iter->debug_info_component = - bt_self_component_get_data(self_comp); - debug_info_field_name = debug_info_msg_iter->debug_info_component->arg_debug_info_field_name; debug_info_msg_iter->ir_maps = trace_ir_maps_create(self_comp, debug_info_field_name, log_level); if (!debug_info_msg_iter->ir_maps) { - status = BT_COMPONENT_CLASS_MESSAGE_ITERATOR_INITIALIZE_METHOD_STATUS_MEMORY_ERROR; + status = BT_MESSAGE_ITERATOR_CLASS_INITIALIZE_METHOD_STATUS_MEMORY_ERROR; goto error; } ret = bt_fd_cache_init(&debug_info_msg_iter->fd_cache, log_level); if (ret) { - status = BT_COMPONENT_CLASS_MESSAGE_ITERATOR_INITIALIZE_METHOD_STATUS_MEMORY_ERROR; + status = BT_MESSAGE_ITERATOR_CLASS_INITIALIZE_METHOD_STATUS_MEMORY_ERROR; goto error; } @@ -2057,7 +2062,7 @@ bt_component_class_message_iterator_initialize_method_status debug_info_msg_iter bt_self_message_iterator_set_data(self_msg_iter, debug_info_msg_iter); debug_info_msg_iter->input_iterator = self_msg_iter; - status = BT_COMPONENT_CLASS_MESSAGE_ITERATOR_INITIALIZE_METHOD_STATUS_OK; + status = BT_MESSAGE_ITERATOR_CLASS_INITIALIZE_METHOD_STATUS_OK; goto end; error: @@ -2068,7 +2073,7 @@ end: } BT_HIDDEN -bt_component_class_message_iterator_can_seek_beginning_method_status +bt_message_iterator_class_can_seek_beginning_method_status debug_info_msg_iter_can_seek_beginning(bt_self_message_iterator *self_msg_iter, bt_bool *can_seek) { @@ -2081,13 +2086,13 @@ debug_info_msg_iter_can_seek_beginning(bt_self_message_iterator *self_msg_iter, } BT_HIDDEN -bt_component_class_message_iterator_seek_beginning_method_status +bt_message_iterator_class_seek_beginning_method_status debug_info_msg_iter_seek_beginning(bt_self_message_iterator *self_msg_iter) { struct debug_info_msg_iter *debug_info_msg_iter = bt_self_message_iterator_get_data(self_msg_iter); - bt_component_class_message_iterator_seek_beginning_method_status status = - BT_COMPONENT_CLASS_MESSAGE_ITERATOR_SEEK_BEGINNING_METHOD_STATUS_OK; + bt_message_iterator_class_seek_beginning_method_status status = + BT_MESSAGE_ITERATOR_CLASS_SEEK_BEGINNING_METHOD_STATUS_OK; bt_message_iterator_seek_beginning_status seek_beg_status; BT_ASSERT(debug_info_msg_iter);