This is an archive of the discontinued LLVM Phabricator instance.

Fix the overlapped prompt seen when we stop after continue and step
ClosedPublic

Authored by mg11 on Aug 11 2014, 11:14 PM.

Details

Reviewers
tfiala
Summary

This patch was produced by Shawn Best to fix the issue where the (lldb) prompt is overwritten at times after lldb stops. The code has been tested a lot on linux 64 bit by Matthew Gardiner, and partially reviewed by Greg Clayton. It would be good to test it on OSX, and if ok, get it submitted.

Diff Detail

Event Timeline

mg11 updated this revision to Diff 12387.Aug 11 2014, 11:14 PM
mg11 retitled this revision from to Fix the overlapped prompt seen when we stop after continue and step.
mg11 updated this object.
mg11 edited the test plan for this revision. (Show Details)
mg11 added a reviewer: tfiala.
emaste added a subscriber: emaste.Aug 12 2014, 7:08 AM

I would have liked to reproduce the prompt race condition again and then verify this fix, but unfortunately am now unable to reproduce it on FreeBSD. In any case, LLDB still behaves as expected with this patch.

include/lldb/Target/Process.h
2667

It's the only purpose of this, yes?

2679

Do we anticipate different callers needing different timeouts? It seems to me the timeout ought to just be set in SyncIOHandler itself.

source/Commands/CommandObjectProcess.cpp
781

We probably don't need this comment at each SyncIOHandler() call, and in any case race condition no longer exists with the SyncIOHandler call there.

source/Target/Process.cpp
908

This log (the !timed_out case) will spam the log quite a bit, and seems unnecessary (or perhaps include it in verbose); the timed_out case above is definitely important though.

tfiala edited edge metadata.Aug 12 2014, 7:10 AM

Ok, thanks Matthew. I'll run it through OSX and my Linux. I'll get it in
if it looks good.

I thought I caught the tail end of the thread and that maybe you saw issues
with it in some process states (e.g. attaching or something like that?).
Was it not an issue, or was it just not worse than it was before?

(Ed - clearly the fact that we have a patch that might address this has spooked the behavior on FreeBSD so it no longer shows --- wish that worked the same for Linux from time to time! :-P)

Yep, the unfortunate nature of race conditions :(

In any case, in case I wasn't clear: I do believe this patch should go in, and it looks good to me other than the minor nits I commented on.

This issue is the one item that held me back from updating the copy of LLDB in the FreeBSD base system and so am very happy to see it fixed.

tfiala accepted this revision.Aug 12 2014, 7:43 AM
tfiala edited edge metadata.

Verified on:
Ubuntu 14.04 x86_64, clang-built lldb. All tests passed.
MacOSX 10.9.4, Xcode 6 Beta 5-built lldb. All tests passed.

This revision is now accepted and ready to land.Aug 12 2014, 7:43 AM
tfiala closed this revision.Aug 12 2014, 7:43 AM

svn commit
Sending include/lldb/Target/Process.h
Sending source/Commands/CommandObjectProcess.cpp
Sending source/Commands/CommandObjectThread.cpp
Sending source/Target/Process.cpp
Sending source/Target/Target.cpp
Transmitting file data .....
Committed revision 215446.

mg11 added a comment.Aug 12 2014, 11:27 PM

Replying to Ed's review.

I agree regarding the SyncIOHandler function signature. It should be parameterless, and the timeout value should be a value private to this routine. And yes, the "success" log statement is unnecessary noise.