Commit 85e6bd27 authored by Brice Videau's avatar Brice Videau
Browse files

Fixed fix size array support.

parent 9050991c
Pipeline #11669 canceled with stage
...@@ -22,7 +22,23 @@ EOF ...@@ -22,7 +22,23 @@ EOF
else else
#{name} = (#{type})bt_field_integer_signed_get_value(_field); #{name} = (#{type})bt_field_integer_signed_get_value(_field);
EOF EOF
when "ctf_sequence", "ctf_sequence_hex", "ctf_array" when "ctf_array"
scalar_type = type.gsub("const","").sub("*", "")
puts <<EOF
_#{name}_length = bt_field_array_get_length(_field);
if (_#{name}_length > 0) {
bt_field_class_type _type = bt_field_get_class_type(bt_field_array_borrow_element_field_by_index_const(_field, 0));
#{name} = (#{type})malloc(_#{name}_length*sizeof(#{scalar_type}));
for (uint64_t _i = 0; _i < _#{name}_length; _i++) {
if (bt_field_class_type_is(_type, BT_FIELD_CLASS_TYPE_UNSIGNED_INTEGER))
#{name}[_i] = (#{scalar_type})bt_field_integer_unsigned_get_value(bt_field_array_borrow_element_field_by_index_const(_field, _i));
else
#{name}[_i] = (#{scalar_type})bt_field_integer_signed_get_value(bt_field_array_borrow_element_field_by_index_const(_field, _i));
}
} else
#{name} = NULL;
EOF
when "ctf_sequence", "ctf_sequence_hex"
scalar_type = type.gsub("const","").sub("*", "") scalar_type = type.gsub("const","").sub("*", "")
puts <<EOF puts <<EOF
uint64_t _sz = bt_field_array_get_length(_field); uint64_t _sz = bt_field_array_get_length(_field);
...@@ -57,7 +73,7 @@ def print_field_members_access(fields) ...@@ -57,7 +73,7 @@ def print_field_members_access(fields)
type << " *" if f["array"] type << " *" if f["array"]
type << " *" if f["string"] type << " *" if f["string"]
name = n name = n
if f["array"] if f["array"] and f["lttng"].match("ctf_sequence")
arr.push ["ctf_integer", "size_t", "_#{n}_length"] arr.push ["ctf_integer", "size_t", "_#{n}_length"]
end end
arr.push [lttng, type, name] arr.push [lttng, type, name]
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment