[lttng-dev] UST context causes empty trace

Francis Giraldeau francis.giraldeau at gmail.com
Sun May 12 11:00:09 EDT 2013


I confirm that this patch solved the problem.

Thanks!

Francis

Le 2013-05-12 05:27, Zifei Tong a écrit :
> Hi,
>
> I did some debugging one this issue. The problem only occurs when we
> have more than one context field.
> So this will not work, too:
>
> lttng create
> lttng enable-event -a -u
> lttng add-context -u -t vpid
> lttng add-context -u -t vtid
> lttng start
> $@
> lttng stop
> sleep 1
> lttng view
> lttng destroy
>
> The problem I found out is wrong `fields` argument passed into
> `ustcomm_register_channel`.
> The `fields` argument passed is a pointer to the `event_field` of the
> first element in a `lttng_ctx_field` array,
> but not a `lttng_event_field` array as expected.
>
> Please see the patch for more details.
>
> The patch works on my machine. But I wonder if there is something
> wrong or maybe a better fix.
> Please review.
>
> Thanks,
>
> Zifei Tong
>
> Signed-off-by: Zifei Tong <soariez at gmail.com>
> ---
>  liblttng-ust/lttng-events.c | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/liblttng-ust/lttng-events.c b/liblttng-ust/lttng-events.c
> index e4faf60..7afe13f 100644
> --- a/liblttng-ust/lttng-events.c
> +++ b/liblttng-ust/lttng-events.c
> @@ -260,9 +260,10 @@ int lttng_session_enable(struct lttng_session *session)
>  	 */
>  	cds_list_for_each_entry(chan, &session->chan_head, node) {
>  		const struct lttng_ctx *ctx;
> -		const struct lttng_event_field *fields = NULL;
> +		struct lttng_event_field *fields = NULL;
>  		size_t nr_fields = 0;
>  		uint32_t chan_id;
> +		int i;
>
>  		/* don't change it if session stop/restart */
>  		if (chan->header_type)
> @@ -270,7 +271,9 @@ int lttng_session_enable(struct lttng_session *session)
>  		ctx = chan->ctx;
>  		if (ctx) {
>  			nr_fields = ctx->nr_fields;
> -			fields = &ctx->fields->event_field;
> +			fields = malloc(nr_fields * sizeof(struct lttng_event_field));
> +			for (i = 0; i < nr_fields; i++)
> +				fields[i] = ctx->fields[i].event_field;
>  		}
>  		ret = ustcomm_register_channel(notify_socket,
>  			session->objd,
> @@ -279,6 +282,8 @@ int lttng_session_enable(struct lttng_session *session)
>  			fields,
>  			&chan_id,
>  			&chan->header_type);
> +		if (fields != NULL)
> +			free(fields);
>  		if (ret) {
>  			DBG("Error (%d) registering channel to sessiond", ret);
>  			return ret;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4489 bytes
Desc: Signature cryptographique S/MIME
URL: <http://lists.lttng.org/pipermail/lttng-dev/attachments/20130512/f81d6c51/attachment.bin>


More information about the lttng-dev mailing list