I'm looking at some error stacks for a graph involving a dummy
component, and I noticed that it did not produce an error cause when
failing to consume. I think it would be nice if it did, to avoid having
a gap in the error stack.
Change-Id: I1b7af3218f9937a21d3dee7406a2b03e122671c6
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/12007
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Tested-by: jenkins <jenkins@lttng.org>
bt_component_class_sink_consume_method_status dummy_consume(
bt_self_component_sink *component)
{
bt_component_class_sink_consume_method_status dummy_consume(
bt_self_component_sink *component)
{
- bt_component_class_sink_consume_method_status status =
- BT_COMPONENT_CLASS_SINK_CONSUME_METHOD_STATUS_OK;
+ bt_component_class_sink_consume_method_status status;
bt_message_array_const msgs;
uint64_t count;
struct dummy *dummy;
bt_message_iterator_next_status next_status;
uint64_t i;
bt_message_array_const msgs;
uint64_t count;
struct dummy *dummy;
bt_message_iterator_next_status next_status;
uint64_t i;
+ bt_self_component *self_comp =
+ bt_self_component_sink_as_self_component(component);
- dummy = bt_self_component_get_data(
- bt_self_component_sink_as_self_component(component));
+ dummy = bt_self_component_get_data(self_comp);
BT_ASSERT_DBG(dummy);
if (G_UNLIKELY(!dummy->msg_iter)) {
BT_ASSERT_DBG(dummy);
if (G_UNLIKELY(!dummy->msg_iter)) {
dummy->msg_iter, &msgs, &count);
switch (next_status) {
case BT_MESSAGE_ITERATOR_NEXT_STATUS_OK:
dummy->msg_iter, &msgs, &count);
switch (next_status) {
case BT_MESSAGE_ITERATOR_NEXT_STATUS_OK:
- status = BT_COMPONENT_CLASS_SINK_CONSUME_METHOD_STATUS_OK;
-
for (i = 0; i < count; i++) {
bt_message_put_ref(msgs[i]);
}
break;
for (i = 0; i < count; i++) {
bt_message_put_ref(msgs[i]);
}
break;
- case BT_MESSAGE_ITERATOR_NEXT_STATUS_AGAIN:
- status = BT_COMPONENT_CLASS_SINK_CONSUME_METHOD_STATUS_AGAIN;
- goto end;
- case BT_MESSAGE_ITERATOR_NEXT_STATUS_END:
- status = BT_COMPONENT_CLASS_SINK_CONSUME_METHOD_STATUS_END;
- goto end;
case BT_MESSAGE_ITERATOR_NEXT_STATUS_ERROR:
case BT_MESSAGE_ITERATOR_NEXT_STATUS_ERROR:
- status = BT_COMPONENT_CLASS_SINK_CONSUME_METHOD_STATUS_ERROR;
- goto end;
case BT_MESSAGE_ITERATOR_NEXT_STATUS_MEMORY_ERROR:
case BT_MESSAGE_ITERATOR_NEXT_STATUS_MEMORY_ERROR:
- status = BT_COMPONENT_CLASS_SINK_CONSUME_METHOD_STATUS_MEMORY_ERROR;
- goto end;
+ BT_CURRENT_THREAD_ERROR_APPEND_CAUSE_FROM_COMPONENT(
+ self_comp,
+ "Failed to get messages from upstream component");
+ break;
+ status = (int) next_status;
+