<html><body><div style="font-family: times new roman, new york, times, serif; font-size: 12pt; color: #000000"><hr id="zwchr"><blockquote style="border-left:2px solid #1010FF;margin-left:5px;padding-left:5px;color:#000;font-weight:normal;font-style:normal;text-decoration:none;font-family:Helvetica,Arial,sans-serif;font-size:12pt;"><b>From: </b>"Olivier Delbeke" <Olivier.Delbeke@awtce.be><br><b>To: </b>"Mathieu Desnoyers" <mathieu.desnoyers@efficios.com><br><b>Sent: </b>Monday, January 19, 2015 2:03:07 AM<br><b>Subject: </b>Re: [lttng-dev] Addition of the return address toliblttng-ust-libc-wrapper<br><div><br></div><p><span style="font-family: sans-serif; font-size: small;" data-mce-style="font-family: sans-serif; font-size: small;" face="sans-serif" size="2">Hi Mathieu,</span><br></p><div><br></div><span style="font-family: sans-serif; font-size: small;" data-mce-style="font-family: sans-serif; font-size: small;" face="sans-serif" size="2">Here is the patch you asked me : </span><i>(See attached file: lttng-return-address.patch)</i><br><div><br></div><span style="font-family: sans-serif; font-size: small;" data-mce-style="font-family: sans-serif; font-size: small;" face="sans-serif" size="2">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).</span></blockquote><div><br></div><div>Great!<br></div><div><br></div><div>Can I add your Signed-off-by tag to the patch header ?<br></div><div><br></div><div>Thanks,<br></div><div><br></div><div>Mathieu<br></div><div><br></div><blockquote style="border-left:2px solid #1010FF;margin-left:5px;padding-left:5px;color:#000;font-weight:normal;font-style:normal;text-decoration:none;font-family:Helvetica,Arial,sans-serif;font-size:12pt;"><div><br></div><span style="font-family: sans-serif; font-size: small;" data-mce-style="font-family: sans-serif; font-size: small;" face="sans-serif" size="2">Best regards,</span><br><div><br></div><table class="mceItemTable" border="0" cellpadding="0" cellspacing="0"><tbody><tr valign="top"><td rowspan="2" valign="middle" width="108"><div align="center"><img src="cid:2__=4EBBF741DFB5EACD8f9e8a93df93@aweurope.be" height="98" width="107" align="bottom"></div></td><td width="788"><img src="cid:3__=4EBBF741DFB5EACD8f9e8a93df93@aweurope.be" alt="" height="1" width="1" border="0"></td></tr><tr valign="top"><td valign="middle" width="788"><ul style="padding-left: 0pt"><span style="color: #000080; font-family: serif; font-size: medium;" data-mce-style="color: #000080; font-family: serif; font-size: medium;" face="serif" color="#000080" size="3"><b>Olivier Delbeke </b></span><span style="color: #000080; font-family: serif; font-size: medium;" data-mce-style="color: #000080; font-family: serif; font-size: medium;" face="serif" color="#000080" size="3"><i>Senior Software Engineer</i></span><span style="color: #565051; font-family: serif; font-size: medium;" data-mce-style="color: #565051; font-family: serif; font-size: medium;" face="serif" color="#565051" size="3"><br>Olivier.Delbeke@awtce.be / T. +32 2 389 25 53</span><hr style="color:#333399; " size="2" noshade="" width="100%" align="left"><span style="font-family: serif; font-size: medium;" data-mce-style="font-family: serif; font-size: medium;" face="serif" size="3"> </span><span style="color: #000080; font-family: serif; font-size: xx-small;" data-mce-style="color: #000080; font-family: serif; font-size: xx-small;" face="serif" color="#000080" size="1"><b>AWTC Europe S.A. </b></span><span style="color: #565051; font-family: serif; font-size: xx-small;" data-mce-style="color: #565051; font-family: serif; font-size: xx-small;" face="serif" color="#565051" size="1">- Avenue de l’Industrie, 19 - 1420 Braine-l’Alleud - Belgium - www.aweurope.eu - www.aisin-aw.co.jp<br>VAT : BE 0474.474.114 - RPM Nivelles</span><span style="font-family: serif; font-size: medium;" data-mce-style="font-family: serif; font-size: medium;" face="serif" size="3"> </span></ul></td></tr></tbody></table><br><div><br></div><img src="cid:4__=4EBBF741DFB5EACD8f9e8a93df93@aweurope.be" alt="Inactive hide details for Mathieu Desnoyers ---01/16/2015 09:41:08 PM---Mathieu Desnoyers <mathieu.desnoyers@efficios.com>" height="16" width="16" border="0"><span style="color: #424282; font-family: sans-serif; font-size: small;" data-mce-style="color: #424282; font-family: sans-serif; font-size: small;" face="sans-serif" color="#424282" size="2">Mathieu Desnoyers ---01/16/2015 09:41:08 PM---Mathieu Desnoyers <mathieu.desnoyers@efficios.com></span><br><div><br></div><table class="mceItemTable" width="100%" border="0" cellpadding="0" cellspacing="0"><tbody><tr valign="top"><td style="background-image:; background-repeat: no-repeat; " width="40%"><ul style="padding-left: 72pt"><span style="font-family: sans-serif; font-size: xx-small;" data-mce-style="font-family: sans-serif; font-size: xx-small;" face="sans-serif" size="1"><b>Mathieu Desnoyers <mathieu.desnoyers@efficios.com></b></span><span style="font-family: sans-serif; font-size: xx-small;" data-mce-style="font-family: sans-serif; font-size: xx-small;" face="sans-serif" size="1"> </span><p><span style="font-family: sans-serif; font-size: xx-small;" data-mce-style="font-family: sans-serif; font-size: xx-small;" face="sans-serif" size="1">01/16/2015 09:41 PM</span></p></ul></td><td width="60%"><table class="mceItemTable" width="100%" border="0" cellpadding="0" cellspacing="0"><tbody><tr valign="top"><td width="1%"><img src="cid:3__=4EBBF741DFB5EACD8f9e8a93df93@aweurope.be" alt="" height="1" width="58" border="0"><br><div align="right"><span style="font-family: sans-serif; font-size: xx-small;" data-mce-style="font-family: sans-serif; font-size: xx-small;" face="sans-serif" size="1">To</span></div></td><td width="100%"><img src="cid:3__=4EBBF741DFB5EACD8f9e8a93df93@aweurope.be" alt="" height="1" width="1" border="0"><br><ul style="padding-left: 7pt"><span style="font-family: sans-serif; font-size: xx-small;" data-mce-style="font-family: sans-serif; font-size: xx-small;" face="sans-serif" size="1">Olivier Delbeke <Olivier.Delbeke@awtce.be></span></ul></td></tr><tr valign="top"><td width="1%"><img src="cid:3__=4EBBF741DFB5EACD8f9e8a93df93@aweurope.be" alt="" height="1" width="58" border="0"><br><div align="right"><span style="font-family: sans-serif; font-size: xx-small;" data-mce-style="font-family: sans-serif; font-size: xx-small;" face="sans-serif" size="1">cc</span></div></td><td width="100%"><img src="cid:3__=4EBBF741DFB5EACD8f9e8a93df93@aweurope.be" alt="" height="1" width="1" border="0"><br><ul style="padding-left: 7pt"><span style="font-family: sans-serif; font-size: xx-small;" data-mce-style="font-family: sans-serif; font-size: xx-small;" face="sans-serif" size="1">lttng-dev@lists.lttng.org</span></ul></td></tr><tr valign="top"><td width="1%"><img src="cid:3__=4EBBF741DFB5EACD8f9e8a93df93@aweurope.be" alt="" height="1" width="58" border="0"><br><div align="right"><span style="font-family: sans-serif; font-size: xx-small;" data-mce-style="font-family: sans-serif; font-size: xx-small;" face="sans-serif" size="1">Subject</span></div></td><td width="100%"><img src="cid:3__=4EBBF741DFB5EACD8f9e8a93df93@aweurope.be" alt="" height="1" width="1" border="0"><br><ul style="padding-left: 7pt"><span style="font-family: sans-serif; font-size: xx-small;" data-mce-style="font-family: sans-serif; font-size: xx-small;" face="sans-serif" size="1">Re: [lttng-dev] Addition of the return address to liblttng-ust-libc-wrapper</span></ul></td></tr></tbody></table><table class="mceItemTable" border="0" cellpadding="0" cellspacing="0"><tbody><tr valign="top"><td width="58"><img src="cid:3__=4EBBF741DFB5EACD8f9e8a93df93@aweurope.be" alt="" height="1" width="1" border="0"></td><td width="336"><img src="cid:3__=4EBBF741DFB5EACD8f9e8a93df93@aweurope.be" alt="" height="1" width="1" border="0"></td></tr></tbody></table></td></tr></tbody></table><br><hr id="zwchr" size="2" width="100%" align="left"><ul style="padding-left: 3pt"><span style="font-family: Arial; font-size: medium;" data-mce-style="font-family: Arial; font-size: medium;" face="Arial" size="3"><b>From: </b></span><span style="font-family: Arial; font-size: medium;" data-mce-style="font-family: Arial; font-size: medium;" face="Arial" size="3">"Olivier Delbeke" <Olivier.Delbeke@awtce.be></span><span style="font-family: Arial; font-size: medium;" data-mce-style="font-family: Arial; font-size: medium;" face="Arial" size="3"><b><br>To: </b></span><span style="font-family: Arial; font-size: medium;" data-mce-style="font-family: Arial; font-size: medium;" face="Arial" size="3">lttng-dev@lists.lttng.org</span><span style="font-family: Arial; font-size: medium;" data-mce-style="font-family: Arial; font-size: medium;" face="Arial" size="3"><b><br>Sent: </b></span><span style="font-family: Arial; font-size: medium;" data-mce-style="font-family: Arial; font-size: medium;" face="Arial" size="3">Tuesday, January 13, 2015 10:50:38 AM</span><span style="font-family: Arial; font-size: medium;" data-mce-style="font-family: Arial; font-size: medium;" face="Arial" size="3"><b><br>Subject: </b></span><span style="font-family: Arial; font-size: medium;" data-mce-style="font-family: Arial; font-size: medium;" face="Arial" size="3">[lttng-dev] Addition of the return address to liblttng-ust-libc-wrapper</span><br><p><span style="font-family: Arial; font-size: small;" data-mce-style="font-family: Arial; font-size: small;" face="Arial" size="2">Hi guys,</span></p><p><br><span style="font-family: Arial; font-size: small;" data-mce-style="font-family: Arial; font-size: small;" face="Arial" size="2">I am using liblttng-ust-libc-wrapper to detect memory leaks in my applications. <br>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.<br>Was this the right thing to do ? <br>If it is, then I guess that it might interest other people too.</span></p></ul><span style="font-family: serif; font-size: medium;" data-mce-style="font-family: serif; font-size: medium;" face="serif" size="3">After further thought, I'm interested to merge this into UST master.</span><br><div><br></div><span style="font-family: serif; font-size: medium;" data-mce-style="font-family: serif; font-size: medium;" face="serif" size="3">Can you re-send either as an attachment, or as plain text without the</span><br><span style="font-family: serif; font-size: medium;" data-mce-style="font-family: serif; font-size: medium;" face="serif" size="3">base64 encoding ?</span><br><div><br></div><span style="font-family: serif; font-size: medium;" data-mce-style="font-family: serif; font-size: medium;" face="serif" size="3">Thanks!</span><br><div><br></div><span style="font-family: serif; font-size: medium;" data-mce-style="font-family: serif; font-size: medium;" face="serif" size="3">Mathieu</span><br><div><br></div><ul style="padding-left: 3pt"><br><span style="font-family: Arial; font-size: small;" data-mce-style="font-family: Arial; font-size: small;" face="Arial" size="2">diff -Nurd b/liblttng-ust-libc-wrapper/lttng-ust-malloc.c c/liblttng-ust-libc-wrapper/lttng-ust-malloc.c<br>--- b/liblttng-ust-libc-wrapper/lttng-ust-malloc.c 2015-01-06 17:14:34.000000000 +0100<br>+++ c/liblttng-ust-libc-wrapper/lttng-ust-malloc.c 2015-01-06 17:16:40.811145106 +0100<br>@@ -260,7 +260,7 @@<br> }<br> retval = cur_alloc.malloc(size);<br> if (URCU_TLS(malloc_nesting) == 1) {<br>- tracepoint(ust_libc, malloc, size, retval);<br>+ tracepoint(ust_libc, malloc, size, retval, __builtin_return_address(0) );<br> }<br> URCU_TLS(malloc_nesting)--;<br> return retval;<br>@@ -279,7 +279,7 @@<br> }<br> <br> if (URCU_TLS(malloc_nesting) == 1) {<br>- tracepoint(ust_libc, free, ptr);<br>+ tracepoint(ust_libc, free, ptr, __builtin_return_address(0) );<br> }<br> <br> if (cur_alloc.free == NULL) {<br>@@ -308,7 +308,7 @@<br> }<br> retval = cur_alloc.calloc(nmemb, size);<br> if (URCU_TLS(malloc_nesting) == 1) {<br>- tracepoint(ust_libc, calloc, nmemb, size, retval);<br>+ tracepoint(ust_libc, calloc, nmemb, size, retval, __builtin_return_address(0) );<br> }<br> URCU_TLS(malloc_nesting)--;<br> return retval;<br>@@ -360,7 +360,7 @@<br> retval = cur_alloc.realloc(ptr, size);<br> end:<br> if (URCU_TLS(malloc_nesting) == 1) {<br>- tracepoint(ust_libc, realloc, ptr, size, retval);<br>+ tracepoint(ust_libc, realloc, ptr, size, retval, __builtin_return_address(0) );<br> }<br> URCU_TLS(malloc_nesting)--;<br> return retval;<br>@@ -380,7 +380,7 @@<br> }<br> retval = cur_alloc.memalign(alignment, size);<br> if (URCU_TLS(malloc_nesting) == 1) {<br>- tracepoint(ust_libc, memalign, alignment, size, retval);<br>+ tracepoint(ust_libc, memalign, alignment, size, retval, __builtin_return_address(0) );<br> }<br> URCU_TLS(malloc_nesting)--;<br> return retval;<br>@@ -401,7 +401,7 @@<br> retval = cur_alloc.posix_memalign(memptr, alignment, size);<br> if (URCU_TLS(malloc_nesting) == 1) {<br> tracepoint(ust_libc, posix_memalign, *memptr, alignment, size,<br>- retval);<br>+ retval, __builtin_return_address(0) );<br> }<br> URCU_TLS(malloc_nesting)--;<br> return retval;<br>diff -Nurd b/liblttng-ust-libc-wrapper/ust_libc.h c/liblttng-ust-libc-wrapper/ust_libc.h<br>--- b/liblttng-ust-libc-wrapper/ust_libc.h 2015-01-06 17:14:34.000000000 +0100<br>+++ c/liblttng-ust-libc-wrapper/ust_libc.h 2015-01-06 17:16:40.811145106 +0100<br>@@ -33,54 +33,60 @@<br> #include <lttng/tracepoint.h><br> <br> TRACEPOINT_EVENT(ust_libc, malloc,<br>- TP_ARGS(size_t, size, void *, ptr),<br>+ TP_ARGS(size_t, size, void *, ptr, void *, ra),<br> TP_FIELDS(<br> ctf_integer(size_t, size, size)<br> ctf_integer_hex(void *, ptr, ptr)<br>+ ctf_integer_hex(void *, ra, ra)<br> )<br> )<br> <br> TRACEPOINT_EVENT(ust_libc, free,<br>- TP_ARGS(void *, ptr),<br>+ TP_ARGS(void *, ptr, void *, ra),<br> TP_FIELDS(<br> ctf_integer_hex(void *, ptr, ptr)<br>+ ctf_integer_hex(void *, ra, ra)<br> )<br> )<br> <br> TRACEPOINT_EVENT(ust_libc, calloc,<br>- TP_ARGS(size_t, nmemb, size_t, size, void *, ptr),<br>+ TP_ARGS(size_t, nmemb, size_t, size, void *, ptr, void *, ra),<br> TP_FIELDS(<br> ctf_integer(size_t, nmemb, nmemb)<br> ctf_integer(size_t, size, size)<br> ctf_integer_hex(void *, ptr, ptr)<br>+ ctf_integer_hex(void *, ra, ra)<br> )<br> )<br> <br> TRACEPOINT_EVENT(ust_libc, realloc,<br>- TP_ARGS(void *, in_ptr, size_t, size, void *, ptr),<br>+ TP_ARGS(void *, in_ptr, size_t, size, void *, ptr, void *, ra),<br> TP_FIELDS(<br> ctf_integer_hex(void *, in_ptr, in_ptr)<br> ctf_integer(size_t, size, size)<br> ctf_integer_hex(void *, ptr, ptr)<br>+ ctf_integer_hex(void *, ra, ra)<br> )<br> )<br> <br> TRACEPOINT_EVENT(ust_libc, memalign,<br>- TP_ARGS(size_t, alignment, size_t, size, void *, ptr),<br>+ TP_ARGS(size_t, alignment, size_t, size, void *, ptr, void *, ra),<br> TP_FIELDS(<br> ctf_integer(size_t, alignment, alignment)<br> ctf_integer(size_t, size, size)<br> ctf_integer_hex(void *, ptr, ptr)<br>+ ctf_integer_hex(void *, ra, ra)<br> )<br> )<br> <br> TRACEPOINT_EVENT(ust_libc, posix_memalign,<br>- TP_ARGS(void *, out_ptr, size_t, alignment, size_t, size, int, result),<br>+ TP_ARGS(void *, out_ptr, size_t, alignment, size_t, size, int, result, void *, ra),<br> TP_FIELDS(<br> ctf_integer_hex(void *, out_ptr, out_ptr)<br> ctf_integer(size_t, alignment, alignment)<br> ctf_integer(size_t, size, size)<br> ctf_integer(int, result, result)<br>+ ctf_integer_hex(void *, ra, ra)<br> )<br> )<br> <br>Best regards,</span><table class="mceItemTable" border="0" cellpadding="0" cellspacing="0"><tbody><tr valign="top"><td rowspan="2" valign="middle" width="108"><div align="center"><img src="cid:2__=4EBBF741DFB5EACD8f9e8a93df93@aweurope.be" height="98" width="107" align="bottom"></div></td><td width="788"><img src="cid:3__=4EBBF741DFB5EACD8f9e8a93df93@aweurope.be" height="1" width="1" align="bottom"></td></tr><tr valign="top"><td valign="middle" width="788"><ul style="padding-left: 36pt"><span style="color: #000080; font-family: serif; font-size: medium;" data-mce-style="color: #000080; font-family: serif; font-size: medium;" face="serif" color="#000080" size="3"><b>Olivier Delbeke </b></span><span style="color: #000080; font-family: serif; font-size: medium;" data-mce-style="color: #000080; font-family: serif; font-size: medium;" face="serif" color="#000080" size="3"><i>Senior Software Engineer</i></span><span style="color: #565051; font-family: serif; font-size: medium;" data-mce-style="color: #565051; font-family: serif; font-size: medium;" face="serif" color="#565051" size="3"><br>Olivier.Delbeke@awtce.be / T. +32 2 389 25 53</span><hr size="2" noshade="" width="100%" align="left"><span style="font-family: serif; font-size: medium;" data-mce-style="font-family: serif; font-size: medium;" face="serif" size="3"> </span><span style="color: #000080; font-family: serif; font-size: xx-small;" data-mce-style="color: #000080; font-family: serif; font-size: xx-small;" face="serif" color="#000080" size="1"><b>AWTC Europe S.A. </b></span><span style="color: #565051; font-family: serif; font-size: xx-small;" data-mce-style="color: #565051; font-family: serif; font-size: xx-small;" face="serif" color="#565051" size="1">- Avenue de l’Industrie, 19 - 1420 Braine-l’Alleud - Belgium - </span><span style="color: #565051; font-family: serif; font-size: xx-small;" data-mce-style="color: #565051; font-family: serif; font-size: xx-small;" face="serif" color="#565051" size="1">www.aweurope.eu</span><span style="color: #565051; font-family: serif; font-size: xx-small;" data-mce-style="color: #565051; font-family: serif; font-size: xx-small;" face="serif" color="#565051" size="1"> - </span><span style="color: #565051; font-family: serif; font-size: xx-small;" data-mce-style="color: #565051; font-family: serif; font-size: xx-small;" face="serif" color="#565051" size="1">www.aisin-aw.co.jp</span><span style="color: #565051; font-family: serif; font-size: xx-small;" data-mce-style="color: #565051; font-family: serif; font-size: xx-small;" face="serif" color="#565051" size="1"><br>VAT : BE 0474.474.114 - RPM Nivelles</span><span style="font-family: serif; font-size: medium;" data-mce-style="font-family: serif; font-size: medium;" face="serif" size="3"> </span></ul></td></tr></tbody></table><span style="font-family: Arial; font-size: medium;" data-mce-style="font-family: Arial; font-size: medium;" face="Arial" size="3"><br>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. <br>_______________________________________________<br>lttng-dev mailing list<br>lttng-dev@lists.lttng.org<br></span><span style="font-family: Arial; font-size: medium;" data-mce-style="font-family: Arial; font-size: medium;" face="Arial" size="3"><a href="http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev" target="_blank">http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev</a></span><br data-mce-bogus="1"></ul><span style="font-family: serif; font-size: medium;" data-mce-style="font-family: serif; font-size: medium;" face="serif" size="3"><br></span><br><div><br></div><span style="font-family: serif; font-size: medium;" data-mce-style="font-family: serif; font-size: medium;" face="serif" size="3">-- </span><br><span style="font-family: serif; font-size: medium;" data-mce-style="font-family: serif; font-size: medium;" face="serif" size="3">Mathieu Desnoyers<br>EfficiOS Inc.<br></span><span style="font-family: serif; font-size: medium;" data-mce-style="font-family: serif; font-size: medium;" face="serif" size="3"><a href="http://www.efficios.com" target="_blank">http://www.efficios.com</a></span><br><i>(See attached file: 1E482660.jpg)</i><i>(See attached file: ecblank.gif)</i><br><span style="font-family: sans-serif;" data-mce-style="font-family: sans-serif;" face="sans-serif">
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.
</span></blockquote><div><br><br></div><div><br></div><div>-- <br></div><div><span name="x"></span>Mathieu Desnoyers<br>EfficiOS Inc.<br>http://www.efficios.com<span name="x"></span><br></div></div></body></html>