[Lldb-commits] [PATCH] fix lldb-mi hang on OSX

dawn at burble.org dawn at burble.org
Tue Nov 25 21:15:13 PST 2014


The existing code used _MSC_VER.  I would rather a change like that be
in a separate commit, and fix all of them.

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



More information about the lldb-commits mailing list