lttng-dev.lists.lttng.org archive mirror
 help / color / mirror / Atom feed
From: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
To: Maxime Roussin-Belanger <maxime.roussinbelanger@gmail.com>
Cc: lttng-dev <lttng-dev@lists.lttng.org>
Subject: Re: [PATCH v3 lttng-ust 1/2] Introduce vtracef
Date: Tue, 3 Mar 2020 14:10:25 -0500 (EST)	[thread overview]
Message-ID: <927545652.16789.1583262625823.JavaMail.zimbra@efficios.com> (raw)
In-Reply-To: <670365633.9079.1582751647247.JavaMail.zimbra@efficios.com>

----- On Feb 26, 2020, at 4:14 PM, Mathieu Desnoyers mathieu.desnoyers@efficios.com wrote:

> ----- On Feb 24, 2020, at 12:34 PM, Maxime Roussin-Belanger
> maxime.roussinbelanger@gmail.com wrote:
> [...]
>> diff --git a/liblttng-ust/tracef.c b/liblttng-ust/tracef.c
>> index ea98e43e..1311f0d5 100644
>> --- a/liblttng-ust/tracef.c
>> +++ b/liblttng-ust/tracef.c
>> @@ -29,20 +29,26 @@
>> #define TRACEPOINT_DEFINE
>> #include "lttng-ust-tracef-provider.h"
>> 
>> -void _lttng_ust_tracef(const char *fmt, ...)
>> +void _lttng_ust_vtracef(const char *fmt, va_list ap)
>> {
>> -	va_list ap;
>> 	char *msg;
>> -	int len;
>> -
>> -	va_start(ap, fmt);
>> -	len = vasprintf(&msg, fmt, ap);
>> +	const int len = vasprintf(&msg, fmt, ap);
>> 	/* len does not include the final \0 */
>> 	if (len < 0)
>> 		goto end;
>> 	__tracepoint_cb_lttng_ust_tracef___event(msg, len,
>> 		LTTNG_UST_CALLER_IP());
> 
> I don't think LTTNG_UST_CALLER_IP() has the behavior we would expect
> for _lttng_ust_tracef() anymore here. We want the callsite in the application
> or library which has been instrumented, not an IP within lttng-ust.

The following should fix both inlining and CALLER_IP() issues:

static inline __attribute__((always_inline))
void __lttng_ust_vtracef(const char *fmt, va_list ap)
{
        char *msg;
        const int len = vasprintf(&msg, fmt, ap);
        /* len does not include the final \0 */
        if (len < 0)
                goto end;
        __tracepoint_cb_lttng_ust_tracef___event(msg, len,
                LTTNG_UST_CALLER_IP());
        free(msg);
end:
        return;
}

void _lttng_ust_vtracef(const char *fmt, va_list ap)
{
        __lttng_ust_vtracef(fmt, ap);
}

void _lttng_ust_tracef(const char *fmt, ...)
{
        va_list ap;

        va_start(ap, fmt);
        __lttng_ust_vtracef(fmt, ap);

        va_end(ap);
}

Thanks,

Mathieu


> 
> Thanks,
> 
> Mathieu
> 
>> 	free(msg);
>> end:
>> +	return;
>> +}
>> +
>> +void _lttng_ust_tracef(const char *fmt, ...)
>> +{
>> +	va_list ap;
>> +
>> +	va_start(ap, fmt);
>> +	_lttng_ust_vtracef(fmt, ap);
>> +
>> 	va_end(ap);
>> }
>> --
>> 2.20.1
>> 
>> _______________________________________________
>> lttng-dev mailing list
>> lttng-dev@lists.lttng.org
>> https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
> 
> --
> Mathieu Desnoyers
> EfficiOS Inc.
> http://www.efficios.com
> _______________________________________________
> lttng-dev mailing list
> lttng-dev@lists.lttng.org
> https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev

-- 
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com

      reply	other threads:[~2020-03-03 19:10 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-24 17:34 [PATCH v3 lttng-ust 1/2] Introduce vtracef Maxime Roussin-Belanger
2020-02-24 17:34 ` [PATCH v3 lttng-ust 2/2] Introduce vtracelog Maxime Roussin-Belanger
2020-02-26 21:15   ` Mathieu Desnoyers
2020-02-26 21:07 ` [PATCH v3 lttng-ust 1/2] Introduce vtracef Mathieu Desnoyers
2020-02-26 21:10 ` Mathieu Desnoyers
2020-02-26 21:14 ` Mathieu Desnoyers
2020-03-03 19:10   ` Mathieu Desnoyers [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=927545652.16789.1583262625823.JavaMail.zimbra@efficios.com \
    --to=mathieu.desnoyers@efficios.com \
    --cc=lttng-dev@lists.lttng.org \
    --cc=maxime.roussinbelanger@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).