From 6ce120480265b7290460be157aeb24e51d603ed9 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Galarneau?= Date: Tue, 15 Nov 2016 11:36:09 -0500 Subject: [PATCH] Add field validation logging MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérémie Galarneau --- formats/ctf/ir/fields.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/formats/ctf/ir/fields.c b/formats/ctf/ir/fields.c index 2aeb71b5..7d5f744c 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; } } -- 2.34.1