diff -Nru babeltrace-1.5.x+stable+git967+201810310702~ubuntu18.04.1/debian/changelog babeltrace-1.5.x+stable+git968+201904042302~ubuntu18.04.1/debian/changelog --- babeltrace-1.5.x+stable+git967+201810310702~ubuntu18.04.1/debian/changelog 2018-10-31 07:02:58.000000000 +0000 +++ babeltrace-1.5.x+stable+git968+201904042302~ubuntu18.04.1/debian/changelog 2019-04-04 23:02:04.000000000 +0000 @@ -1,8 +1,8 @@ -babeltrace (1.5.x+stable+git967+201810310702~ubuntu18.04.1) bionic; urgency=low +babeltrace (1.5.x+stable+git968+201904042302~ubuntu18.04.1) bionic; urgency=low * Auto build. - -- Ubuntu LTTng Wed, 31 Oct 2018 07:02:59 +0000 + -- Ubuntu LTTng Thu, 04 Apr 2019 23:02:04 +0000 babeltrace (1.5.x+stable-0~lttng1) yakkety; urgency=medium diff -Nru babeltrace-1.5.x+stable+git967+201810310702~ubuntu18.04.1/debian/git-build-recipe.manifest babeltrace-1.5.x+stable+git968+201904042302~ubuntu18.04.1/debian/git-build-recipe.manifest --- babeltrace-1.5.x+stable+git967+201810310702~ubuntu18.04.1/debian/git-build-recipe.manifest 2018-10-31 07:02:58.000000000 +0000 +++ babeltrace-1.5.x+stable+git968+201904042302~ubuntu18.04.1/debian/git-build-recipe.manifest 2019-04-04 23:02:04.000000000 +0000 @@ -1,3 +1,3 @@ -# git-build-recipe format 0.4 deb-version {debupstream}+git967+201810310702 -lp:babeltrace git-commit:9d4e072bc91f17d1f3852e840727754cdb400683 +# git-build-recipe format 0.4 deb-version {debupstream}+git968+201904042302 +lp:babeltrace git-commit:e7f1ad36b82bb8651c91c6c6faf8b92f145f32bc nest packaging lp:~lttng/babeltrace/+git/packaging debian git-commit:8f14662aedbd78f3b9a77a4cc86988c286a97fd6 diff -Nru babeltrace-1.5.x+stable+git967+201810310702~ubuntu18.04.1/formats/ctf/types/array.c babeltrace-1.5.x+stable+git968+201904042302~ubuntu18.04.1/formats/ctf/types/array.c --- babeltrace-1.5.x+stable+git967+201810310702~ubuntu18.04.1/formats/ctf/types/array.c 2018-10-31 07:02:57.000000000 +0000 +++ babeltrace-1.5.x+stable+git968+201904042302~ubuntu18.04.1/formats/ctf/types/array.c 2019-04-04 23:02:03.000000000 +0000 @@ -42,27 +42,21 @@ struct declaration_integer *integer_declaration = container_of(elem, struct declaration_integer, p); - if (integer_declaration->encoding == CTF_STRING_UTF8 - || integer_declaration->encoding == CTF_STRING_ASCII) { - - if (integer_declaration->len == CHAR_BIT - && integer_declaration->p.alignment == CHAR_BIT) { - - if (!ctf_align_pos(pos, integer_declaration->p.alignment)) - return -EFAULT; - if (!ctf_pos_access_ok(pos, array_declaration->len * CHAR_BIT)) - return -EFAULT; - - g_string_assign(array_definition->string, ""); - g_string_insert_len(array_definition->string, - 0, (char *) ctf_get_pos_addr(pos), - array_declaration->len); - /* - * We want to populate both the string - * and the underlying values, so carry - * on calling bt_array_rw(). - */ - } + if (bt_int_is_char(elem)) { + if (!ctf_align_pos(pos, integer_declaration->p.alignment)) + return -EFAULT; + if (!ctf_pos_access_ok(pos, array_declaration->len * CHAR_BIT)) + return -EFAULT; + + g_string_assign(array_definition->string, ""); + g_string_insert_len(array_definition->string, + 0, (char *) ctf_get_pos_addr(pos), + array_declaration->len); + /* + * We want to populate both the string + * and the underlying values, so carry + * on calling bt_array_rw(). + */ } } return bt_array_rw(ppos, definition); @@ -82,24 +76,18 @@ struct declaration_integer *integer_declaration = container_of(elem, struct declaration_integer, p); - if (integer_declaration->encoding == CTF_STRING_UTF8 - || integer_declaration->encoding == CTF_STRING_ASCII) { - - if (integer_declaration->len == CHAR_BIT - && integer_declaration->p.alignment == CHAR_BIT) { - - if (!ctf_align_pos(pos, integer_declaration->p.alignment)) - return -EFAULT; - if (!ctf_pos_access_ok(pos, array_declaration->len * CHAR_BIT)) - return -EFAULT; - - memcpy((char *) ctf_get_pos_addr(pos), - array_definition->string->str, - array_declaration->len); - if (!ctf_move_pos(pos, array_declaration->len * CHAR_BIT)) - return -EFAULT; - return 0; - } + if (bt_int_is_char(elem)) { + if (!ctf_align_pos(pos, integer_declaration->p.alignment)) + return -EFAULT; + if (!ctf_pos_access_ok(pos, array_declaration->len * CHAR_BIT)) + return -EFAULT; + + memcpy((char *) ctf_get_pos_addr(pos), + array_definition->string->str, + array_declaration->len); + if (!ctf_move_pos(pos, array_declaration->len * CHAR_BIT)) + return -EFAULT; + return 0; } } return bt_array_rw(ppos, definition); diff -Nru babeltrace-1.5.x+stable+git967+201810310702~ubuntu18.04.1/formats/ctf/types/sequence.c babeltrace-1.5.x+stable+git968+201904042302~ubuntu18.04.1/formats/ctf/types/sequence.c --- babeltrace-1.5.x+stable+git967+201810310702~ubuntu18.04.1/formats/ctf/types/sequence.c 2018-10-31 07:02:57.000000000 +0000 +++ babeltrace-1.5.x+stable+git968+201904042302~ubuntu18.04.1/formats/ctf/types/sequence.c 2019-04-04 23:02:03.000000000 +0000 @@ -41,25 +41,17 @@ struct declaration_integer *integer_declaration = container_of(elem, struct declaration_integer, p); - if (integer_declaration->encoding == CTF_STRING_UTF8 - || integer_declaration->encoding == CTF_STRING_ASCII) { + if (bt_int_is_char(elem)) { + uint64_t len = bt_sequence_len(sequence_definition); - if (integer_declaration->len == CHAR_BIT - && integer_declaration->p.alignment == CHAR_BIT) { - uint64_t len = bt_sequence_len(sequence_definition); - - if (!ctf_align_pos(pos, integer_declaration->p.alignment)) - return -EFAULT; - if (!ctf_pos_access_ok(pos, len * CHAR_BIT)) - return -EFAULT; - - g_string_assign(sequence_definition->string, ""); - g_string_insert_len(sequence_definition->string, - 0, (char *) ctf_get_pos_addr(pos), len); - if (!ctf_move_pos(pos, len * CHAR_BIT)) - return -EFAULT; - return 0; - } + if (!ctf_align_pos(pos, integer_declaration->p.alignment)) + return -EFAULT; + if (!ctf_pos_access_ok(pos, len * CHAR_BIT)) + return -EFAULT; + + g_string_assign(sequence_definition->string, ""); + g_string_insert_len(sequence_definition->string, + 0, (char *) ctf_get_pos_addr(pos), len); } } return bt_sequence_rw(ppos, definition); @@ -78,24 +70,19 @@ struct declaration_integer *integer_declaration = container_of(elem, struct declaration_integer, p); - if (integer_declaration->encoding == CTF_STRING_UTF8 - || integer_declaration->encoding == CTF_STRING_ASCII) { + if (bt_int_is_char(elem)) { + uint64_t len = bt_sequence_len(sequence_definition); - if (integer_declaration->len == CHAR_BIT - && integer_declaration->p.alignment == CHAR_BIT) { - uint64_t len = bt_sequence_len(sequence_definition); - - if (!ctf_align_pos(pos, integer_declaration->p.alignment)) - return -EFAULT; - if (!ctf_pos_access_ok(pos, len * CHAR_BIT)) - return -EFAULT; - - memcpy((char *) ctf_get_pos_addr(pos), - sequence_definition->string->str, len); - if (!ctf_move_pos(pos, len * CHAR_BIT)) - return -EFAULT; - return 0; - } + if (!ctf_align_pos(pos, integer_declaration->p.alignment)) + return -EFAULT; + if (!ctf_pos_access_ok(pos, len * CHAR_BIT)) + return -EFAULT; + + memcpy((char *) ctf_get_pos_addr(pos), + sequence_definition->string->str, len); + if (!ctf_move_pos(pos, len * CHAR_BIT)) + return -EFAULT; + return 0; } } return bt_sequence_rw(ppos, definition); diff -Nru babeltrace-1.5.x+stable+git967+201810310702~ubuntu18.04.1/include/babeltrace/types.h babeltrace-1.5.x+stable+git968+201904042302~ubuntu18.04.1/include/babeltrace/types.h --- babeltrace-1.5.x+stable+git967+201810310702~ubuntu18.04.1/include/babeltrace/types.h 2018-10-31 07:02:57.000000000 +0000 +++ babeltrace-1.5.x+stable+git968+201904042302~ubuntu18.04.1/include/babeltrace/types.h 2019-04-04 23:02:03.000000000 +0000 @@ -400,6 +400,7 @@ int bt_get_int_byte_order(const struct bt_definition *field); int bt_get_int_base(const struct bt_definition *field); size_t bt_get_int_len(const struct bt_definition *field); /* in bits */ +bool bt_int_is_char(const struct bt_declaration *field); enum ctf_string_encoding bt_get_int_encoding(const struct bt_definition *field); /* diff -Nru babeltrace-1.5.x+stable+git967+201810310702~ubuntu18.04.1/types/array.c babeltrace-1.5.x+stable+git968+201904042302~ubuntu18.04.1/types/array.c --- babeltrace-1.5.x+stable+git967+201810310702~ubuntu18.04.1/types/array.c 2018-10-31 07:02:57.000000000 +0000 +++ babeltrace-1.5.x+stable+git968+201904042302~ubuntu18.04.1/types/array.c 2019-04-04 23:02:03.000000000 +0000 @@ -123,15 +123,9 @@ array->string = NULL; array->elems = NULL; - if (array_declaration->elem->id == CTF_TYPE_INTEGER) { - struct declaration_integer *integer_declaration = - container_of(array_declaration->elem, struct declaration_integer, p); - - if (integer_declaration->encoding == CTF_STRING_UTF8 - || integer_declaration->encoding == CTF_STRING_ASCII) { - - array->string = g_string_new(""); - } + if (array_declaration->elem->id == CTF_TYPE_INTEGER && + bt_int_is_char(array_declaration->elem)) { + array->string = g_string_new(""); } array->elems = g_ptr_array_sized_new(array_declaration->len); @@ -229,19 +223,8 @@ array_definition = container_of(field, struct definition_array, p); array_declaration = array_definition->declaration; elem = array_declaration->elem; - if (elem->id == CTF_TYPE_INTEGER) { - struct declaration_integer *integer_declaration = - container_of(elem, struct declaration_integer, p); - - if (integer_declaration->encoding == CTF_STRING_UTF8 - || integer_declaration->encoding == CTF_STRING_ASCII) { - - if (integer_declaration->len == CHAR_BIT - && integer_declaration->p.alignment == CHAR_BIT) { - - return array_definition->string; - } - } + if (elem->id == CTF_TYPE_INTEGER && bt_int_is_char(elem)) { + return array_definition->string; } fprintf(stderr, "[warning] Extracting string\n"); return NULL; diff -Nru babeltrace-1.5.x+stable+git967+201810310702~ubuntu18.04.1/types/integer.c babeltrace-1.5.x+stable+git968+201904042302~ubuntu18.04.1/types/integer.c --- babeltrace-1.5.x+stable+git967+201810310702~ubuntu18.04.1/types/integer.c 2018-10-31 07:02:57.000000000 +0000 +++ babeltrace-1.5.x+stable+git968+201904042302~ubuntu18.04.1/types/integer.c 2019-04-04 23:02:03.000000000 +0000 @@ -201,3 +201,19 @@ g_quark_to_string(field->name)); return (int64_t)integer_definition->value._unsigned; } + +bool bt_int_is_char(const struct bt_declaration *field) +{ + bool ret; + struct declaration_integer *integer_declaration = + container_of(field, struct declaration_integer, p); + + /* Integer must be ASCII or encoded as UTF-8. */ + ret = integer_declaration->encoding == CTF_STRING_UTF8 || + integer_declaration->encoding == CTF_STRING_ASCII; + /* Integer must be aligned on a byte boundary and be byte-sized. */ + ret &= integer_declaration->len == CHAR_BIT && + integer_declaration->p.alignment == CHAR_BIT; + + return ret; +} diff -Nru babeltrace-1.5.x+stable+git967+201810310702~ubuntu18.04.1/types/sequence.c babeltrace-1.5.x+stable+git968+201904042302~ubuntu18.04.1/types/sequence.c --- babeltrace-1.5.x+stable+git967+201810310702~ubuntu18.04.1/types/sequence.c 2018-10-31 07:02:57.000000000 +0000 +++ babeltrace-1.5.x+stable+git968+201904042302~ubuntu18.04.1/types/sequence.c 2019-04-04 23:02:03.000000000 +0000 @@ -171,20 +171,9 @@ sequence->string = NULL; sequence->elems = NULL; - if (sequence_declaration->elem->id == CTF_TYPE_INTEGER) { - struct declaration_integer *integer_declaration = - container_of(sequence_declaration->elem, struct declaration_integer, p); - - if (integer_declaration->encoding == CTF_STRING_UTF8 - || integer_declaration->encoding == CTF_STRING_ASCII) { - - sequence->string = g_string_new(""); - - if (integer_declaration->len == CHAR_BIT - && integer_declaration->p.alignment == CHAR_BIT) { - return &sequence->p; - } - } + if (sequence_declaration->elem->id == CTF_TYPE_INTEGER && + bt_int_is_char(sequence_declaration->elem)) { + sequence->string = g_string_new(""); } sequence->elems = g_ptr_array_new();