From 4446487d71c52a925c04acfcae44dec8a8d62e00 Mon Sep 17 00:00:00 2001 From: Pavel Labath Date: Wed, 27 May 2015 12:40:32 +0000 Subject: Improve LLDB prompt handling Summary: There is an issue in lldb where the command prompt can appear at the wrong time. The partial fix we have in for this is not working all the time and is introducing unnecessary delays. This change does: - Change Process:SyncIOHandler to use integer start id's for synchronization to avoid it being confused by quick start-stop cycles. I picked this up from a suggested patch by Greg to lldb-dev. - coordinates printing of asynchronous text with the iohandlers. This is also based on a (different) Greg's patch, but I have added stronger synchronization to it to avoid races. Together, these changes solve the prompt problem for me on linux (both with and without libedit). I think they should behave similarly on Mac and FreeBSD and I think they will not make matters worse for windows. Test Plan: Prompt comes out alright. All tests still pass on linux. Reviewers: clayborg, emaste, zturner Subscribers: lldb-commits Differential Revision: http://reviews.llvm.org/D9823 llvm-svn: 238313 --- lldb/source/Commands/CommandObjectThread.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'lldb/source/Commands/CommandObjectThread.cpp') diff --git a/lldb/source/Commands/CommandObjectThread.cpp b/lldb/source/Commands/CommandObjectThread.cpp index 78271f25c66c..8fb962948c04 100644 --- a/lldb/source/Commands/CommandObjectThread.cpp +++ b/lldb/source/Commands/CommandObjectThread.cpp @@ -675,6 +675,8 @@ protected: process->GetThreadList().SetSelectedThreadByID (thread->GetID()); + const uint32_t iohandler_id = process->GetIOHandlerID(); + StreamString stream; Error error; if (synchronous_execution) @@ -685,7 +687,7 @@ protected: // There is a race condition where this thread will return up the call stack to the main command handler // and show an (lldb) prompt before HandlePrivateEvent (from PrivateStateThread) has // a chance to call PushProcessIOHandler(). - process->SyncIOHandler(2000); + process->SyncIOHandler(iohandler_id, 2000); if (synchronous_execution) { -- cgit v1.2.3