From 26329f266af91824651fe32df3003c45c71985b8 Mon Sep 17 00:00:00 2001 From: Mathieu Desnoyers Date: Mon, 17 Sep 2012 10:11:09 -0400 Subject: [PATCH] Fix: add events with 0 field to field list Signed-off-by: Mathieu Desnoyers --- liblttng-ust/ltt-probes.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/liblttng-ust/ltt-probes.c b/liblttng-ust/ltt-probes.c index 1e1407e6..d04ce221 100644 --- a/liblttng-ust/ltt-probes.c +++ b/liblttng-ust/ltt-probes.c @@ -244,6 +244,28 @@ int ltt_probes_get_field_list(struct lttng_ust_field_list *list) probe_desc->event_desc[i]; int j; + if (event_desc->nr_fields == 0) { + /* Events without fields. */ + struct tp_field_list_entry *list_entry; + + list_entry = zmalloc(sizeof(*list_entry)); + if (!list_entry) + goto err_nomem; + cds_list_add(&list_entry->head, &list->head); + strncpy(list_entry->field.event_name, + event_desc->name, + LTTNG_UST_SYM_NAME_LEN); + list_entry->field.event_name[LTTNG_UST_SYM_NAME_LEN - 1] = '\0'; + list_entry->field.field_name[0] = '\0'; + list_entry->field.type = LTTNG_UST_FIELD_OTHER; + if (!event_desc->loglevel) { + list_entry->field.loglevel = TRACE_DEFAULT; + } else { + list_entry->field.loglevel = *(*event_desc->loglevel); + } + list_entry->field.nowrite = 1; + } + for (j = 0; j < event_desc->nr_fields; j++) { const struct lttng_event_field *event_field = &event_desc->fields[j]; -- 2.34.1