<div dir="ltr"><div>Thanks for the reply. Here is a link to the repo <a href="https://github.com/ShehabElsayed/LTTng_debugging.git">https://github.com/ShehabElsayed/LTTng_debugging.git</a><br><br></div>It contains the LTTng source code I am using and one of the benchmarks that is causing problems.<br></div><div class="gmail_extra"><br clear="all"><div><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><font color="#888888">Shehab Y. Elsayed, MSc.<br>
PhD Student<br>The Edwards S. Rogers Sr. Dept. of Electrical and Computer Engineering<br>University of Toronto </font><font color="#888888"><a value="+20124498360"><span dir="ltr"></span></a><br>
E-mail: <a href="https://webmail.rice.edu/imp/message.php?mailbox=INBOX&index=11#" target="_blank">shehabyomn@gmail.com</a></font></div></div></div>
<br><div class="gmail_quote">On Tue, May 1, 2018 at 10:39 AM, Jonathan Rajotte-Julien <span dir="ltr"><<a href="mailto:jonathan.rajotte-julien@efficios.com" target="_blank">jonathan.rajotte-julien@efficios.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Shehab,<br>
<br>
Please provide a link to a lttng-ust git tree or an actual patch (git format-patch).<br>
This will help any person who might be interested in helping you including<br>
myself.<br>
<br>
Cheers<br>
<div><div class="h5"><br>
On Tue, May 01, 2018 at 09:31:52AM -0400, Shehab Elsayed wrote:<br>
> Hi,<br>
> <br>
> I am trying to create wrappers for pthreads conditional variables functions<br>
> (wait, signal and broadcast) to insert tracepoints. I followed the same<br>
> approach done for the mutex functions already provided with lttng, however<br>
> I am running into some problems. Mainly the applications seem to get stuck<br>
> when the conditional variable wrappers are enabled.<br>
> <br>
> Here is my implementation for the wrapper functions:<br>
> int pthread_cond_wait(pthread_<wbr>cond_t *condition, pthread_mutex_t<br>
> *mutex)<br>
> <br>
> {<br>
> <br>
> static int (*cond_wait)(pthread_cond_t *, pthread_mutex_t<br>
> *);<br>
> int retval;<br>
> <br>
> <br>
> <br>
> if (!cond_wait)<br>
> {<br>
> <br>
> cond_wait = dlsym(RTLD_NEXT, "pthread_cond_wait");<br>
> <br>
> if (!cond_wait)<br>
> {<br>
> <br>
> if (thread_in_trace)<br>
> {<br>
> <br>
> <br>
> abort();<br>
> <br>
> <br>
> }<br>
> <br>
> fprintf(stderr, "unable to initialize pthread wrapper<br>
> library.\n");<br>
> return EINVAL;<br>
> <br>
> <br>
> }<br>
> <br>
> <br>
> }<br>
> <br>
> if (thread_in_trace)<br>
> {<br>
> <br>
> return cond_wait(condition, mutex);<br>
> <br>
> <br>
> }<br>
> <br>
> <br>
> <br>
> thread_in_trace =<br>
> 1;<br>
> <br>
> tracepoint(lttng_ust_pthread, pthread_cond_wait_begin, condition,<br>
> mutex,<br>
> <br>
> LTTNG_UST_CALLER_IP());<br>
> <br>
> retval = cond_wait(condition, mutex);<br>
> <br>
> tracepoint(lttng_ust_pthread, pthread_cond_wait_end, condition,<br>
> mutex,<br>
> <br>
> LTTNG_UST_CALLER_IP());<br>
> <br>
> thread_in_trace =<br>
> 0;<br>
> <br>
> return retval;<br>
> <br>
> }<br>
> <br>
> <br>
> <br>
> int pthread_cond_signal(pthread_<wbr>cond_t<br>
> *condition)<br>
> <br>
> {<br>
> <br>
> static int (*cond_signal)(pthread_cond_t<br>
> *);<br>
> <br>
> int retval;<br>
> <br>
> <br>
> <br>
> if (!cond_signal)<br>
> {<br>
> <br>
> cond_signal = dlsym(RTLD_NEXT, "pthread_cond_signal");<br>
> <br>
> if (!cond_signal)<br>
> {<br>
> <br>
> if (thread_in_trace)<br>
> {<br>
> <br>
> <br>
> abort();<br>
> <br>
> <br>
> }<br>
> <br>
> fprintf(stderr, "unable to initialize pthread wrapper<br>
> library.\n");<br>
> return EINVAL;<br>
> <br>
> <br>
> }<br>
> <br>
> <br>
> }<br>
> <br>
> if (thread_in_trace)<br>
> {<br>
> <br>
> return cond_signal(condition);<br>
> <br>
> <br>
> }<br>
> <br>
> <br>
> <br>
> thread_in_trace =<br>
> 1;<br>
> <br>
> tracepoint(lttng_ust_pthread, pthread_cond_signal_begin,<br>
> condition,<br>
> LTTNG_UST_CALLER_IP());<br>
> <br>
> retval = cond_signal(condition);<br>
> <br>
> tracepoint(lttng_ust_pthread, pthread_cond_signal_end,<br>
> condition,<br>
> LTTNG_UST_CALLER_IP());<br>
> <br>
> thread_in_trace =<br>
> 0;<br>
> <br>
> return retval;<br>
> <br>
> }<br>
> <br>
> <br>
> <br>
> int pthread_cond_broadcast(<wbr>pthread_cond_t<br>
> *condition)<br>
> <br>
> {<br>
> <br>
> static int (*cond_broadcast)(pthread_<wbr>cond_t<br>
> *);<br>
> int retval;<br>
> <br>
> <br>
> <br>
> if (!cond_broadcast)<br>
> {<br>
> <br>
> cond_broadcast = dlsym(RTLD_NEXT, "pthread_cond_broadcast");<br>
> <br>
> if (!cond_broadcast)<br>
> {<br>
> <br>
> if (thread_in_trace)<br>
> {<br>
> <br>
> <br>
> abort();<br>
> <br>
> <br>
> }<br>
> <br>
> fprintf(stderr, "unable to initialize pthread wrapper<br>
> library.\n");<br>
> return EINVAL;<br>
> <br>
> <br>
> }<br>
> <br>
> <br>
> }<br>
> <br>
> if (thread_in_trace)<br>
> {<br>
> <br>
> return cond_broadcast(condition);<br>
> <br>
> <br>
> }<br>
> <br>
> <br>
> <br>
> thread_in_trace =<br>
> 1;<br>
> <br>
> tracepoint(lttng_ust_pthread, pthread_cond_broadcast_begin,<br>
> condition,<br>
> LTTNG_UST_CALLER_IP());<br>
> <br>
> retval = cond_broadcast(condition);<br>
> <br>
> tracepoint(lttng_ust_pthread, pthread_cond_broadcast_end,<br>
> condition,<br>
> LTTNG_UST_CALLER_IP());<br>
> <br>
> thread_in_trace =<br>
> 0;<br>
> <br>
> return retval;<br>
> <br>
> }<br>
> <br>
> Things I have tried:<br>
> 1- Comment out pthread_cond_wait function --> segmentation fault<br>
> 2- Comment out pthread_cond_signal and _broadcast --> stuck (I can see the<br>
> program is still running but nor forward progress is being made) compared<br>
> to the case when the wrappers are not preloaded.<br>
> 3- Comment out all tracepoint related code (basically the wrapper just call<br>
> the corresponding pthreads function) --> same results as points 1 and 2.<br>
> <br>
> Any idea what might be causing this or how I could debug this problem?<br>
> <br>
> Thank you very much in advance.<br>
> <br>
> Best Regards,<br>
> Shehab<br>
<br>
> int pthread_cond_wait(pthread_<wbr>cond_t *condition, pthread_mutex_t *mutex) <br>
> { <br>
> static int (*cond_wait)(pthread_cond_t *, pthread_mutex_t *); <br>
> int retval; <br>
> <br>
> if (!cond_wait) { <br>
> cond_wait = dlsym(RTLD_NEXT, "pthread_cond_wait"); <br>
> if (!cond_wait) { <br>
> if (thread_in_trace) { <br>
> abort(); <br>
> } <br>
> fprintf(stderr, "unable to initialize pthread wrapper library.\n"); <br>
> return EINVAL; <br>
> } <br>
> } <br>
> if (thread_in_trace) { <br>
> return cond_wait(condition, mutex); <br>
> } <br>
> <br>
> thread_in_trace = 1; <br>
> tracepoint(lttng_ust_pthread, pthread_cond_wait_begin, condition, mutex, <br>
> LTTNG_UST_CALLER_IP()); <br>
> retval = cond_wait(condition, mutex); <br>
> tracepoint(lttng_ust_pthread, pthread_cond_wait_end, condition, mutex, <br>
> LTTNG_UST_CALLER_IP()); <br>
> thread_in_trace = 0; <br>
> return retval; <br>
> } <br>
> <br>
> int pthread_cond_signal(pthread_<wbr>cond_t *condition) <br>
> { <br>
> static int (*cond_signal)(pthread_cond_t *); <br>
> int retval; <br>
> <br>
> if (!cond_signal) { <br>
> cond_signal = dlsym(RTLD_NEXT, "pthread_cond_signal"); <br>
> if (!cond_signal) { <br>
> if (thread_in_trace) { <br>
> abort(); <br>
> } <br>
> fprintf(stderr, "unable to initialize pthread wrapper library.\n"); <br>
> return EINVAL; <br>
> } <br>
> } <br>
> if (thread_in_trace) { <br>
> return cond_signal(condition); <br>
> } <br>
> <br>
> thread_in_trace = 1; <br>
> tracepoint(lttng_ust_pthread, pthread_cond_signal_begin, condition, <br>
> LTTNG_UST_CALLER_IP()); <br>
> retval = cond_signal(condition); <br>
> tracepoint(lttng_ust_pthread, pthread_cond_signal_end, condition, <br>
> LTTNG_UST_CALLER_IP()); <br>
> thread_in_trace = 0; <br>
> return retval; <br>
> } <br>
> <br>
> int pthread_cond_broadcast(<wbr>pthread_cond_t *condition) <br>
> { <br>
> static int (*cond_broadcast)(pthread_<wbr>cond_t *); <br>
> int retval; <br>
> <br>
> if (!cond_broadcast) { <br>
> cond_broadcast = dlsym(RTLD_NEXT, "pthread_cond_broadcast"); <br>
> if (!cond_broadcast) { <br>
> if (thread_in_trace) { <br>
> abort(); <br>
> } <br>
> fprintf(stderr, "unable to initialize pthread wrapper library.\n"); <br>
> return EINVAL; <br>
> } <br>
> } <br>
> if (thread_in_trace) { <br>
> return cond_broadcast(condition); <br>
> } <br>
> <br>
> thread_in_trace = 1; <br>
> tracepoint(lttng_ust_pthread, pthread_cond_broadcast_begin, condition, <br>
> LTTNG_UST_CALLER_IP()); <br>
> retval = cond_broadcast(condition); <br>
> tracepoint(lttng_ust_pthread, pthread_cond_broadcast_end, condition, <br>
> LTTNG_UST_CALLER_IP()); <br>
> thread_in_trace = 0; <br>
> return retval; <br>
> } <br>
<br>
</div></div>> ______________________________<wbr>_________________<br>
> lttng-dev mailing list<br>
> <a href="mailto:lttng-dev@lists.lttng.org">lttng-dev@lists.lttng.org</a><br>
> <a href="https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev" rel="noreferrer" target="_blank">https://lists.lttng.org/cgi-<wbr>bin/mailman/listinfo/lttng-dev</a><br>
<span class="HOEnZb"><font color="#888888"><br>
<br>
-- <br>
Jonathan Rajotte-Julien<br>
EfficiOS<br>
</font></span></blockquote></div><br></div>