Don't have any comments on the substance of the patch, but could you change _MSC_VER to _WIN32?<br><br>I've been guilty of this myself, but unless we're implementing some kind of compiler workaround or compiler hack, usually _WIN32 is a better choice than _MSC_VER.<br><br><div class="gmail_quote">On Tue Nov 25 2014 at 4:14:10 PM <<a href="mailto:dawn@burble.org">dawn@burble.org</a>> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi guys,<br>
<br>
Please help me resolve this blocking issue with lldb-mi on OSX.  The patch sent<br>
in the original e-mail (and included below) solves the problem by enabling the<br>
ioctl code in CMICmnStreamStdinLinux::<u></u>InputAvailable.  Attached is an alternate<br>
patch which uses select, but requires additional code to handle -gdb-exit.<br>
Without either of these patches, lldb-mi hangs on OSX after -exec-run, and<br>
-gdb-exit doesn't terminate.<br>
<br>
Please apply one of these, or tell me how you would prefer to resolve this?<br>
<br>
Thanks,<br>
-Dawn<br>
<br>
On Fri, Nov 21, 2014 at 06:57:39PM -0800, <a href="mailto:dawn@burble.org" target="_blank">dawn@burble.org</a> wrote:<br>
> This patch fixes the initial hang when starting up lldb-mi in interpreter mode<br>
> on OSX.  Without this, an additional "return" is required in order for lldb-mi<br>
> to proceed after "-exec-run" and "-gdb-exit" is also not handled properly.<br>
><br>
> The patch enables code which was commented out.  Was there a reason for this?<br>
> If the code is not desired, would it be OK to enable it for OSX only?  Or would<br>
> you prefer a command-line option for this?  This code is definately needed on<br>
> OSX to get past the hang.  If OK as is, please commit?<br>
><br>
> Thanks,<br>
> -Dawn<br>
><br>
<br>
> Index: tools/lldb-mi/<u></u>MICmnStreamStdinLinux.cpp<br>
> ==============================<u></u>==============================<u></u>=======<br>
> --- tools/lldb-mi/<u></u>MICmnStreamStdinLinux.cpp   (revision 222598)<br>
> +++ tools/lldb-mi/<u></u>MICmnStreamStdinLinux.cpp   (working copy)<br>
> @@ -22,6 +22,7 @@<br>
>  // Third Party Headers:<br>
>  #if !defined(_MSC_VER)<br>
>  #include <sys/select.h><br>
> +#include <sys/ioctl.h><br>
>  #include <termios.h><br>
>  #endif              // !defined( _MSC_VER )<br>
>  #include <string.h> // For std::strerror()<br>
> @@ -153,30 +154,27 @@<br>
>  bool<br>
>  CMICmnStreamStdinLinux::<u></u>InputAvailable(bool &vwbAvail)<br>
>  {<br>
> -    /* AD: Not used ATM but could come in handy just in case we need to do<br>
> -           this, poll for input<br>
> +#if !defined(_MSC_VER)<br>
> +    // poll for input<br>
> +    static const int STDIN = 0;<br>
> +    static bool bInitialized = false;<br>
><br>
> -            static const int STDIN = 0;<br>
> -        static bool bInitialized = false;<br>
> +    if (!bInitialized)<br>
> +    {<br>
> +        // Use termios to turn off line buffering<br>
> +        ::termios term;<br>
> +        ::tcgetattr(STDIN, &term);<br>
> +        term.c_lflag &= ~ICANON;<br>
> +        ::tcsetattr(STDIN, TCSANOW, &term);<br>
> +        ::setbuf(stdin, NULL);<br>
> +        bInitialized = true;<br>
> +    }<br>
><br>
> -        if( !bInitialized )<br>
> -            {<br>
> -            // Use termios to turn off line buffering<br>
> -            ::termios term;<br>
> -            ::tcgetattr( STDIN, &term );<br>
> -            ::term.c_lflag &= ~ICANON;<br>
> -            ::tcsetattr( STDIN, TCSANOW, &term );<br>
> -            ::setbuf( stdin, NULL );<br>
> -            bInitialized = true;<br>
> -        }<br>
> +    int nBytesWaiting;<br>
> +    ::ioctl(STDIN, FIONREAD, &nBytesWaiting);<br>
> +    vwbAvail = (nBytesWaiting > 0);<br>
> +#endif // !defined(_MSC_VER)<br>
><br>
> -        int nBytesWaiting;<br>
> -        ::ioctl( STDIN, FIONREAD, &nBytesWaiting );<br>
> -        vwbAvail = (nBytesWaiting > 0);<br>
> -<br>
> -            return MIstatus::success;<br>
> -    */<br>
> -<br>
>      return MIstatus::success;<br>
>  }<br>
><br>
<br>
> ______________________________<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>
<br>
______________________________<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>
</blockquote></div>