<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@gmail.com><br><b>To: </b>"Mathieu Desnoyers" <mathieu.desnoyers@efficios.com><br><b>Cc: </b>"lttng-dev" <lttng-dev@lists.lttng.org><br><b>Sent: </b>Monday, January 19, 2015 12:19:41 PM<br><b>Subject: </b>Re: [lttng-dev] Addition of the return address toliblttng-ust-libc-wrapper<br><div><br></div><div dir="ltr"><div><div><div><div>Hi Mathieu,<br><div><br></div></div>Yes, feel free to add my Signed-off-by tag to the patch header. I would just ask you to use my gmail address. </div></div></div></div></blockquote><div><br></div><div>OK, now merged into master, 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 dir="ltr"><div><div><div><div><br></div></div>Have a nice evening,<br><div><br></div></div>Best regards,<br></div>Olivier<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Jan 19, 2015 at 5:48 PM, Mathieu Desnoyers <span dir="ltr"><<a href="mailto:mathieu.desnoyers@efficios.com" target="_blank">mathieu.desnoyers@efficios.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div style="font-family:times new roman,new york,times,serif;font-size:12pt;color:#000000"><hr><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" <<a href="mailto:Olivier.Delbeke@awtce.be" target="_blank">Olivier.Delbeke@awtce.be</a>><br><b>To: </b>"Mathieu Desnoyers" <<a href="mailto:mathieu.desnoyers@efficios.com" target="_blank">mathieu.desnoyers@efficios.com</a>><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">Hi Mathieu,</span><br></p><div><br></div><span style="font-family:sans-serif;font-size:small">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">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"><span class=""><div><br></div><span style="font-family:sans-serif;font-size:small">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"><b>Olivier Delbeke </b></span><span style="color:#000080;font-family:serif;font-size:medium"><i>Senior Software Engineer</i></span><span style="color:#565051;font-family:serif;font-size:medium"><br><a href="mailto:Olivier.Delbeke@awtce.be" target="_blank">Olivier.Delbeke@awtce.be</a> / T. <a href="tel:%2B32%202%20389%2025%2053" target="_blank">+32 2 389 25 53</a></span><hr style="color:#333399" size="2" noshade="" width="100%" align="left"><span style="font-family:serif;font-size:medium"> </span><span style="color:#000080;font-family:serif;font-size:xx-small"><b>AWTC Europe S.A. </b></span><span style="color:#565051;font-family:serif;font-size:xx-small">- Avenue de l’Industrie, 19 - 1420 Braine-l’Alleud - Belgium - <a href="http://www.aweurope.eu" target="_blank">www.aweurope.eu</a> - <a href="http://www.aisin-aw.co.jp" target="_blank">www.aisin-aw.co.jp</a><br>VAT : BE 0474.474.114 - RPM Nivelles</span><span style="font-family:serif;font-size:medium"> </span></ul></td></tr></tbody></table><br><div><br></div></span><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">Mathieu Desnoyers ---01/16/2015 09:41:08 PM---Mathieu Desnoyers <<a href="mailto:mathieu.desnoyers@efficios.com" target="_blank">mathieu.desnoyers@efficios.com</a>></span><br><div><br></div><table class="mceItemTable" width="100%" border="0" cellpadding="0" cellspacing="0"><tbody><tr valign="top"><td width="40%"><ul style="padding-left:72pt"><span style="font-family:sans-serif;font-size:xx-small"><b>Mathieu Desnoyers <<a href="mailto:mathieu.desnoyers@efficios.com" target="_blank">mathieu.desnoyers@efficios.com</a>></b></span><span style="font-family:sans-serif;font-size:xx-small"> </span><p><span style="font-family:sans-serif;font-size:xx-small">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">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">Olivier Delbeke <<a href="mailto:Olivier.Delbeke@awtce.be" target="_blank">Olivier.Delbeke@awtce.be</a>></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">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"><a href="mailto:lttng-dev@lists.lttng.org" target="_blank">lttng-dev@lists.lttng.org</a></span><br data-mce-bogus="1"></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">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">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><div><div class="h5"><br><hr size="2" width="100%" align="left"><ul style="padding-left:3pt"><span style="font-family:Arial;font-size:medium"><b>From: </b></span><span style="font-family:Arial;font-size:medium">"Olivier Delbeke" <<a href="mailto:Olivier.Delbeke@awtce.be" target="_blank">Olivier.Delbeke@awtce.be</a>></span><span style="font-family:Arial;font-size:medium"><b><br>To: </b></span><span style="font-family:Arial;font-size:medium"><a href="mailto:lttng-dev@lists.lttng.org" target="_blank">lttng-dev@lists.lttng.org</a></span><span style="font-family:Arial;font-size:medium"><b><br>Sent: </b></span><span style="font-family:Arial;font-size:medium">Tuesday, January 13, 2015 10:50:38 AM</span><span style="font-family:Arial;font-size:medium"><b><br>Subject: </b></span><span style="font-family:Arial;font-size:medium">[lttng-dev] Addition of the return address to liblttng-ust-libc-wrapper</span><br><p><span style="font-family:Arial;font-size:small">Hi guys,</span></p><p><br><span style="font-family:Arial;font-size:small">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">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">Can you re-send either as an attachment, or as plain text without the</span><br><span style="font-family:serif;font-size:medium">base64 encoding ?</span><br><div><br></div><span style="font-family:serif;font-size:medium">Thanks!</span><br><div><br></div><span style="font-family:serif;font-size:medium">Mathieu</span><br><div><br></div><ul style="padding-left:3pt"><br><span style="font-family:Arial;font-size:small">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"><b>Olivier Delbeke </b></span><span style="color:#000080;font-family:serif;font-size:medium"><i>Senior Software Engineer</i></span><span style="color:#565051;font-family:serif;font-size:medium"><br><a href="mailto:Olivier.Delbeke@awtce.be" target="_blank">Olivier.Delbeke@awtce.be</a> / T. <a href="tel:%2B32%202%20389%2025%2053" target="_blank">+32 2 389 25 53</a></span><hr size="2" noshade="" width="100%" align="left"><span style="font-family:serif;font-size:medium"> </span><span style="color:#000080;font-family:serif;font-size:xx-small"><b>AWTC Europe S.A. </b></span><span style="color:#565051;font-family:serif;font-size:xx-small">- Avenue de l’Industrie, 19 - 1420 Braine-l’Alleud - Belgium - </span><span style="color:#565051;font-family:serif;font-size:xx-small"><a href="http://www.aweurope.eu" target="_blank">www.aweurope.eu</a></span><span style="color:#565051;font-family:serif;font-size:xx-small"> - </span><span style="color:#565051;font-family:serif;font-size:xx-small"><a href="http://www.aisin-aw.co.jp" target="_blank">www.aisin-aw.co.jp</a></span><span style="color:#565051;font-family:serif;font-size:xx-small"><br>VAT : BE 0474.474.114 - RPM Nivelles</span><span style="font-family:serif;font-size:medium"> </span></ul></td></tr></tbody></table><span style="font-family:Arial;font-size:medium"><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 <a href="mailto:postmaster@aweurope.be" target="_blank">postmaster@aweurope.be</a>, and permanently destroy the original as well as any copy thereof. <br>_______________________________________________<br>lttng-dev mailing list<br><a href="mailto:lttng-dev@lists.lttng.org" target="_blank">lttng-dev@lists.lttng.org</a><br></span><span style="font-family:Arial;font-size:medium"><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></ul><span style="font-family:serif;font-size:medium"><br></span><br><div><br></div><span style="font-family:serif;font-size:medium">-- </span><br><span style="font-family:serif;font-size:medium">Mathieu Desnoyers<br>EfficiOS Inc.<br></span><span style="font-family:serif;font-size:medium"><a href="http://www.efficios.com" target="_blank">http://www.efficios.com</a></span><br></div></div><i>(See attached file: 1E482660.jpg)</i><i>(See attached file: ecblank.gif)</i><span class=""><br><span style="font-family: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 <a href="mailto:postmaster@aweurope.be" target="_blank">postmaster@aweurope.be</a>, and permanently destroy the original as well as any copy thereof.
</span></span></blockquote><div><br><div><br></div></div><span class=""><div><br></div><div>-- <br></div><div>Mathieu Desnoyers<br>EfficiOS Inc.<br><a href="http://www.efficios.com" target="_blank">http://www.efficios.com</a><br></div></span></div></div><br>_______________________________________________<br>
lttng-dev mailing list<br><a href="mailto:lttng-dev@lists.lttng.org" target="_blank">lttng-dev@lists.lttng.org</a><br><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><br><br></blockquote></div><br></div></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>