All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
To: Olivier Delbeke <Olivier.Delbeke@awtce.be>
Cc: lttng-dev <lttng-dev@lists.lttng.org>
Subject: Re: Addition of the return address toliblttng-ust-libc-wrapper
Date: Mon, 19 Jan 2015 16:48:44 +0000 (UTC)	[thread overview]
Message-ID: <1097959140.8621.1421686124960.JavaMail.zimbra__24889.5251811065$1421686245$gmane$org@efficios.com> (raw)
In-Reply-To: <OF208CF361.F3A478C1-ONC1257DD2.00266C5D-C1257DD2.0026BC70@LocalDomain>


[-- 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

  parent reply	other threads:[~2015-01-19 16:48 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [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     ` Mathieu Desnoyers [this message]
     [not found]     ` <1097959140.8621.1421686124960.JavaMail.zimbra@efficios.com>
2015-01-19 17:19       ` Addition of the return address toliblttng-ust-libc-wrapper 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

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='1097959140.8621.1421686124960.JavaMail.zimbra__24889.5251811065$1421686245$gmane$org@efficios.com' \
    --to=mathieu.desnoyers@efficios.com \
    --cc=Olivier.Delbeke@awtce.be \
    --cc=lttng-dev@lists.lttng.org \
    /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 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.