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

Ed Maste emaste at freebsd.org
Tue Apr 7 11:44:53 PDT 2015


>> 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.

I tried just now, and did not observe overlapping prompts with any of:

1-liner change + usleep(100) in PrivateResume
the larger change
larger change + usleep(100)

(But it seems the problem was made worse by system load, and so I'm
not completely confident that I've recreated the same conditions under
which I reproduced it on top of tree yesterday.)

On 7 April 2015 at 13:58, Greg Clayton <gclayton at apple.com> wrote:
> 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.

Right. When we last discussed this I added some specific logging[1]
where IOHandlers were pushed/popped (link below) that seems consistent
with this. http://lists.cs.uiuc.edu/pipermail/lldb-commits/Week-of-Mon-20140303/010621.html




More information about the lldb-dev mailing list