<div dir="ltr"><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Aug 18, 2015 at 8:00 AM, Jeff Layton <span dir="ltr"><<a href="mailto:jlayton@poochiereds.net" target="_blank">jlayton@poochiereds.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I'd like to add a tracepoint to my code that can walk a<br>
dynamically-sized array of structs and print one of the fields from<br>
each struct. For instance, suppose I have an array of structs that<br>
looks like this:<br>
<br>
struct foo<br>
{<br>
int bar;<br>
int baz;<br>
...<br>
}<br>
<br>
At the time of the tracepoint, I know the number of elements in the<br>
array and can pass that in. Is there any way to have lttng walk the<br>
array of structs and print out only the "bar" field from each?<br>
<br>
I've tried using ctf_sequence, but it doesn't seem to do the right<br>
thing. You can't tell it that you want to print out an "int" while<br>
walking an array of differently-sized objects.<br>
<br></blockquote><div><br></div><div>Indeed, sequences assume elements are of the same type/size. That would, presumably, be possible using variants, but they remain unsupported by the current tracer implementations.</div><div><br></div><div>For now, you could serialize your fields to a dynamically-sized array and extract this array using a ctf_sequence.</div><div><br></div><div>Jérémie</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Any help is appreciated!<br>
<span class="HOEnZb"><font color="#888888">--<br>
Jeff Layton <<a href="mailto:jlayton@poochiereds.net">jlayton@poochiereds.net</a>><br>
<br>
_______________________________________________<br>
lttng-dev mailing list<br>
<a href="mailto:lttng-dev@lists.lttng.org">lttng-dev@lists.lttng.org</a><br>
<a href="http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev" rel="noreferrer" target="_blank">http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev</a><br>
</font></span></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature">Jérémie Galarneau<br>EfficiOS Inc.<br><a href="http://www.efficios.com" target="_blank">http://www.efficios.com</a></div>
</div></div>