[lttng-dev] libbabeltrace: getting CTF sequence length?

Philippe Proulx eeppeliteloop at gmail.com
Tue May 20 16:37:11 EDT 2014


I'm using libbabeltrace in C++. I would like to know if there's an
equivalent of bt_ctf_get_array_len() for sequences. I tried using
bt_ctf_get_field_list() but the reported count was 10, whereas the
sequence length was really 6 (as shown by the babeltrace tool),
leading to a segfault when accessing the 7th element.

Looking at the Python binding, I see that this is used:

    container_of(field, struct definition_sequence, p);

followed by bt_sequence_len(). However, struct definition_sequence,
bt_sequence_len() (and bt_sequence_index()) are not available in
the API.

So what would be your way to read sequence items? Do you have
an example using strictly what's available in /usr/include/babeltrace?

I'm using the latest Git master on Arch Linux.

Thank you!

Philippe Proulx

More information about the lttng-dev mailing list