I don't work on OSX (or use lldb-mi), so it was mostly just a passing comment.  If there are no other objections I won't block it either.<br><div class="gmail_quote">On Tue, Dec 2, 2014 at 9:27 AM Ilia K <<a href="mailto:ki.stfu@gmail.com">ki.stfu@gmail.com</a>> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi Zachary,<div><br></div><div>We can save file descriptor once and don't use fileno() every time we need it but it may doesn't work and it doesn't resolve design flaw. Redesign the lldb-mi is a big task which can take a long time.</div><div><br></div><div>Currently problem is that OSX's implementation of libc hangs on it in mutex_lock() and this patch, as I understood, avoids this behaviour.</div><div>I think the 'select' patch should be committed as is.<br></div><div><br></div><div>Thanks,</div><div>Ilia</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Dec 2, 2014 at 7:33 PM, Zachary Turner <span dir="ltr"><<a href="mailto:zturner@google.com" target="_blank">zturner@google.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I kind of feel like calling fgets from one thread and fileno from another thread indicates a design flaw.  Is there any way to fix the design problem instead of this particular bug?<br><div class="gmail_quote"><div><div>On Tue, Dec 2, 2014 at 1:24 AM Илья К <<a href="mailto:ki.stfu@gmail.com" target="_blank">ki.stfu@gmail.com</a>> wrote:<br></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div><div dir="ltr">Hello Abid,<div><br></div><div>>RE: <span style="color:rgb(0,0,0);white-space:pre-wrap">But I am still wondering why you need extra "return" in case of -exec-run. It seems to work ok on Linux. Where is it blocking in OSX?</span></div><div>I had the same bug on OSX but "select" patch helped me (btw, thank Dawn for that).</div><div>As I understood the problem occurs when trying to get filno(stdin), when another thread sleeping in fgets(stdin). The filno() starts sleeping too because stdin's mutex already locked by fgets(). Perhaps it related to OSX's libc implementation and therefore it don't reproduced on Linux.</div><div><br></div><div>I wrote test, which doesn't works properly without WITH_SELECT_FIX:<br></div><div><code><br></div><div><div>#include <cstdio></div><div>#include <thread></div><div>#include <unistd.h></div><div>#include <sys/select.h></div><div><br></div><div>//#define WITH_SELECT_FIX</div><div><br></div><div>void first_func()</div><div>{</div><div>    char buf[1024];</div><div>#ifdef WITH_SELECT_FIX</div><div>    fd_set inset;</div><div>    FD_ZERO(&inset);</div><div>    FD_SET(0, &inset);</div><div>    select(1, &inset, NULL, NULL, NULL);</div><div>#endif</div><div>    char *line = fgets(buf, sizeof buf, stdin);</div><div>    printf("you entered: %s\n", buf);</div><div>}</div><div><br></div><div>void second_func()</div><div>{</div><div>    usleep(100);</div><div>    printf("fileno: ");</div><div>    printf("%d\n", fileno(stdin));</div><div>}</div><div><br></div><div>int main()</div><div>{</div><div>    std::thread first(first_func);</div><div>    std::thread second(second_func);</div><div>    printf("start test\n");<br></div><div>    first.join();<br></div><div>    second.join();</div><div>    printf("exiting\n");<br></div><div>    return 0;<br></div><div>}</div></div><div></code> </div><div><div><div><br></div><div>>RE: <span style="color:rgb(0,0,0);white-space:pre-wrap">Btw, if the problem is only with gdb-exit then an extra check for it where we check for "quit" will work too.</span></div><div>As I said above, it doesn't solve a problem, it only fixes a certain case.</div><div><br></div></div><div>So I think you should accept the Dawn's "select" patch.</div><div><br></div><div>Thanks,</div><div>Ilia</div></div></div></div></div><span>
______________________________<u></u>_________________<br>
lldb-commits mailing list<br>
<a href="mailto:lldb-commits@cs.uiuc.edu" target="_blank">lldb-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits" target="_blank">http://lists.cs.uiuc.edu/<u></u>mailman/listinfo/lldb-commits</a><br>
</span></blockquote></div>
</blockquote></div><br></div>
</blockquote></div>