[lldb-dev] Process::SyncIOHandler(), everyone please try out the following patch

Greg Clayton gclayton at apple.com
Tue Apr 7 10:58:56 PDT 2015

Yes this m_iohandler_sync is essentially implementing a "sleep(2)" as the overall fix. It is coded in a much more complex way, but that is the way it works out on MacOSX at least.

I will take look at this later today to come up with a real fix to hopefully fix this once and for all.

The issue seems to be we have 3 threads:
1 - main thread running command interpreter waiting for user input
2 - debugger event handling thread that handles all events (run/stop/stdio from process)
3 - process private event handling thread

I believe that the issue we are running into is we get a "stopped" on thread 2 and we grab stdio and also display the thread stop info (thread list and where we stopped) asynchronously while thread 1 is in the process of displaying the "(lldb) " prompt again. We really need any async text to be supplied to the IOHandler stack for display so that it can correctly coordinate the output. I believe right now thread 2 just prints stuff when it wants to and then asks the IOHandler to refresh the top IOHandler after it does the display, but I need to look at this again to make sure this is what is happening.


> On Apr 6, 2015, at 6:30 PM, Ed Maste <emaste at freebsd.org> wrote:
> On 6 April 2015 at 17:39, Greg Clayton <gclayton at apple.com> wrote:
>> So do you still have problems with the prompt coming out at the wrong time or getting interspersed on FreeBSD with top of tree? It is just made worse by this patch?
> Yes, I get the (lldb) prompt coming out at the wrong time (in relation
> to the source listing or target I/O) on top of tree. It's at best
> unchanged with the (one-liner) patch -- because it seems to vary with
> the overall system load it's hard to say for certain. But I get
> interspersed prompts on top of tree with or without the patch.
> The change that's been a reliable workaround for me is a usleep(100)
> at the end of Process:PrivateResume(). I'll see if that's still the
> case and also try the other patch you posted tomorrow.

More information about the lldb-dev mailing list