[lttng-dev] libbabeltrace: getting CTF sequence length?
Jérémie Galarneau
jeremie.galarneau at efficios.com
Tue May 20 16:50:20 EDT 2014
On Tue, May 20, 2014 at 4:37 PM, Philippe Proulx
<eeppeliteloop at gmail.com> wrote:
> Hello,
>
> 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?
>
bt_ctf_get_field_list can be used to get the number of elements, along
with a pointer to the elements (via the output parameters).
Regards,
Jérémie
> I'm using the latest Git master on Arch Linux.
>
> Thank you!
>
> Philippe Proulx
>
> _______________________________________________
> lttng-dev mailing list
> lttng-dev at lists.lttng.org
> http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
--
Jérémie Galarneau
EfficiOS Inc.
http://www.efficios.com
More information about the lttng-dev
mailing list