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 <[email protected]>
> ---
>  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;


Attachment: smime.p7s
Description: Signature cryptographique S/MIME

_______________________________________________
lttng-dev mailing list
[email protected]
http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev

Reply via email to