[lttng-dev] how do I print a value from an array of structs in a userspace tracepoint?

Jeff Layton jlayton at poochiereds.net
Tue Aug 18 08:00:30 EDT 2015

I'd like to add a tracepoint to my code that can walk a
dynamically-sized array of structs and print one of the fields from
each struct. For instance, suppose I have an array of structs that
looks like this:

struct foo
	int bar;
	int baz;

At the time of the tracepoint, I know the number of elements in the
array and can pass that in. Is there any way to have lttng walk the
array of structs and print out only the "bar" field from each?

I've tried using ctf_sequence, but it doesn't seem to do the right
thing. You can't tell it that you want to print out an "int" while
walking an array of differently-sized objects.

Any help is appreciated!
Jeff Layton <jlayton at poochiereds.net>

More information about the lttng-dev mailing list