All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: Addition of the return address to liblttng-ust-libc-wrapper
       [not found] <OF7097A1B1.090ABAC2-ONC1257DCC.0053FE7C-C1257DCC.00570880@LocalDomain>
@ 2015-01-16 20:13 ` Mathieu Desnoyers
       [not found] ` <1127206322.43789.1421439222351.JavaMail.zimbra@efficios.com>
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 9+ messages in thread
From: Mathieu Desnoyers @ 2015-01-16 20:13 UTC (permalink / raw)
  To: Olivier Delbeke; +Cc: lttng-dev


[-- Attachment #1.1: Type: text/plain, Size: 6509 bytes --]

----- Original Message -----

> From: "Olivier Delbeke" <Olivier.Delbeke@awtce.be>
> To: lttng-dev@lists.lttng.org
> Sent: Tuesday, January 13, 2015 10:50:38 AM
> Subject: [lttng-dev] Addition of the return address to
> liblttng-ust-libc-wrapper

> Hi guys,

> I am using liblttng-ust-libc-wrapper to detect memory leaks in my
> applications.
> In order to identify not only the thread where the unfreed allocations are
> done, but also the calling function, I extended the
> liblttng-ust-libc-wrapper to log the "return address"
> (__builtin_return_address(0)) in addition to the parameters of malloc(). It
> solves my problem and does not affect Trace Compass.
> Was this the right thing to do ?
You should be able to achieve the same thing with the "ip" context, e.g.: 

lttng create 
lttng enable-event -u -a 
lttng add-context -u -t ip 
lttng start 
.... 

All this dynamically without changing the instrumentation. 

Thanks, 

Mathieu 

> If it is, then I guess that it might interest other people too.

> diff -Nurd b/liblttng-ust-libc-wrapper/lttng-ust-malloc.c
> c/liblttng-ust-libc-wrapper/lttng-ust-malloc.c
> --- b/liblttng-ust-libc-wrapper/lttng-ust-malloc.c 2015-01-06
> 17:14:34.000000000 +0100
> +++ c/liblttng-ust-libc-wrapper/lttng-ust-malloc.c 2015-01-06
> 17:16:40.811145106 +0100
> @@ -260,7 +260,7 @@
> }
> retval = cur_alloc.malloc(size);
> if (URCU_TLS(malloc_nesting) == 1) {
> - tracepoint(ust_libc, malloc, size, retval);
> + tracepoint(ust_libc, malloc, size, retval, __builtin_return_address(0) );
> }
> URCU_TLS(malloc_nesting)--;
> return retval;
> @@ -279,7 +279,7 @@
> }

> if (URCU_TLS(malloc_nesting) == 1) {
> - tracepoint(ust_libc, free, ptr);
> + tracepoint(ust_libc, free, ptr, __builtin_return_address(0) );
> }

> if (cur_alloc.free == NULL) {
> @@ -308,7 +308,7 @@
> }
> retval = cur_alloc.calloc(nmemb, size);
> if (URCU_TLS(malloc_nesting) == 1) {
> - tracepoint(ust_libc, calloc, nmemb, size, retval);
> + tracepoint(ust_libc, calloc, nmemb, size, retval,
> __builtin_return_address(0) );
> }
> URCU_TLS(malloc_nesting)--;
> return retval;
> @@ -360,7 +360,7 @@
> retval = cur_alloc.realloc(ptr, size);
> end:
> if (URCU_TLS(malloc_nesting) == 1) {
> - tracepoint(ust_libc, realloc, ptr, size, retval);
> + tracepoint(ust_libc, realloc, ptr, size, retval,
> __builtin_return_address(0) );
> }
> URCU_TLS(malloc_nesting)--;
> return retval;
> @@ -380,7 +380,7 @@
> }
> retval = cur_alloc.memalign(alignment, size);
> if (URCU_TLS(malloc_nesting) == 1) {
> - tracepoint(ust_libc, memalign, alignment, size, retval);
> + tracepoint(ust_libc, memalign, alignment, size, retval,
> __builtin_return_address(0) );
> }
> URCU_TLS(malloc_nesting)--;
> return retval;
> @@ -401,7 +401,7 @@
> retval = cur_alloc.posix_memalign(memptr, alignment, size);
> if (URCU_TLS(malloc_nesting) == 1) {
> tracepoint(ust_libc, posix_memalign, *memptr, alignment, size,
> - retval);
> + retval, __builtin_return_address(0) );
> }
> URCU_TLS(malloc_nesting)--;
> return retval;
> diff -Nurd b/liblttng-ust-libc-wrapper/ust_libc.h
> c/liblttng-ust-libc-wrapper/ust_libc.h
> --- b/liblttng-ust-libc-wrapper/ust_libc.h 2015-01-06 17:14:34.000000000
> +0100
> +++ c/liblttng-ust-libc-wrapper/ust_libc.h 2015-01-06 17:16:40.811145106
> +0100
> @@ -33,54 +33,60 @@
> #include <lttng/tracepoint.h>

> TRACEPOINT_EVENT(ust_libc, malloc,
> - TP_ARGS(size_t, size, void *, ptr),
> + TP_ARGS(size_t, size, void *, ptr, void *, ra),
> TP_FIELDS(
> ctf_integer(size_t, size, size)
> ctf_integer_hex(void *, ptr, ptr)
> + ctf_integer_hex(void *, ra, ra)
> )
> )

> TRACEPOINT_EVENT(ust_libc, free,
> - TP_ARGS(void *, ptr),
> + TP_ARGS(void *, ptr, void *, ra),
> TP_FIELDS(
> ctf_integer_hex(void *, ptr, ptr)
> + ctf_integer_hex(void *, ra, ra)
> )
> )

> TRACEPOINT_EVENT(ust_libc, calloc,
> - TP_ARGS(size_t, nmemb, size_t, size, void *, ptr),
> + TP_ARGS(size_t, nmemb, size_t, size, void *, ptr, void *, ra),
> TP_FIELDS(
> ctf_integer(size_t, nmemb, nmemb)
> ctf_integer(size_t, size, size)
> ctf_integer_hex(void *, ptr, ptr)
> + ctf_integer_hex(void *, ra, ra)
> )
> )

> TRACEPOINT_EVENT(ust_libc, realloc,
> - TP_ARGS(void *, in_ptr, size_t, size, void *, ptr),
> + TP_ARGS(void *, in_ptr, size_t, size, void *, ptr, void *, ra),
> TP_FIELDS(
> ctf_integer_hex(void *, in_ptr, in_ptr)
> ctf_integer(size_t, size, size)
> ctf_integer_hex(void *, ptr, ptr)
> + ctf_integer_hex(void *, ra, ra)
> )
> )

> TRACEPOINT_EVENT(ust_libc, memalign,
> - TP_ARGS(size_t, alignment, size_t, size, void *, ptr),
> + TP_ARGS(size_t, alignment, size_t, size, void *, ptr, void *, ra),
> TP_FIELDS(
> ctf_integer(size_t, alignment, alignment)
> ctf_integer(size_t, size, size)
> ctf_integer_hex(void *, ptr, ptr)
> + ctf_integer_hex(void *, ra, ra)
> )
> )

> TRACEPOINT_EVENT(ust_libc, posix_memalign,
> - TP_ARGS(void *, out_ptr, size_t, alignment, size_t, size, int, result),
> + TP_ARGS(void *, out_ptr, size_t, alignment, size_t, size, int, result, void
> *, ra),
> TP_FIELDS(
> ctf_integer_hex(void *, out_ptr, out_ptr)
> ctf_integer(size_t, alignment, alignment)
> ctf_integer(size_t, size, size)
> ctf_integer(int, result, result)
> + ctf_integer_hex(void *, ra, ra)
> )
> )

> Best regards,
> 
> Olivier Delbeke Senior Software Engineer
> Olivier.Delbeke@awtce.be / T. +32 2 389 25 53
> AWTC Europe S.A. - Avenue de l’Industrie, 19 - 1420 Braine-l’Alleud - Belgium
> - www.aweurope.eu - www.aisin-aw.co.jp
> VAT : BE 0474.474.114 - RPM Nivelles

> This mail, and any attachments thereto, is intended only for use by the
> addressee(s) named herein and may contain legally privileged and/or
> confidential information. If you are not the intended recipient, please note
> that any review, dissemination, disclosure, alteration, printing, copying or
> transmission of this mail and/or any file transmitted with it, is strictly
> prohibited and may be unlawful. If you have received this mail by mistake,
> please immediately notify the sender as well as our mail administrator at
> postmaster@aweurope.be, and permanently destroy the original as well as any
> copy thereof.
> _______________________________________________
> lttng-dev mailing list
> lttng-dev@lists.lttng.org
> http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev

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

[-- Attachment #1.2.1: Type: text/html, Size: 30628 bytes --]

[-- Attachment #1.2.2: 1E482660.jpg --]
[-- Type: image/jpeg, Size: 9458 bytes --]

[-- Attachment #1.2.3: ecblank.gif --]
[-- Type: image/gif, Size: 45 bytes --]

[-- Attachment #2: Type: text/plain, Size: 155 bytes --]

_______________________________________________
lttng-dev mailing list
lttng-dev@lists.lttng.org
http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Addition of the return address to liblttng-ust-libc-wrapper
       [not found] ` <1127206322.43789.1421439222351.JavaMail.zimbra@efficios.com>
@ 2015-01-16 20:32   ` Simon Marchi
       [not found]   ` <CAFXXi0nzOHHPx+h5vUs-pCe1-zT0T=6jNq6L+EJN6z0Nh-_NMA@mail.gmail.com>
  1 sibling, 0 replies; 9+ messages in thread
From: Simon Marchi @ 2015-01-16 20:32 UTC (permalink / raw)
  To: Mathieu Desnoyers; +Cc: lttng-dev

On 16 January 2015 at 15:13, Mathieu Desnoyers
<mathieu.desnoyers@efficios.com> wrote:
>
> ________________________________
>
> From: "Olivier Delbeke" <Olivier.Delbeke@awtce.be>
> To: lttng-dev@lists.lttng.org
> Sent: Tuesday, January 13, 2015 10:50:38 AM
> Subject: [lttng-dev] Addition of the return address to        liblttng-ust-libc-wrapper
>
> Hi guys,
>
>
> I am using liblttng-ust-libc-wrapper to detect memory leaks in my applications.
> In order to identify not only the thread where the unfreed allocations are done, but also the calling function, I extended the liblttng-ust-libc-wrapper to log the "return address" (__builtin_return_address(0)) in addition to the parameters of malloc(). It solves my problem and does not affect Trace Compass.
> Was this the right thing to do ?
>
>
> You should be able to achieve the same thing with the "ip" context, e.g.:
>
> lttng create
> lttng enable-event -u -a
> lttng add-context -u -t ip
> lttng start
> ....
>
> All this dynamically without changing the instrumentation.
>
> Thanks,
>
> Mathieu

I might be wrong, but from what I understand, Olivier's patch recorded
the address of the caller of malloc. Adding the ip context will record
the ip of the location of the tracepoint macro call, which will always
be the same (an address in liblttng-ust-malloc's malloc).

Simon

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Addition of the return address to liblttng-ust-libc-wrapper
       [not found]   ` <CAFXXi0nzOHHPx+h5vUs-pCe1-zT0T=6jNq6L+EJN6z0Nh-_NMA@mail.gmail.com>
@ 2015-01-16 20:37     ` Mathieu Desnoyers
  0 siblings, 0 replies; 9+ messages in thread
From: Mathieu Desnoyers @ 2015-01-16 20:37 UTC (permalink / raw)
  To: Simon Marchi; +Cc: lttng-dev

----- Original Message -----
> From: "Simon Marchi" <simon.marchi@polymtl.ca>
> To: "Mathieu Desnoyers" <mathieu.desnoyers@efficios.com>
> Cc: "Olivier Delbeke" <Olivier.Delbeke@awtce.be>, lttng-dev@lists.lttng.org
> Sent: Friday, January 16, 2015 3:32:56 PM
> Subject: Re: [lttng-dev] Addition of the return address to liblttng-ust-libc-wrapper
> 
> On 16 January 2015 at 15:13, Mathieu Desnoyers
> <mathieu.desnoyers@efficios.com> wrote:
> >
> > ________________________________
> >
> > From: "Olivier Delbeke" <Olivier.Delbeke@awtce.be>
> > To: lttng-dev@lists.lttng.org
> > Sent: Tuesday, January 13, 2015 10:50:38 AM
> > Subject: [lttng-dev] Addition of the return address to
> > liblttng-ust-libc-wrapper
> >
> > Hi guys,
> >
> >
> > I am using liblttng-ust-libc-wrapper to detect memory leaks in my
> > applications.
> > In order to identify not only the thread where the unfreed allocations are
> > done, but also the calling function, I extended the
> > liblttng-ust-libc-wrapper to log the "return address"
> > (__builtin_return_address(0)) in addition to the parameters of malloc().
> > It solves my problem and does not affect Trace Compass.
> > Was this the right thing to do ?
> >
> >
> > You should be able to achieve the same thing with the "ip" context, e.g.:
> >
> > lttng create
> > lttng enable-event -u -a
> > lttng add-context -u -t ip
> > lttng start
> > ....
> >
> > All this dynamically without changing the instrumentation.
> >
> > Thanks,
> >
> > Mathieu
> 
> I might be wrong, but from what I understand, Olivier's patch recorded
> the address of the caller of malloc. Adding the ip context will record
> the ip of the location of the tracepoint macro call, which will always
> be the same (an address in liblttng-ust-malloc's malloc).
> 

Good point! In that case, adding the caller address as tracepoint parameter
could make sense indeed. Another approach would be to implement a full stack
dump as a context.

Thanks,

Mathieu

> Simon
> 

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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Addition of the return address to liblttng-ust-libc-wrapper
       [not found] <OF7097A1B1.090ABAC2-ONC1257DCC.0053FE7C-C1257DCC.00570880@LocalDomain>
  2015-01-16 20:13 ` Addition of the return address to liblttng-ust-libc-wrapper Mathieu Desnoyers
       [not found] ` <1127206322.43789.1421439222351.JavaMail.zimbra@efficios.com>
@ 2015-01-16 20:41 ` Mathieu Desnoyers
       [not found] ` <54250547.44000.1421440866572.JavaMail.zimbra@efficios.com>
  3 siblings, 0 replies; 9+ messages in thread
From: Mathieu Desnoyers @ 2015-01-16 20:41 UTC (permalink / raw)
  To: Olivier Delbeke; +Cc: lttng-dev


[-- Attachment #1.1: Type: text/plain, Size: 6436 bytes --]

----- Original Message -----

> From: "Olivier Delbeke" <Olivier.Delbeke@awtce.be>
> To: lttng-dev@lists.lttng.org
> Sent: Tuesday, January 13, 2015 10:50:38 AM
> Subject: [lttng-dev] Addition of the return address to
> liblttng-ust-libc-wrapper

> Hi guys,

> I am using liblttng-ust-libc-wrapper to detect memory leaks in my
> applications.
> In order to identify not only the thread where the unfreed allocations are
> done, but also the calling function, I extended the
> liblttng-ust-libc-wrapper to log the "return address"
> (__builtin_return_address(0)) in addition to the parameters of malloc(). It
> solves my problem and does not affect Trace Compass.
> Was this the right thing to do ?
> If it is, then I guess that it might interest other people too.
After further thought, I'm interested to merge this into UST master. 

Can you re-send either as an attachment, or as plain text without the 
base64 encoding ? 

Thanks! 

Mathieu 

> diff -Nurd b/liblttng-ust-libc-wrapper/lttng-ust-malloc.c
> c/liblttng-ust-libc-wrapper/lttng-ust-malloc.c
> --- b/liblttng-ust-libc-wrapper/lttng-ust-malloc.c 2015-01-06
> 17:14:34.000000000 +0100
> +++ c/liblttng-ust-libc-wrapper/lttng-ust-malloc.c 2015-01-06
> 17:16:40.811145106 +0100
> @@ -260,7 +260,7 @@
> }
> retval = cur_alloc.malloc(size);
> if (URCU_TLS(malloc_nesting) == 1) {
> - tracepoint(ust_libc, malloc, size, retval);
> + tracepoint(ust_libc, malloc, size, retval, __builtin_return_address(0) );
> }
> URCU_TLS(malloc_nesting)--;
> return retval;
> @@ -279,7 +279,7 @@
> }

> if (URCU_TLS(malloc_nesting) == 1) {
> - tracepoint(ust_libc, free, ptr);
> + tracepoint(ust_libc, free, ptr, __builtin_return_address(0) );
> }

> if (cur_alloc.free == NULL) {
> @@ -308,7 +308,7 @@
> }
> retval = cur_alloc.calloc(nmemb, size);
> if (URCU_TLS(malloc_nesting) == 1) {
> - tracepoint(ust_libc, calloc, nmemb, size, retval);
> + tracepoint(ust_libc, calloc, nmemb, size, retval,
> __builtin_return_address(0) );
> }
> URCU_TLS(malloc_nesting)--;
> return retval;
> @@ -360,7 +360,7 @@
> retval = cur_alloc.realloc(ptr, size);
> end:
> if (URCU_TLS(malloc_nesting) == 1) {
> - tracepoint(ust_libc, realloc, ptr, size, retval);
> + tracepoint(ust_libc, realloc, ptr, size, retval,
> __builtin_return_address(0) );
> }
> URCU_TLS(malloc_nesting)--;
> return retval;
> @@ -380,7 +380,7 @@
> }
> retval = cur_alloc.memalign(alignment, size);
> if (URCU_TLS(malloc_nesting) == 1) {
> - tracepoint(ust_libc, memalign, alignment, size, retval);
> + tracepoint(ust_libc, memalign, alignment, size, retval,
> __builtin_return_address(0) );
> }
> URCU_TLS(malloc_nesting)--;
> return retval;
> @@ -401,7 +401,7 @@
> retval = cur_alloc.posix_memalign(memptr, alignment, size);
> if (URCU_TLS(malloc_nesting) == 1) {
> tracepoint(ust_libc, posix_memalign, *memptr, alignment, size,
> - retval);
> + retval, __builtin_return_address(0) );
> }
> URCU_TLS(malloc_nesting)--;
> return retval;
> diff -Nurd b/liblttng-ust-libc-wrapper/ust_libc.h
> c/liblttng-ust-libc-wrapper/ust_libc.h
> --- b/liblttng-ust-libc-wrapper/ust_libc.h 2015-01-06 17:14:34.000000000
> +0100
> +++ c/liblttng-ust-libc-wrapper/ust_libc.h 2015-01-06 17:16:40.811145106
> +0100
> @@ -33,54 +33,60 @@
> #include <lttng/tracepoint.h>

> TRACEPOINT_EVENT(ust_libc, malloc,
> - TP_ARGS(size_t, size, void *, ptr),
> + TP_ARGS(size_t, size, void *, ptr, void *, ra),
> TP_FIELDS(
> ctf_integer(size_t, size, size)
> ctf_integer_hex(void *, ptr, ptr)
> + ctf_integer_hex(void *, ra, ra)
> )
> )

> TRACEPOINT_EVENT(ust_libc, free,
> - TP_ARGS(void *, ptr),
> + TP_ARGS(void *, ptr, void *, ra),
> TP_FIELDS(
> ctf_integer_hex(void *, ptr, ptr)
> + ctf_integer_hex(void *, ra, ra)
> )
> )

> TRACEPOINT_EVENT(ust_libc, calloc,
> - TP_ARGS(size_t, nmemb, size_t, size, void *, ptr),
> + TP_ARGS(size_t, nmemb, size_t, size, void *, ptr, void *, ra),
> TP_FIELDS(
> ctf_integer(size_t, nmemb, nmemb)
> ctf_integer(size_t, size, size)
> ctf_integer_hex(void *, ptr, ptr)
> + ctf_integer_hex(void *, ra, ra)
> )
> )

> TRACEPOINT_EVENT(ust_libc, realloc,
> - TP_ARGS(void *, in_ptr, size_t, size, void *, ptr),
> + TP_ARGS(void *, in_ptr, size_t, size, void *, ptr, void *, ra),
> TP_FIELDS(
> ctf_integer_hex(void *, in_ptr, in_ptr)
> ctf_integer(size_t, size, size)
> ctf_integer_hex(void *, ptr, ptr)
> + ctf_integer_hex(void *, ra, ra)
> )
> )

> TRACEPOINT_EVENT(ust_libc, memalign,
> - TP_ARGS(size_t, alignment, size_t, size, void *, ptr),
> + TP_ARGS(size_t, alignment, size_t, size, void *, ptr, void *, ra),
> TP_FIELDS(
> ctf_integer(size_t, alignment, alignment)
> ctf_integer(size_t, size, size)
> ctf_integer_hex(void *, ptr, ptr)
> + ctf_integer_hex(void *, ra, ra)
> )
> )

> TRACEPOINT_EVENT(ust_libc, posix_memalign,
> - TP_ARGS(void *, out_ptr, size_t, alignment, size_t, size, int, result),
> + TP_ARGS(void *, out_ptr, size_t, alignment, size_t, size, int, result, void
> *, ra),
> TP_FIELDS(
> ctf_integer_hex(void *, out_ptr, out_ptr)
> ctf_integer(size_t, alignment, alignment)
> ctf_integer(size_t, size, size)
> ctf_integer(int, result, result)
> + ctf_integer_hex(void *, ra, ra)
> )
> )

> Best regards,
> 

> Olivier Delbeke Senior Software Engineer Olivier.Delbeke@awtce.be / T. +32 2
> 389 25 53 AWTC Europe S.A. - Avenue de l’Industrie, 19 - 1420
> Braine-l’Alleud - Belgium - www.aweurope.eu - www.aisin-aw.co.jp VAT : BE
> 0474.474.114 - RPM Nivelles
> This mail, and any attachments thereto, is intended only for use by the
> addressee(s) named herein and may contain legally privileged and/or
> confidential information. If you are not the intended recipient, please note
> that any review, dissemination, disclosure, alteration, printing, copying or
> transmission of this mail and/or any file transmitted with it, is strictly
> prohibited and may be unlawful. If you have received this mail by mistake,
> please immediately notify the sender as well as our mail administrator at
> postmaster@aweurope.be, and permanently destroy the original as well as any
> copy thereof.
> _______________________________________________
> lttng-dev mailing list
> lttng-dev@lists.lttng.org
> http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev

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

[-- Attachment #1.2.1: Type: text/html, Size: 30865 bytes --]

[-- Attachment #1.2.2: 1E482660.jpg --]
[-- Type: image/jpeg, Size: 9458 bytes --]

[-- Attachment #1.2.3: ecblank.gif --]
[-- Type: image/gif, Size: 45 bytes --]

[-- Attachment #2: Type: text/plain, Size: 155 bytes --]

_______________________________________________
lttng-dev mailing list
lttng-dev@lists.lttng.org
http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Addition of the return address to liblttng-ust-libc-wrapper
       [not found] ` <54250547.44000.1421440866572.JavaMail.zimbra@efficios.com>
@ 2015-01-16 20:57   ` Olivier Delbeke
       [not found]   ` <OF208CF361.F3A478C1-ONC1257DD2.00266C5D-C1257DD2.0026BC70@LocalDomain>
  1 sibling, 0 replies; 9+ messages in thread
From: Olivier Delbeke @ 2015-01-16 20:57 UTC (permalink / raw)
  To: Mathieu Desnoyers; +Cc: lttng-dev


[-- Attachment #1.1.1: Type: text/plain, Size: 7226 bytes --]

Hi,

The first thing I tried was indeed to add "ip" to the context, and the
result was always the same (the location of the tracepoint macro call
(useless in this case)).

I will send the patch on Monday. Thanks a lot.

Best regards,
Olivier

On Fri, Jan 16, 2015 at 9:41 PM, Mathieu Desnoyers <
mathieu.desnoyers@efficios.com> wrote:

> ------------------------------
>
> *From: *"Olivier Delbeke" <Olivier.Delbeke@awtce.be>
> *To: *lttng-dev@lists.lttng.org
> *Sent: *Tuesday, January 13, 2015 10:50:38 AM
> *Subject: *[lttng-dev] Addition of the return address
> to        liblttng-ust-libc-wrapper
>
> Hi guys,
>
> I am using liblttng-ust-libc-wrapper to detect memory leaks in my
> applications.
> In order to identify not only the thread where the unfreed allocations are
> done, but also the calling function, I extended the
> liblttng-ust-libc-wrapper to log the "return address"
> (__builtin_return_address(0)) in addition to the parameters of malloc(). It
> solves my problem and does not affect Trace Compass.
> Was this the right thing to do ?
> If it is, then I guess that it might interest other people too.
>
> After further thought, I'm interested to merge this into UST master.
>
> Can you re-send either as an attachment, or as plain text without the
> base64 encoding ?
>
> Thanks!
>
> Mathieu
>
>
>
> diff -Nurd b/liblttng-ust-libc-wrapper/lttng-ust-malloc.c
> c/liblttng-ust-libc-wrapper/lttng-ust-malloc.c
> --- b/liblttng-ust-libc-wrapper/lttng-ust-malloc.c 2015-01-06
> 17:14:34.000000000 +0100
> +++ c/liblttng-ust-libc-wrapper/lttng-ust-malloc.c 2015-01-06
> 17:16:40.811145106 +0100
> @@ -260,7 +260,7 @@
>   }
>   retval = cur_alloc.malloc(size);
>   if (URCU_TLS(malloc_nesting) == 1) {
> - tracepoint(ust_libc, malloc, size, retval);
> + tracepoint(ust_libc, malloc, size, retval, __builtin_return_address(0) );
>   }
>   URCU_TLS(malloc_nesting)--;
>   return retval;
> @@ -279,7 +279,7 @@
>   }
>
>   if (URCU_TLS(malloc_nesting) == 1) {
> - tracepoint(ust_libc, free, ptr);
> + tracepoint(ust_libc, free, ptr, __builtin_return_address(0) );
>   }
>
>   if (cur_alloc.free == NULL) {
> @@ -308,7 +308,7 @@
>   }
>   retval = cur_alloc.calloc(nmemb, size);
>   if (URCU_TLS(malloc_nesting) == 1) {
> - tracepoint(ust_libc, calloc, nmemb, size, retval);
> + tracepoint(ust_libc, calloc, nmemb, size, retval,
> __builtin_return_address(0) );
>   }
>   URCU_TLS(malloc_nesting)--;
>   return retval;
> @@ -360,7 +360,7 @@
>   retval = cur_alloc.realloc(ptr, size);
>  end:
>   if (URCU_TLS(malloc_nesting) == 1) {
> - tracepoint(ust_libc, realloc, ptr, size, retval);
> + tracepoint(ust_libc, realloc, ptr, size, retval,
> __builtin_return_address(0) );
>   }
>   URCU_TLS(malloc_nesting)--;
>   return retval;
> @@ -380,7 +380,7 @@
>   }
>   retval = cur_alloc.memalign(alignment, size);
>   if (URCU_TLS(malloc_nesting) == 1) {
> - tracepoint(ust_libc, memalign, alignment, size, retval);
> + tracepoint(ust_libc, memalign, alignment, size, retval,
> __builtin_return_address(0) );
>   }
>   URCU_TLS(malloc_nesting)--;
>   return retval;
> @@ -401,7 +401,7 @@
>   retval = cur_alloc.posix_memalign(memptr, alignment, size);
>   if (URCU_TLS(malloc_nesting) == 1) {
>   tracepoint(ust_libc, posix_memalign, *memptr, alignment, size,
> - retval);
> + retval, __builtin_return_address(0) );
>   }
>   URCU_TLS(malloc_nesting)--;
>   return retval;
> diff -Nurd b/liblttng-ust-libc-wrapper/ust_libc.h
> c/liblttng-ust-libc-wrapper/ust_libc.h
> --- b/liblttng-ust-libc-wrapper/ust_libc.h 2015-01-06 17:14:34.000000000
> +0100
> +++ c/liblttng-ust-libc-wrapper/ust_libc.h 2015-01-06 17:16:40.811145106
> +0100
> @@ -33,54 +33,60 @@
>  #include <lttng/tracepoint.h>
>
>  TRACEPOINT_EVENT(ust_libc, malloc,
> - TP_ARGS(size_t, size, void *, ptr),
> + TP_ARGS(size_t, size, void *, ptr, void *, ra),
>   TP_FIELDS(
>   ctf_integer(size_t, size, size)
>   ctf_integer_hex(void *, ptr, ptr)
> + ctf_integer_hex(void *, ra, ra)
>   )
>  )
>
>  TRACEPOINT_EVENT(ust_libc, free,
> - TP_ARGS(void *, ptr),
> + TP_ARGS(void *, ptr, void *, ra),
>   TP_FIELDS(
>   ctf_integer_hex(void *, ptr, ptr)
> + ctf_integer_hex(void *, ra, ra)
>   )
>  )
>
>  TRACEPOINT_EVENT(ust_libc, calloc,
> - TP_ARGS(size_t, nmemb, size_t, size, void *, ptr),
> + TP_ARGS(size_t, nmemb, size_t, size, void *, ptr, void *, ra),
>   TP_FIELDS(
>   ctf_integer(size_t, nmemb, nmemb)
>   ctf_integer(size_t, size, size)
>   ctf_integer_hex(void *, ptr, ptr)
> + ctf_integer_hex(void *, ra, ra)
>   )
>  )
>
>  TRACEPOINT_EVENT(ust_libc, realloc,
> - TP_ARGS(void *, in_ptr, size_t, size, void *, ptr),
> + TP_ARGS(void *, in_ptr, size_t, size, void *, ptr, void *, ra),
>   TP_FIELDS(
>   ctf_integer_hex(void *, in_ptr, in_ptr)
>   ctf_integer(size_t, size, size)
>   ctf_integer_hex(void *, ptr, ptr)
> + ctf_integer_hex(void *, ra, ra)
>   )
>  )
>
>  TRACEPOINT_EVENT(ust_libc, memalign,
> - TP_ARGS(size_t, alignment, size_t, size, void *, ptr),
> + TP_ARGS(size_t, alignment, size_t, size, void *, ptr, void *, ra),
>   TP_FIELDS(
>   ctf_integer(size_t, alignment, alignment)
>   ctf_integer(size_t, size, size)
>   ctf_integer_hex(void *, ptr, ptr)
> + ctf_integer_hex(void *, ra, ra)
>   )
>  )
>
>  TRACEPOINT_EVENT(ust_libc, posix_memalign,
> - TP_ARGS(void *, out_ptr, size_t, alignment, size_t, size, int, result),
> + TP_ARGS(void *, out_ptr, size_t, alignment, size_t, size, int, result,
> void *, ra),
>   TP_FIELDS(
>   ctf_integer_hex(void *, out_ptr, out_ptr)
>   ctf_integer(size_t, alignment, alignment)
>   ctf_integer(size_t, size, size)
>   ctf_integer(int, result, result)
> + ctf_integer_hex(void *, ra, ra)
>   )
>  )
>
> Best regards,
>
>    *Olivier Delbeke **Senior Software Engineer*
>    Olivier.Delbeke@awtce.be / T. +32 2 389 25 53
>    ------------------------------
>     *AWTC Europe S.A. *- Avenue de l’Industrie, 19 - 1420 Braine-l’Alleud
>    - Belgium - www.aweurope.eu - www.aisin-aw.co.jp
>    VAT : BE 0474.474.114 - RPM Nivelles
>
>
> This mail, and any attachments thereto, is intended only for use by the
> addressee(s) named herein and may contain legally privileged and/or
> confidential information. If you are not the intended recipient, please
> note that any review, dissemination, disclosure, alteration, printing,
> copying or transmission of this mail and/or any file transmitted with it,
> is strictly prohibited and may be unlawful. If you have received this mail
> by mistake, please immediately notify the sender as well as our mail
> administrator at postmaster@aweurope.be, and permanently destroy the
> original as well as any copy thereof.
> _______________________________________________
> lttng-dev mailing list
> lttng-dev@lists.lttng.org
> http://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
> http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
>
>

[-- Attachment #1.1.2: Type: text/html, Size: 23286 bytes --]

[-- Attachment #1.2: 1E482660.jpg --]
[-- Type: image/jpeg, Size: 9458 bytes --]

[-- Attachment #1.3: ecblank.gif --]
[-- Type: image/gif, Size: 45 bytes --]

[-- Attachment #2: Type: text/plain, Size: 155 bytes --]

_______________________________________________
lttng-dev mailing list
lttng-dev@lists.lttng.org
http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Addition of the return address toliblttng-ust-libc-wrapper
       [not found]   ` <OF208CF361.F3A478C1-ONC1257DD2.00266C5D-C1257DD2.0026BC70@LocalDomain>
@ 2015-01-19 16:48     ` Mathieu Desnoyers
       [not found]     ` <1097959140.8621.1421686124960.JavaMail.zimbra@efficios.com>
  1 sibling, 0 replies; 9+ messages in thread
From: Mathieu Desnoyers @ 2015-01-19 16:48 UTC (permalink / raw)
  To: Olivier Delbeke; +Cc: lttng-dev


[-- Attachment #1.1: Type: text/plain, Size: 8319 bytes --]

----- Original Message -----

> From: "Olivier Delbeke" <Olivier.Delbeke@awtce.be>
> To: "Mathieu Desnoyers" <mathieu.desnoyers@efficios.com>
> Sent: Monday, January 19, 2015 2:03:07 AM
> Subject: Re: [lttng-dev] Addition of the return address
> toliblttng-ust-libc-wrapper

> Hi Mathieu,

> Here is the patch you asked me : (See attached file:
> lttng-return-address.patch)

> First , I named the variable for return address "ra", then changed it to
> "caller". Of course, you're free to change it (to make it more clear or more
> in line with the rest of your code).
Great! 

Can I add your Signed-off-by tag to the patch header ? 

Thanks, 

Mathieu 

> Best regards,

> 

> Olivier Delbeke Senior Software Engineer Olivier.Delbeke@awtce.be / T. +32 2
> 389 25 53 AWTC Europe S.A. - Avenue de l’Industrie, 19 - 1420
> Braine-l’Alleud - Belgium - www.aweurope.eu - www.aisin-aw.co.jp VAT : BE
> 0474.474.114 - RPM Nivelles

> Mathieu Desnoyers ---01/16/2015 09:41:08 PM---Mathieu Desnoyers
> <mathieu.desnoyers@efficios.com>

> Mathieu Desnoyers <mathieu.desnoyers@efficios.com>

> 01/16/2015 09:41 PM
> To
> 

> Olivier Delbeke <Olivier.Delbeke@awtce.be>

> cc
> 

> lttng-dev@lists.lttng.org

> Subject
> 

> Re: [lttng-dev] Addition of the return address to liblttng-ust-libc-wrapper
> ----- Original Message -----

> From: "Olivier Delbeke" <Olivier.Delbeke@awtce.be> To:
> lttng-dev@lists.lttng.org Sent: Tuesday, January 13, 2015 10:50:38 AM
> Subject: [lttng-dev] Addition of the return address to
> liblttng-ust-libc-wrapper

> Hi guys,

> I am using liblttng-ust-libc-wrapper to detect memory leaks in my
> applications. In order to identify not only the thread where the unfreed
> allocations are done, but also the calling function, I extended the
> liblttng-ust-libc-wrapper to log the "return address"
> (__builtin_return_address(0)) in addition to the parameters of malloc(). It
> solves my problem and does not affect Trace Compass. Was this the right
> thing to do ? If it is, then I guess that it might interest other people
> too.
> After further thought, I'm interested to merge this into UST master.

> Can you re-send either as an attachment, or as plain text without the
> base64 encoding ?

> Thanks!

> Mathieu

> diff -Nurd b/liblttng-ust-libc-wrapper/lttng-ust-malloc.c
> c/liblttng-ust-libc-wrapper/lttng-ust-malloc.c ---
> b/liblttng-ust-libc-wrapper/lttng-ust-malloc.c 2015-01-06 17:14:34.000000000
> +0100 +++ c/liblttng-ust-libc-wrapper/lttng-ust-malloc.c 2015-01-06
> 17:16:40.811145106 +0100 @@ -260,7 +260,7 @@ } retval =
> cur_alloc.malloc(size); if (URCU_TLS(malloc_nesting) == 1) { -
> tracepoint(ust_libc, malloc, size, retval); + tracepoint(ust_libc, malloc,
> size, retval, __builtin_return_address(0) ); } URCU_TLS(malloc_nesting)--;
> return retval; @@ -279,7 +279,7 @@ } if (URCU_TLS(malloc_nesting) == 1) { -
> tracepoint(ust_libc, free, ptr); + tracepoint(ust_libc, free, ptr,
> __builtin_return_address(0) ); } if (cur_alloc.free == NULL) { @@ -308,7
> +308,7 @@ } retval = cur_alloc.calloc(nmemb, size); if
> (URCU_TLS(malloc_nesting) == 1) { - tracepoint(ust_libc, calloc, nmemb,
> size, retval); + tracepoint(ust_libc, calloc, nmemb, size, retval,
> __builtin_return_address(0) ); } URCU_TLS(malloc_nesting)--; return retval;
> @@ -360,7 +360,7 @@ retval = cur_alloc.realloc(ptr, size); end: if
> (URCU_TLS(malloc_nesting) == 1) { - tracepoint(ust_libc, realloc, ptr, size,
> retval); + tracepoint(ust_libc, realloc, ptr, size, retval,
> __builtin_return_address(0) ); } URCU_TLS(malloc_nesting)--; return retval;
> @@ -380,7 +380,7 @@ } retval = cur_alloc.memalign(alignment, size); if
> (URCU_TLS(malloc_nesting) == 1) { - tracepoint(ust_libc, memalign,
> alignment, size, retval); + tracepoint(ust_libc, memalign, alignment, size,
> retval, __builtin_return_address(0) ); } URCU_TLS(malloc_nesting)--; return
> retval; @@ -401,7 +401,7 @@ retval = cur_alloc.posix_memalign(memptr,
> alignment, size); if (URCU_TLS(malloc_nesting) == 1) { tracepoint(ust_libc,
> posix_memalign, *memptr, alignment, size, - retval); + retval,
> __builtin_return_address(0) ); } URCU_TLS(malloc_nesting)--; return retval;
> diff -Nurd b/liblttng-ust-libc-wrapper/ust_libc.h
> c/liblttng-ust-libc-wrapper/ust_libc.h ---
> b/liblttng-ust-libc-wrapper/ust_libc.h 2015-01-06 17:14:34.000000000 +0100
> +++ c/liblttng-ust-libc-wrapper/ust_libc.h 2015-01-06 17:16:40.811145106
> +0100 @@ -33,54 +33,60 @@ #include <lttng/tracepoint.h>
> TRACEPOINT_EVENT(ust_libc, malloc, - TP_ARGS(size_t, size, void *, ptr), +
> TP_ARGS(size_t, size, void *, ptr, void *, ra), TP_FIELDS(
> ctf_integer(size_t, size, size) ctf_integer_hex(void *, ptr, ptr) +
> ctf_integer_hex(void *, ra, ra) ) ) TRACEPOINT_EVENT(ust_libc, free, -
> TP_ARGS(void *, ptr), + TP_ARGS(void *, ptr, void *, ra), TP_FIELDS(
> ctf_integer_hex(void *, ptr, ptr) + ctf_integer_hex(void *, ra, ra) ) )
> TRACEPOINT_EVENT(ust_libc, calloc, - TP_ARGS(size_t, nmemb, size_t, size,
> void *, ptr), + TP_ARGS(size_t, nmemb, size_t, size, void *, ptr, void *,
> ra), TP_FIELDS( ctf_integer(size_t, nmemb, nmemb) ctf_integer(size_t, size,
> size) ctf_integer_hex(void *, ptr, ptr) + ctf_integer_hex(void *, ra, ra) )
> ) TRACEPOINT_EVENT(ust_libc, realloc, - TP_ARGS(void *, in_ptr, size_t,
> size, void *, ptr), + TP_ARGS(void *, in_ptr, size_t, size, void *, ptr,
> void *, ra), TP_FIELDS( ctf_integer_hex(void *, in_ptr, in_ptr)
> ctf_integer(size_t, size, size) ctf_integer_hex(void *, ptr, ptr) +
> ctf_integer_hex(void *, ra, ra) ) ) TRACEPOINT_EVENT(ust_libc, memalign, -
> TP_ARGS(size_t, alignment, size_t, size, void *, ptr), + TP_ARGS(size_t,
> alignment, size_t, size, void *, ptr, void *, ra), TP_FIELDS(
> ctf_integer(size_t, alignment, alignment) ctf_integer(size_t, size, size)
> ctf_integer_hex(void *, ptr, ptr) + ctf_integer_hex(void *, ra, ra) ) )
> TRACEPOINT_EVENT(ust_libc, posix_memalign, - TP_ARGS(void *, out_ptr,
> size_t, alignment, size_t, size, int, result), + TP_ARGS(void *, out_ptr,
> size_t, alignment, size_t, size, int, result, void *, ra), TP_FIELDS(
> ctf_integer_hex(void *, out_ptr, out_ptr) ctf_integer(size_t, alignment,
> alignment) ctf_integer(size_t, size, size) ctf_integer(int, result, result)
> + ctf_integer_hex(void *, ra, ra) ) ) Best regards,
> 

> Olivier Delbeke Senior Software Engineer Olivier.Delbeke@awtce.be / T. +32 2
> 389 25 53 AWTC Europe S.A. - Avenue de l’Industrie, 19 - 1420
> Braine-l’Alleud - Belgium - www.aweurope.eu - www.aisin-aw.co.jp VAT : BE
> 0474.474.114 - RPM Nivelles This mail, and any attachments thereto, is
> intended only for use by the addressee(s) named herein and may contain
> legally privileged and/or confidential information. If you are not the
> intended recipient, please note that any review, dissemination, disclosure,
> alteration, printing, copying or transmission of this mail and/or any file
> transmitted with it, is strictly prohibited and may be unlawful. If you have
> received this mail by mistake, please immediately notify the sender as well
> as our mail administrator at postmaster@aweurope.be, and permanently destroy
> the original as well as any copy thereof.
> _______________________________________________ lttng-dev mailing list
> lttng-dev@lists.lttng.org
> http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev

> --
> Mathieu Desnoyers
> EfficiOS Inc.
> http://www.efficios.com
> (See attached file: 1E482660.jpg) (See attached file: ecblank.gif)
> This mail, and any attachments thereto, is intended only for use by the
> addressee(s) named herein and may contain legally privileged and/or
> confidential information. If you are not the intended recipient, please note
> that any review, dissemination, disclosure, alteration, printing, copying or
> transmission of this mail and/or any file transmitted with it, is strictly
> prohibited and may be unlawful. If you have received this mail by mistake,
> please immediately notify the sender as well as our mail administrator at
> postmaster@aweurope.be, and permanently destroy the original as well as any
> copy thereof.
-- 
Mathieu Desnoyers 
EfficiOS Inc. 
http://www.efficios.com 

[-- Attachment #1.2.1: Type: text/html, Size: 21912 bytes --]

[-- Attachment #1.2.2: 1D220451.jpg --]
[-- Type: image/jpeg, Size: 9458 bytes --]

[-- Attachment #1.2.3: ecblank.gif --]
[-- Type: image/gif, Size: 45 bytes --]

[-- Attachment #1.2.4: graycol.gif --]
[-- Type: image/gif, Size: 105 bytes --]

[-- Attachment #2: Type: text/plain, Size: 155 bytes --]

_______________________________________________
lttng-dev mailing list
lttng-dev@lists.lttng.org
http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Addition of the return address toliblttng-ust-libc-wrapper
       [not found]     ` <1097959140.8621.1421686124960.JavaMail.zimbra@efficios.com>
@ 2015-01-19 17:19       ` Olivier Delbeke
       [not found]       ` <CAO6pHzgetc1HSYvmOzh5u7oMt5LANv1Ttb=qxTdqchspXaGhdg@mail.gmail.com>
  1 sibling, 0 replies; 9+ messages in thread
From: Olivier Delbeke @ 2015-01-19 17:19 UTC (permalink / raw)
  To: Mathieu Desnoyers; +Cc: lttng-dev


[-- Attachment #1.1.1: Type: text/plain, Size: 10023 bytes --]

Hi Mathieu,

Yes, feel free to add my Signed-off-by tag to the patch header. I would
just ask you to use my gmail address.

Have a nice evening,

Best regards,
Olivier

On Mon, Jan 19, 2015 at 5:48 PM, Mathieu Desnoyers <
mathieu.desnoyers@efficios.com> wrote:

> ------------------------------
>
> *From: *"Olivier Delbeke" <Olivier.Delbeke@awtce.be>
> *To: *"Mathieu Desnoyers" <mathieu.desnoyers@efficios.com>
> *Sent: *Monday, January 19, 2015 2:03:07 AM
> *Subject: *Re: [lttng-dev] Addition of the return address
> toliblttng-ust-libc-wrapper
>
> Hi Mathieu,
>
> Here is the patch you asked me : *(See attached file:
> lttng-return-address.patch)*
>
> First , I named the variable for return address "ra", then changed it to
> "caller". Of course, you're free to change it (to make it more clear or
> more in line with the rest of your code).
>
>
> Great!
>
> Can I add your Signed-off-by tag to the patch header ?
>
> Thanks,
>
> Mathieu
>
>
> Best regards,
>
>
>    *Olivier Delbeke **Senior Software Engineer*
>    Olivier.Delbeke@awtce.be / T. +32 2 389 25 53
>    ------------------------------
>     *AWTC Europe S.A. *- Avenue de l’Industrie, 19 - 1420 Braine-l’Alleud
>    - Belgium - www.aweurope.eu - www.aisin-aw.co.jp
>    VAT : BE 0474.474.114 - RPM Nivelles
>
>
>
> [image: Inactive hide details for Mathieu Desnoyers ---01/16/2015 09:41:08
> PM---Mathieu Desnoyers <mathieu.desnoyers@efficios.com>]Mathieu Desnoyers
> ---01/16/2015 09:41:08 PM---Mathieu Desnoyers <
> mathieu.desnoyers@efficios.com>
>
>
>    *Mathieu Desnoyers <mathieu.desnoyers@efficios.com
>    <mathieu.desnoyers@efficios.com>>*
>
>    01/16/2015 09:41 PM
>
>
> To
>
>
>    Olivier Delbeke <Olivier.Delbeke@awtce.be>
>
>
> cc
>
>
>    lttng-dev@lists.lttng.org
>
>
> Subject
>
>
>    Re: [lttng-dev] Addition of the return address to
>    liblttng-ust-libc-wrapper
>
>
> ------------------------------
>
>    *From: *"Olivier Delbeke" <Olivier.Delbeke@awtce.be>
> * To: *lttng-dev@lists.lttng.org
> * Sent: *Tuesday, January 13, 2015 10:50:38 AM
> * Subject: *[lttng-dev] Addition of the return address to
>     liblttng-ust-libc-wrapper
>
>    Hi guys,
>
>
>    I am using liblttng-ust-libc-wrapper to detect memory leaks in my
>    applications.
>    In order to identify not only the thread where the unfreed allocations
>    are done, but also the calling function, I extended the
>    liblttng-ust-libc-wrapper to log the "return address"
>    (__builtin_return_address(0)) in addition to the parameters of malloc(). It
>    solves my problem and does not affect Trace Compass.
>    Was this the right thing to do ?
>    If it is, then I guess that it might interest other people too.
>
> After further thought, I'm interested to merge this into UST master.
>
> Can you re-send either as an attachment, or as plain text without the
> base64 encoding ?
>
> Thanks!
>
> Mathieu
>
>
>
>    diff -Nurd b/liblttng-ust-libc-wrapper/lttng-ust-malloc.c
>    c/liblttng-ust-libc-wrapper/lttng-ust-malloc.c
>    --- b/liblttng-ust-libc-wrapper/lttng-ust-malloc.c 2015-01-06
>    17:14:34.000000000 +0100
>    +++ c/liblttng-ust-libc-wrapper/lttng-ust-malloc.c 2015-01-06
>    17:16:40.811145106 +0100
>    @@ -260,7 +260,7 @@
>     }
>     retval = cur_alloc.malloc(size);
>     if (URCU_TLS(malloc_nesting) == 1) {
>    - tracepoint(ust_libc, malloc, size, retval);
>    + tracepoint(ust_libc, malloc, size, retval,
>    __builtin_return_address(0) );
>     }
>     URCU_TLS(malloc_nesting)--;
>     return retval;
>    @@ -279,7 +279,7 @@
>     }
>
>     if (URCU_TLS(malloc_nesting) == 1) {
>    - tracepoint(ust_libc, free, ptr);
>    + tracepoint(ust_libc, free, ptr, __builtin_return_address(0) );
>     }
>
>     if (cur_alloc.free == NULL) {
>    @@ -308,7 +308,7 @@
>     }
>     retval = cur_alloc.calloc(nmemb, size);
>     if (URCU_TLS(malloc_nesting) == 1) {
>    - tracepoint(ust_libc, calloc, nmemb, size, retval);
>    + tracepoint(ust_libc, calloc, nmemb, size, retval,
>    __builtin_return_address(0) );
>     }
>     URCU_TLS(malloc_nesting)--;
>     return retval;
>    @@ -360,7 +360,7 @@
>     retval = cur_alloc.realloc(ptr, size);
>    end:
>     if (URCU_TLS(malloc_nesting) == 1) {
>    - tracepoint(ust_libc, realloc, ptr, size, retval);
>    + tracepoint(ust_libc, realloc, ptr, size, retval,
>    __builtin_return_address(0) );
>     }
>     URCU_TLS(malloc_nesting)--;
>     return retval;
>    @@ -380,7 +380,7 @@
>     }
>     retval = cur_alloc.memalign(alignment, size);
>     if (URCU_TLS(malloc_nesting) == 1) {
>    - tracepoint(ust_libc, memalign, alignment, size, retval);
>    + tracepoint(ust_libc, memalign, alignment, size, retval,
>    __builtin_return_address(0) );
>     }
>     URCU_TLS(malloc_nesting)--;
>     return retval;
>    @@ -401,7 +401,7 @@
>     retval = cur_alloc.posix_memalign(memptr, alignment, size);
>     if (URCU_TLS(malloc_nesting) == 1) {
>     tracepoint(ust_libc, posix_memalign, *memptr, alignment, size,
>    - retval);
>    + retval, __builtin_return_address(0) );
>     }
>     URCU_TLS(malloc_nesting)--;
>     return retval;
>    diff -Nurd b/liblttng-ust-libc-wrapper/ust_libc.h
>    c/liblttng-ust-libc-wrapper/ust_libc.h
>    --- b/liblttng-ust-libc-wrapper/ust_libc.h 2015-01-06
>    17:14:34.000000000 +0100
>    +++ c/liblttng-ust-libc-wrapper/ust_libc.h 2015-01-06
>    17:16:40.811145106 +0100
>    @@ -33,54 +33,60 @@
>    #include <lttng/tracepoint.h>
>
>    TRACEPOINT_EVENT(ust_libc, malloc,
>    - TP_ARGS(size_t, size, void *, ptr),
>    + TP_ARGS(size_t, size, void *, ptr, void *, ra),
>     TP_FIELDS(
>     ctf_integer(size_t, size, size)
>     ctf_integer_hex(void *, ptr, ptr)
>    + ctf_integer_hex(void *, ra, ra)
>     )
>    )
>
>    TRACEPOINT_EVENT(ust_libc, free,
>    - TP_ARGS(void *, ptr),
>    + TP_ARGS(void *, ptr, void *, ra),
>     TP_FIELDS(
>     ctf_integer_hex(void *, ptr, ptr)
>    + ctf_integer_hex(void *, ra, ra)
>     )
>    )
>
>    TRACEPOINT_EVENT(ust_libc, calloc,
>    - TP_ARGS(size_t, nmemb, size_t, size, void *, ptr),
>    + TP_ARGS(size_t, nmemb, size_t, size, void *, ptr, void *, ra),
>     TP_FIELDS(
>     ctf_integer(size_t, nmemb, nmemb)
>     ctf_integer(size_t, size, size)
>     ctf_integer_hex(void *, ptr, ptr)
>    + ctf_integer_hex(void *, ra, ra)
>     )
>    )
>
>    TRACEPOINT_EVENT(ust_libc, realloc,
>    - TP_ARGS(void *, in_ptr, size_t, size, void *, ptr),
>    + TP_ARGS(void *, in_ptr, size_t, size, void *, ptr, void *, ra),
>     TP_FIELDS(
>     ctf_integer_hex(void *, in_ptr, in_ptr)
>     ctf_integer(size_t, size, size)
>     ctf_integer_hex(void *, ptr, ptr)
>    + ctf_integer_hex(void *, ra, ra)
>     )
>    )
>
>    TRACEPOINT_EVENT(ust_libc, memalign,
>    - TP_ARGS(size_t, alignment, size_t, size, void *, ptr),
>    + TP_ARGS(size_t, alignment, size_t, size, void *, ptr, void *, ra),
>     TP_FIELDS(
>     ctf_integer(size_t, alignment, alignment)
>     ctf_integer(size_t, size, size)
>     ctf_integer_hex(void *, ptr, ptr)
>    + ctf_integer_hex(void *, ra, ra)
>     )
>    )
>
>    TRACEPOINT_EVENT(ust_libc, posix_memalign,
>    - TP_ARGS(void *, out_ptr, size_t, alignment, size_t, size, int,
>    result),
>    + TP_ARGS(void *, out_ptr, size_t, alignment, size_t, size, int,
>    result, void *, ra),
>     TP_FIELDS(
>     ctf_integer_hex(void *, out_ptr, out_ptr)
>     ctf_integer(size_t, alignment, alignment)
>     ctf_integer(size_t, size, size)
>     ctf_integer(int, result, result)
>    + ctf_integer_hex(void *, ra, ra)
>     )
>    )
>
>    Best regards,
>    *Olivier Delbeke **Senior Software Engineer*
>       Olivier.Delbeke@awtce.be / T. +32 2 389 25 53
>       ------------------------------
>        *AWTC Europe S.A. *- Avenue de l’Industrie, 19 - 1420
>       Braine-l’Alleud - Belgium - www.aweurope.eu - www.aisin-aw.co.jp
>       VAT : BE 0474.474.114 - RPM Nivelles
>
>    This mail, and any attachments thereto, is intended only for use by
>    the addressee(s) named herein and may contain legally privileged and/or
>    confidential information. If you are not the intended recipient, please
>    note that any review, dissemination, disclosure, alteration, printing,
>    copying or transmission of this mail and/or any file transmitted with it,
>    is strictly prohibited and may be unlawful. If you have received this mail
>    by mistake, please immediately notify the sender as well as our mail
>    administrator at postmaster@aweurope.be, and permanently destroy the
>    original as well as any copy thereof.
>    _______________________________________________
>    lttng-dev mailing list
>    lttng-dev@lists.lttng.org
>    http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
>
>
>
>
> --
> Mathieu Desnoyers
> EfficiOS Inc.
> http://www.efficios.com
> *(See attached file: 1E482660.jpg)**(See attached file: ecblank.gif)*
> This mail, and any attachments thereto, is intended only for use by the
> addressee(s) named herein and may contain legally privileged and/or
> confidential information. If you are not the intended recipient, please
> note that any review, dissemination, disclosure, alteration, printing,
> copying or transmission of this mail and/or any file transmitted with it,
> is strictly prohibited and may be unlawful. If you have received this mail
> by mistake, please immediately notify the sender as well as our mail
> administrator at postmaster@aweurope.be, and permanently destroy the
> original as well as any copy thereof.
>
>
>
>
> --
> Mathieu Desnoyers
> EfficiOS Inc.
> http://www.efficios.com
>
> _______________________________________________
> lttng-dev mailing list
> lttng-dev@lists.lttng.org
> http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
>
>

[-- Attachment #1.1.2: Type: text/html, Size: 20115 bytes --]

[-- Attachment #1.2: ecblank.gif --]
[-- Type: image/gif, Size: 45 bytes --]

[-- Attachment #1.3: graycol.gif --]
[-- Type: image/gif, Size: 105 bytes --]

[-- Attachment #1.4: 1D220451.jpg --]
[-- Type: image/jpeg, Size: 9458 bytes --]

[-- Attachment #2: Type: text/plain, Size: 155 bytes --]

_______________________________________________
lttng-dev mailing list
lttng-dev@lists.lttng.org
http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Addition of the return address toliblttng-ust-libc-wrapper
       [not found]       ` <CAO6pHzgetc1HSYvmOzh5u7oMt5LANv1Ttb=qxTdqchspXaGhdg@mail.gmail.com>
@ 2015-01-19 19:15         ` Mathieu Desnoyers
       [not found]         ` <1680663293.9819.1421694937650.JavaMail.zimbra@efficios.com>
  1 sibling, 0 replies; 9+ messages in thread
From: Mathieu Desnoyers @ 2015-01-19 19:15 UTC (permalink / raw)
  To: Olivier Delbeke; +Cc: lttng-dev


[-- Attachment #1.1: Type: text/plain, Size: 10424 bytes --]

----- Original Message -----

> From: "Olivier Delbeke" <olivier.delbeke@gmail.com>
> To: "Mathieu Desnoyers" <mathieu.desnoyers@efficios.com>
> Cc: "lttng-dev" <lttng-dev@lists.lttng.org>
> Sent: Monday, January 19, 2015 12:19:41 PM
> Subject: Re: [lttng-dev] Addition of the return address
> toliblttng-ust-libc-wrapper

> Hi Mathieu,

> Yes, feel free to add my Signed-off-by tag to the patch header. I would just
> ask you to use my gmail address.

OK, now merged into master, thanks! 

Mathieu 

> Have a nice evening,

> Best regards,
> Olivier

> On Mon, Jan 19, 2015 at 5:48 PM, Mathieu Desnoyers <
> mathieu.desnoyers@efficios.com > wrote:

> > > From: "Olivier Delbeke" < Olivier.Delbeke@awtce.be >
> > 
> 
> > > To: "Mathieu Desnoyers" < mathieu.desnoyers@efficios.com >
> > 
> 
> > > Sent: Monday, January 19, 2015 2:03:07 AM
> > 
> 
> > > Subject: Re: [lttng-dev] Addition of the return address
> > > toliblttng-ust-libc-wrapper
> > 
> 

> > > Hi Mathieu,
> > 
> 

> > > Here is the patch you asked me : (See attached file:
> > > lttng-return-address.patch)
> > 
> 

> > > First , I named the variable for return address "ra", then changed it to
> > > "caller". Of course, you're free to change it (to make it more clear or
> > > more
> > > in line with the rest of your code).
> > 
> 
> > Great!
> 

> > Can I add your Signed-off-by tag to the patch header ?
> 

> > Thanks,
> 

> > Mathieu
> 

> > > Best regards,
> > 
> 

> > > 
> > 
> 

> > > Olivier Delbeke Senior Software Engineer Olivier.Delbeke@awtce.be / T.
> > > +32
> > > 2
> > > 389 25 53 AWTC Europe S.A. - Avenue de l’Industrie, 19 - 1420
> > > Braine-l’Alleud - Belgium - www.aweurope.eu - www.aisin-aw.co.jp VAT : BE
> > > 0474.474.114 - RPM Nivelles
> > 
> 

> > > Mathieu Desnoyers ---01/16/2015 09:41:08 PM---Mathieu Desnoyers <
> > > mathieu.desnoyers@efficios.com >
> > 
> 

> > > Mathieu Desnoyers < mathieu.desnoyers@efficios.com >
> > 
> 

> > > 01/16/2015 09:41 PM
> > 
> 
> > > To
> > 
> 
> > > 
> > 
> 

> > > Olivier Delbeke < Olivier.Delbeke@awtce.be >
> > 
> 

> > > cc
> > 
> 
> > > 
> > 
> 

> > > lttng-dev@lists.lttng.org
> > 
> 

> > > Subject
> > 
> 
> > > 
> > 
> 

> > > Re: [lttng-dev] Addition of the return address to
> > > liblttng-ust-libc-wrapper
> > 
> 

> > > From: "Olivier Delbeke" < Olivier.Delbeke@awtce.be > To:
> > > lttng-dev@lists.lttng.org Sent: Tuesday, January 13, 2015 10:50:38 AM
> > > Subject: [lttng-dev] Addition of the return address to
> > > liblttng-ust-libc-wrapper
> > 
> 

> > > Hi guys,
> > 
> 

> > > I am using liblttng-ust-libc-wrapper to detect memory leaks in my
> > > applications. In order to identify not only the thread where the unfreed
> > > allocations are done, but also the calling function, I extended the
> > > liblttng-ust-libc-wrapper to log the "return address"
> > > (__builtin_return_address(0)) in addition to the parameters of malloc().
> > > It
> > > solves my problem and does not affect Trace Compass. Was this the right
> > > thing to do ? If it is, then I guess that it might interest other people
> > > too.
> > 
> 
> > > After further thought, I'm interested to merge this into UST master.
> > 
> 

> > > Can you re-send either as an attachment, or as plain text without the
> > 
> 
> > > base64 encoding ?
> > 
> 

> > > Thanks!
> > 
> 

> > > Mathieu
> > 
> 

> > > diff -Nurd b/liblttng-ust-libc-wrapper/lttng-ust-malloc.c
> > > c/liblttng-ust-libc-wrapper/lttng-ust-malloc.c ---
> > > b/liblttng-ust-libc-wrapper/lttng-ust-malloc.c 2015-01-06
> > > 17:14:34.000000000
> > > +0100 +++ c/liblttng-ust-libc-wrapper/lttng-ust-malloc.c 2015-01-06
> > > 17:16:40.811145106 +0100 @@ -260,7 +260,7 @@ } retval =
> > > cur_alloc.malloc(size); if (URCU_TLS(malloc_nesting) == 1) { -
> > > tracepoint(ust_libc, malloc, size, retval); + tracepoint(ust_libc,
> > > malloc,
> > > size, retval, __builtin_return_address(0) ); }
> > > URCU_TLS(malloc_nesting)--;
> > > return retval; @@ -279,7 +279,7 @@ } if (URCU_TLS(malloc_nesting) == 1) {
> > > -
> > > tracepoint(ust_libc, free, ptr); + tracepoint(ust_libc, free, ptr,
> > > __builtin_return_address(0) ); } if (cur_alloc.free == NULL) { @@ -308,7
> > > +308,7 @@ } retval = cur_alloc.calloc(nmemb, size); if
> > > (URCU_TLS(malloc_nesting) == 1) { - tracepoint(ust_libc, calloc, nmemb,
> > > size, retval); + tracepoint(ust_libc, calloc, nmemb, size, retval,
> > > __builtin_return_address(0) ); } URCU_TLS(malloc_nesting)--; return
> > > retval;
> > > @@ -360,7 +360,7 @@ retval = cur_alloc.realloc(ptr, size); end: if
> > > (URCU_TLS(malloc_nesting) == 1) { - tracepoint(ust_libc, realloc, ptr,
> > > size,
> > > retval); + tracepoint(ust_libc, realloc, ptr, size, retval,
> > > __builtin_return_address(0) ); } URCU_TLS(malloc_nesting)--; return
> > > retval;
> > > @@ -380,7 +380,7 @@ } retval = cur_alloc.memalign(alignment, size); if
> > > (URCU_TLS(malloc_nesting) == 1) { - tracepoint(ust_libc, memalign,
> > > alignment, size, retval); + tracepoint(ust_libc, memalign, alignment,
> > > size,
> > > retval, __builtin_return_address(0) ); } URCU_TLS(malloc_nesting)--;
> > > return
> > > retval; @@ -401,7 +401,7 @@ retval = cur_alloc.posix_memalign(memptr,
> > > alignment, size); if (URCU_TLS(malloc_nesting) == 1) {
> > > tracepoint(ust_libc,
> > > posix_memalign, *memptr, alignment, size, - retval); + retval,
> > > __builtin_return_address(0) ); } URCU_TLS(malloc_nesting)--; return
> > > retval;
> > > diff -Nurd b/liblttng-ust-libc-wrapper/ust_libc.h
> > > c/liblttng-ust-libc-wrapper/ust_libc.h ---
> > > b/liblttng-ust-libc-wrapper/ust_libc.h 2015-01-06 17:14:34.000000000
> > > +0100
> > > +++ c/liblttng-ust-libc-wrapper/ust_libc.h 2015-01-06 17:16:40.811145106
> > > +0100 @@ -33,54 +33,60 @@ #include <lttng/tracepoint.h>
> > > TRACEPOINT_EVENT(ust_libc, malloc, - TP_ARGS(size_t, size, void *, ptr),
> > > +
> > > TP_ARGS(size_t, size, void *, ptr, void *, ra), TP_FIELDS(
> > > ctf_integer(size_t, size, size) ctf_integer_hex(void *, ptr, ptr) +
> > > ctf_integer_hex(void *, ra, ra) ) ) TRACEPOINT_EVENT(ust_libc, free, -
> > > TP_ARGS(void *, ptr), + TP_ARGS(void *, ptr, void *, ra), TP_FIELDS(
> > > ctf_integer_hex(void *, ptr, ptr) + ctf_integer_hex(void *, ra, ra) ) )
> > > TRACEPOINT_EVENT(ust_libc, calloc, - TP_ARGS(size_t, nmemb, size_t, size,
> > > void *, ptr), + TP_ARGS(size_t, nmemb, size_t, size, void *, ptr, void *,
> > > ra), TP_FIELDS( ctf_integer(size_t, nmemb, nmemb) ctf_integer(size_t,
> > > size,
> > > size) ctf_integer_hex(void *, ptr, ptr) + ctf_integer_hex(void *, ra, ra)
> > > )
> > > ) TRACEPOINT_EVENT(ust_libc, realloc, - TP_ARGS(void *, in_ptr, size_t,
> > > size, void *, ptr), + TP_ARGS(void *, in_ptr, size_t, size, void *, ptr,
> > > void *, ra), TP_FIELDS( ctf_integer_hex(void *, in_ptr, in_ptr)
> > > ctf_integer(size_t, size, size) ctf_integer_hex(void *, ptr, ptr) +
> > > ctf_integer_hex(void *, ra, ra) ) ) TRACEPOINT_EVENT(ust_libc, memalign,
> > > -
> > > TP_ARGS(size_t, alignment, size_t, size, void *, ptr), + TP_ARGS(size_t,
> > > alignment, size_t, size, void *, ptr, void *, ra), TP_FIELDS(
> > > ctf_integer(size_t, alignment, alignment) ctf_integer(size_t, size, size)
> > > ctf_integer_hex(void *, ptr, ptr) + ctf_integer_hex(void *, ra, ra) ) )
> > > TRACEPOINT_EVENT(ust_libc, posix_memalign, - TP_ARGS(void *, out_ptr,
> > > size_t, alignment, size_t, size, int, result), + TP_ARGS(void *, out_ptr,
> > > size_t, alignment, size_t, size, int, result, void *, ra), TP_FIELDS(
> > > ctf_integer_hex(void *, out_ptr, out_ptr) ctf_integer(size_t, alignment,
> > > alignment) ctf_integer(size_t, size, size) ctf_integer(int, result,
> > > result)
> > > + ctf_integer_hex(void *, ra, ra) ) ) Best regards,
> > 
> 
> > > 
> > 
> 

> > > Olivier Delbeke Senior Software Engineer Olivier.Delbeke@awtce.be / T.
> > > +32
> > > 2
> > > 389 25 53 AWTC Europe S.A. - Avenue de l’Industrie, 19 - 1420
> > > Braine-l’Alleud - Belgium - www.aweurope.eu - www.aisin-aw.co.jp VAT : BE
> > > 0474.474.114 - RPM Nivelles This mail, and any attachments thereto, is
> > > intended only for use by the addressee(s) named herein and may contain
> > > legally privileged and/or confidential information. If you are not the
> > > intended recipient, please note that any review, dissemination,
> > > disclosure,
> > > alteration, printing, copying or transmission of this mail and/or any
> > > file
> > > transmitted with it, is strictly prohibited and may be unlawful. If you
> > > have
> > > received this mail by mistake, please immediately notify the sender as
> > > well
> > > as our mail administrator at postmaster@aweurope.be , and permanently
> > > destroy the original as well as any copy thereof.
> > > _______________________________________________ lttng-dev mailing list
> > > lttng-dev@lists.lttng.org
> > > http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
> > 
> 

> > > --
> > 
> 
> > > Mathieu Desnoyers
> > 
> 
> > > EfficiOS Inc.
> > 
> 
> > > http://www.efficios.com
> > 
> 
> > > (See attached file: 1E482660.jpg) (See attached file: ecblank.gif)
> > 
> 
> > > This mail, and any attachments thereto, is intended only for use by the
> > > addressee(s) named herein and may contain legally privileged and/or
> > > confidential information. If you are not the intended recipient, please
> > > note
> > > that any review, dissemination, disclosure, alteration, printing, copying
> > > or
> > > transmission of this mail and/or any file transmitted with it, is
> > > strictly
> > > prohibited and may be unlawful. If you have received this mail by
> > > mistake,
> > > please immediately notify the sender as well as our mail administrator at
> > > postmaster@aweurope.be , and permanently destroy the original as well as
> > > any
> > > copy thereof.
> > 
> 
> > --
> 
> > Mathieu Desnoyers
> 
> > EfficiOS Inc.
> 
> > http://www.efficios.com
> 

> > _______________________________________________
> 
> > lttng-dev mailing list
> 
> > lttng-dev@lists.lttng.org
> 
> > http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
> 

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

[-- Attachment #1.2.1: Type: text/html, Size: 20199 bytes --]

[-- Attachment #1.2.2: 1D220451.jpg --]
[-- Type: image/jpeg, Size: 9458 bytes --]

[-- Attachment #1.2.3: ecblank.gif --]
[-- Type: image/gif, Size: 45 bytes --]

[-- Attachment #1.2.4: graycol.gif --]
[-- Type: image/gif, Size: 105 bytes --]

[-- Attachment #2: Type: text/plain, Size: 155 bytes --]

_______________________________________________
lttng-dev mailing list
lttng-dev@lists.lttng.org
http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Addition of the return address toliblttng-ust-libc-wrapper
       [not found]         ` <1680663293.9819.1421694937650.JavaMail.zimbra@efficios.com>
@ 2015-01-19 19:28           ` Olivier Delbeke
  0 siblings, 0 replies; 9+ messages in thread
From: Olivier Delbeke @ 2015-01-19 19:28 UTC (permalink / raw)
  To: Mathieu Desnoyers; +Cc: lttng-dev


[-- Attachment #1.1.1: Type: text/plain, Size: 10977 bytes --]

Hi Mathieu,

Great ! Thank you !

Olivier

On Mon, Jan 19, 2015 at 8:15 PM, Mathieu Desnoyers <
mathieu.desnoyers@efficios.com> wrote:

> ------------------------------
>
> *From: *"Olivier Delbeke" <olivier.delbeke@gmail.com>
> *To: *"Mathieu Desnoyers" <mathieu.desnoyers@efficios.com>
> *Cc: *"lttng-dev" <lttng-dev@lists.lttng.org>
> *Sent: *Monday, January 19, 2015 12:19:41 PM
> *Subject: *Re: [lttng-dev] Addition of the return address
> toliblttng-ust-libc-wrapper
>
> Hi Mathieu,
>
> Yes, feel free to add my Signed-off-by tag to the patch header. I would
> just ask you to use my gmail address.
>
>
> OK, now merged into master, thanks!
>
> Mathieu
>
>
> Have a nice evening,
>
> Best regards,
> Olivier
>
> On Mon, Jan 19, 2015 at 5:48 PM, Mathieu Desnoyers <
> mathieu.desnoyers@efficios.com> wrote:
>
>> ------------------------------
>>
>> *From: *"Olivier Delbeke" <Olivier.Delbeke@awtce.be>
>> *To: *"Mathieu Desnoyers" <mathieu.desnoyers@efficios.com>
>> *Sent: *Monday, January 19, 2015 2:03:07 AM
>> *Subject: *Re: [lttng-dev] Addition of the return address
>> toliblttng-ust-libc-wrapper
>>
>> Hi Mathieu,
>>
>> Here is the patch you asked me : *(See attached file:
>> lttng-return-address.patch)*
>>
>> First , I named the variable for return address "ra", then changed it to
>> "caller". Of course, you're free to change it (to make it more clear or
>> more in line with the rest of your code).
>>
>>
>> Great!
>>
>> Can I add your Signed-off-by tag to the patch header ?
>>
>> Thanks,
>>
>> Mathieu
>>
>>
>> Best regards,
>>
>>
>>    *Olivier Delbeke **Senior Software Engineer*
>>    Olivier.Delbeke@awtce.be / T. +32 2 389 25 53
>>    ------------------------------
>>     *AWTC Europe S.A. *- Avenue de l’Industrie, 19 - 1420
>>    Braine-l’Alleud - Belgium - www.aweurope.eu - www.aisin-aw.co.jp
>>    VAT : BE 0474.474.114 - RPM Nivelles
>>
>>
>>
>> [image: Inactive hide details for Mathieu Desnoyers ---01/16/2015
>> 09:41:08 PM---Mathieu Desnoyers <mathieu.desnoyers@efficios.com>]Mathieu
>> Desnoyers ---01/16/2015 09:41:08 PM---Mathieu Desnoyers <
>> mathieu.desnoyers@efficios.com>
>>
>>
>>    *Mathieu Desnoyers <mathieu.desnoyers@efficios.com
>>    <mathieu.desnoyers@efficios.com>>*
>>
>>    01/16/2015 09:41 PM
>>
>>
>> To
>>
>>
>>    Olivier Delbeke <Olivier.Delbeke@awtce.be>
>>
>>
>> cc
>>
>>
>>    lttng-dev@lists.lttng.org
>>
>>
>> Subject
>>
>>
>>    Re: [lttng-dev] Addition of the return address to
>>    liblttng-ust-libc-wrapper
>>
>>
>> ------------------------------
>>
>>    *From: *"Olivier Delbeke" <Olivier.Delbeke@awtce.be>
>> * To: *lttng-dev@lists.lttng.org
>> * Sent: *Tuesday, January 13, 2015 10:50:38 AM
>> * Subject: *[lttng-dev] Addition of the return address to
>>     liblttng-ust-libc-wrapper
>>
>>    Hi guys,
>>
>>
>>    I am using liblttng-ust-libc-wrapper to detect memory leaks in my
>>    applications.
>>    In order to identify not only the thread where the unfreed
>>    allocations are done, but also the calling function, I extended the
>>    liblttng-ust-libc-wrapper to log the "return address"
>>    (__builtin_return_address(0)) in addition to the parameters of malloc(). It
>>    solves my problem and does not affect Trace Compass.
>>    Was this the right thing to do ?
>>    If it is, then I guess that it might interest other people too.
>>
>> After further thought, I'm interested to merge this into UST master.
>>
>> Can you re-send either as an attachment, or as plain text without the
>> base64 encoding ?
>>
>> Thanks!
>>
>> Mathieu
>>
>>
>>
>>    diff -Nurd b/liblttng-ust-libc-wrapper/lttng-ust-malloc.c
>>    c/liblttng-ust-libc-wrapper/lttng-ust-malloc.c
>>    --- b/liblttng-ust-libc-wrapper/lttng-ust-malloc.c 2015-01-06
>>    17:14:34.000000000 +0100
>>    +++ c/liblttng-ust-libc-wrapper/lttng-ust-malloc.c 2015-01-06
>>    17:16:40.811145106 +0100
>>    @@ -260,7 +260,7 @@
>>     }
>>     retval = cur_alloc.malloc(size);
>>     if (URCU_TLS(malloc_nesting) == 1) {
>>    - tracepoint(ust_libc, malloc, size, retval);
>>    + tracepoint(ust_libc, malloc, size, retval,
>>    __builtin_return_address(0) );
>>     }
>>     URCU_TLS(malloc_nesting)--;
>>     return retval;
>>    @@ -279,7 +279,7 @@
>>     }
>>
>>     if (URCU_TLS(malloc_nesting) == 1) {
>>    - tracepoint(ust_libc, free, ptr);
>>    + tracepoint(ust_libc, free, ptr, __builtin_return_address(0) );
>>     }
>>
>>     if (cur_alloc.free == NULL) {
>>    @@ -308,7 +308,7 @@
>>     }
>>     retval = cur_alloc.calloc(nmemb, size);
>>     if (URCU_TLS(malloc_nesting) == 1) {
>>    - tracepoint(ust_libc, calloc, nmemb, size, retval);
>>    + tracepoint(ust_libc, calloc, nmemb, size, retval,
>>    __builtin_return_address(0) );
>>     }
>>     URCU_TLS(malloc_nesting)--;
>>     return retval;
>>    @@ -360,7 +360,7 @@
>>     retval = cur_alloc.realloc(ptr, size);
>>    end:
>>     if (URCU_TLS(malloc_nesting) == 1) {
>>    - tracepoint(ust_libc, realloc, ptr, size, retval);
>>    + tracepoint(ust_libc, realloc, ptr, size, retval,
>>    __builtin_return_address(0) );
>>     }
>>     URCU_TLS(malloc_nesting)--;
>>     return retval;
>>    @@ -380,7 +380,7 @@
>>     }
>>     retval = cur_alloc.memalign(alignment, size);
>>     if (URCU_TLS(malloc_nesting) == 1) {
>>    - tracepoint(ust_libc, memalign, alignment, size, retval);
>>    + tracepoint(ust_libc, memalign, alignment, size, retval,
>>    __builtin_return_address(0) );
>>     }
>>     URCU_TLS(malloc_nesting)--;
>>     return retval;
>>    @@ -401,7 +401,7 @@
>>     retval = cur_alloc.posix_memalign(memptr, alignment, size);
>>     if (URCU_TLS(malloc_nesting) == 1) {
>>     tracepoint(ust_libc, posix_memalign, *memptr, alignment, size,
>>    - retval);
>>    + retval, __builtin_return_address(0) );
>>     }
>>     URCU_TLS(malloc_nesting)--;
>>     return retval;
>>    diff -Nurd b/liblttng-ust-libc-wrapper/ust_libc.h
>>    c/liblttng-ust-libc-wrapper/ust_libc.h
>>    --- b/liblttng-ust-libc-wrapper/ust_libc.h 2015-01-06
>>    17:14:34.000000000 +0100
>>    +++ c/liblttng-ust-libc-wrapper/ust_libc.h 2015-01-06
>>    17:16:40.811145106 +0100
>>    @@ -33,54 +33,60 @@
>>    #include <lttng/tracepoint.h>
>>
>>    TRACEPOINT_EVENT(ust_libc, malloc,
>>    - TP_ARGS(size_t, size, void *, ptr),
>>    + TP_ARGS(size_t, size, void *, ptr, void *, ra),
>>     TP_FIELDS(
>>     ctf_integer(size_t, size, size)
>>     ctf_integer_hex(void *, ptr, ptr)
>>    + ctf_integer_hex(void *, ra, ra)
>>     )
>>    )
>>
>>    TRACEPOINT_EVENT(ust_libc, free,
>>    - TP_ARGS(void *, ptr),
>>    + TP_ARGS(void *, ptr, void *, ra),
>>     TP_FIELDS(
>>     ctf_integer_hex(void *, ptr, ptr)
>>    + ctf_integer_hex(void *, ra, ra)
>>     )
>>    )
>>
>>    TRACEPOINT_EVENT(ust_libc, calloc,
>>    - TP_ARGS(size_t, nmemb, size_t, size, void *, ptr),
>>    + TP_ARGS(size_t, nmemb, size_t, size, void *, ptr, void *, ra),
>>     TP_FIELDS(
>>     ctf_integer(size_t, nmemb, nmemb)
>>     ctf_integer(size_t, size, size)
>>     ctf_integer_hex(void *, ptr, ptr)
>>    + ctf_integer_hex(void *, ra, ra)
>>     )
>>    )
>>
>>    TRACEPOINT_EVENT(ust_libc, realloc,
>>    - TP_ARGS(void *, in_ptr, size_t, size, void *, ptr),
>>    + TP_ARGS(void *, in_ptr, size_t, size, void *, ptr, void *, ra),
>>     TP_FIELDS(
>>     ctf_integer_hex(void *, in_ptr, in_ptr)
>>     ctf_integer(size_t, size, size)
>>     ctf_integer_hex(void *, ptr, ptr)
>>    + ctf_integer_hex(void *, ra, ra)
>>     )
>>    )
>>
>>    TRACEPOINT_EVENT(ust_libc, memalign,
>>    - TP_ARGS(size_t, alignment, size_t, size, void *, ptr),
>>    + TP_ARGS(size_t, alignment, size_t, size, void *, ptr, void *, ra),
>>     TP_FIELDS(
>>     ctf_integer(size_t, alignment, alignment)
>>     ctf_integer(size_t, size, size)
>>     ctf_integer_hex(void *, ptr, ptr)
>>    + ctf_integer_hex(void *, ra, ra)
>>     )
>>    )
>>
>>    TRACEPOINT_EVENT(ust_libc, posix_memalign,
>>    - TP_ARGS(void *, out_ptr, size_t, alignment, size_t, size, int,
>>    result),
>>    + TP_ARGS(void *, out_ptr, size_t, alignment, size_t, size, int,
>>    result, void *, ra),
>>     TP_FIELDS(
>>     ctf_integer_hex(void *, out_ptr, out_ptr)
>>     ctf_integer(size_t, alignment, alignment)
>>     ctf_integer(size_t, size, size)
>>     ctf_integer(int, result, result)
>>    + ctf_integer_hex(void *, ra, ra)
>>     )
>>    )
>>
>>    Best regards,
>>    *Olivier Delbeke **Senior Software Engineer*
>>       Olivier.Delbeke@awtce.be / T. +32 2 389 25 53
>>       ------------------------------
>>        *AWTC Europe S.A. *- Avenue de l’Industrie, 19 - 1420
>>       Braine-l’Alleud - Belgium - www.aweurope.eu - www.aisin-aw.co.jp
>>       VAT : BE 0474.474.114 - RPM Nivelles
>>
>>    This mail, and any attachments thereto, is intended only for use by
>>    the addressee(s) named herein and may contain legally privileged and/or
>>    confidential information. If you are not the intended recipient, please
>>    note that any review, dissemination, disclosure, alteration, printing,
>>    copying or transmission of this mail and/or any file transmitted with it,
>>    is strictly prohibited and may be unlawful. If you have received this mail
>>    by mistake, please immediately notify the sender as well as our mail
>>    administrator at postmaster@aweurope.be, and permanently destroy the
>>    original as well as any copy thereof.
>>    _______________________________________________
>>    lttng-dev mailing list
>>    lttng-dev@lists.lttng.org
>>    http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
>>
>>
>>
>>
>> --
>> Mathieu Desnoyers
>> EfficiOS Inc.
>> http://www.efficios.com
>> *(See attached file: 1E482660.jpg)**(See attached file: ecblank.gif)*
>> This mail, and any attachments thereto, is intended only for use by the
>> addressee(s) named herein and may contain legally privileged and/or
>> confidential information. If you are not the intended recipient, please
>> note that any review, dissemination, disclosure, alteration, printing,
>> copying or transmission of this mail and/or any file transmitted with it,
>> is strictly prohibited and may be unlawful. If you have received this mail
>> by mistake, please immediately notify the sender as well as our mail
>> administrator at postmaster@aweurope.be, and permanently destroy the
>> original as well as any copy thereof.
>>
>>
>>
>>
>> --
>> Mathieu Desnoyers
>> EfficiOS Inc.
>> http://www.efficios.com
>>
>> _______________________________________________
>> lttng-dev mailing list
>> lttng-dev@lists.lttng.org
>> http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
>>
>>
>
>
>
> --
> Mathieu Desnoyers
> EfficiOS Inc.
> http://www.efficios.com
>

[-- Attachment #1.1.2: Type: text/html, Size: 20710 bytes --]

[-- Attachment #1.2: ecblank.gif --]
[-- Type: image/gif, Size: 45 bytes --]

[-- Attachment #1.3: graycol.gif --]
[-- Type: image/gif, Size: 105 bytes --]

[-- Attachment #1.4: 1D220451.jpg --]
[-- Type: image/jpeg, Size: 9458 bytes --]

[-- Attachment #2: Type: text/plain, Size: 155 bytes --]

_______________________________________________
lttng-dev mailing list
lttng-dev@lists.lttng.org
http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2015-01-19 19:29 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <OF7097A1B1.090ABAC2-ONC1257DCC.0053FE7C-C1257DCC.00570880@LocalDomain>
2015-01-16 20:13 ` Addition of the return address to liblttng-ust-libc-wrapper Mathieu Desnoyers
     [not found] ` <1127206322.43789.1421439222351.JavaMail.zimbra@efficios.com>
2015-01-16 20:32   ` Simon Marchi
     [not found]   ` <CAFXXi0nzOHHPx+h5vUs-pCe1-zT0T=6jNq6L+EJN6z0Nh-_NMA@mail.gmail.com>
2015-01-16 20:37     ` Mathieu Desnoyers
2015-01-16 20:41 ` Mathieu Desnoyers
     [not found] ` <54250547.44000.1421440866572.JavaMail.zimbra@efficios.com>
2015-01-16 20:57   ` Olivier Delbeke
     [not found]   ` <OF208CF361.F3A478C1-ONC1257DD2.00266C5D-C1257DD2.0026BC70@LocalDomain>
2015-01-19 16:48     ` Addition of the return address toliblttng-ust-libc-wrapper Mathieu Desnoyers
     [not found]     ` <1097959140.8621.1421686124960.JavaMail.zimbra@efficios.com>
2015-01-19 17:19       ` Olivier Delbeke
     [not found]       ` <CAO6pHzgetc1HSYvmOzh5u7oMt5LANv1Ttb=qxTdqchspXaGhdg@mail.gmail.com>
2015-01-19 19:15         ` Mathieu Desnoyers
     [not found]         ` <1680663293.9819.1421694937650.JavaMail.zimbra@efficios.com>
2015-01-19 19:28           ` Olivier Delbeke

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.