From: Jérémie Galarneau Date: Tue, 15 Nov 2016 16:36:09 +0000 (-0500) Subject: Add field validation logging X-Git-Url: http://drtracing.org/?a=commitdiff_plain;h=6ce120480265b7290460be157aeb24e51d603ed9;p=deliverable%2Fbabeltrace.git Add field validation logging Signed-off-by: Jérémie Galarneau --- diff --git a/formats/ctf/ir/fields.c b/formats/ctf/ir/fields.c index 2aeb71b53..7d5f744c1 100644 --- a/formats/ctf/ir/fields.c +++ b/formats/ctf/ir/fields.c @@ -1592,6 +1592,14 @@ int bt_ctf_field_structure_validate(struct bt_ctf_field *field) for (i = 0; i < structure->fields->len; i++) { ret = bt_ctf_field_validate(structure->fields->pdata[i]); if (ret) { + const char *name; + struct bt_ctf_field_type *field_type = + bt_ctf_field_get_type(field); + + (void) bt_ctf_field_type_structure_get_field(field_type, + &name, NULL, i); + fprintf(stderr, "Field %s failed validation\n", + name ? name : "NULL"); goto end; } } @@ -1655,6 +1663,7 @@ int bt_ctf_field_sequence_validate(struct bt_ctf_field *field) for (i = 0; i < sequence->elements->len; i++) { ret = bt_ctf_field_validate(sequence->elements->pdata[i]); if (ret) { + fprintf(stderr, "Failed to validate sequence field %zu\n", i); goto end; } }