From: Yannick Brosseau Date: Mon, 5 Nov 2012 22:08:16 +0000 (-0500) Subject: Add Debug output on errors X-Git-Tag: v1.5-beta1~33 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=2230bb655f94e5ee0d32593520de317e6081dec6;p=lttv.git Add Debug output on errors Signed-off-by: Yannick Brosseau --- diff --git a/lttv/lttv/event.c b/lttv/lttv/event.c index 2f26274c..c30dcf0b 100644 --- a/lttv/lttv/event.c +++ b/lttv/lttv/event.c @@ -20,15 +20,18 @@ unsigned long lttv_event_get_long_unsigned(LttvEvent *event, const char* field) timestamp = bt_ctf_get_timestamp(ctf_event); if (timestamp == -1ULL) { + printf("ERROR: lttv_event_get_long_unsigned - invalid event\n"); return 0; } //scope = bt_ctf_get_top_level_scope(ctf_event, BT_STREAM_PACKET_CONTEXT); scope = bt_ctf_get_top_level_scope(ctf_event, BT_EVENT_FIELDS); if (bt_ctf_field_get_error()) { + printf("ERROR: lttv_event_get_long_unsigned - cannot get field scope\n"); return 0; } data = bt_ctf_get_uint64(bt_ctf_get_field(ctf_event, scope, field)); if (bt_ctf_field_get_error()) { + printf("ERROR: lttv_event_get_long_unsigned - cannot get field data %s \n", field); return 0; } else { return data; @@ -82,14 +85,17 @@ long lttv_event_get_long(LttvEvent *event, const char* field) timestamp = bt_ctf_get_timestamp(ctf_event); if (timestamp == -1ULL) { + printf("ERROR: lttv_event_get_long - invalid event\n"); return 0; } scope = bt_ctf_get_top_level_scope(ctf_event, BT_EVENT_FIELDS); if (bt_ctf_field_get_error()) { + printf("ERROR: lttv_event_get_long - cannot get field scope\n"); return 0; } data = bt_ctf_get_int64(bt_ctf_get_field(ctf_event, scope, field)); if (bt_ctf_field_get_error()) { + printf("ERROR: lttv_event_get_long - cannot get field data %s \n", field); return 0; } else { return data;