Page MenuHomePhabricator

spurious output to command line when launching a process on linux
ClosedPublic

Authored by sbest on Oct 6 2014, 2:18 PM.

Details

Reviewers
clayborg
tfiala
Summary

There is a problem when launching a process on linux where a bunch of spurious output (unwanted stop message and assembly language) is dumped to the tty. This is because of the initial stop that happens when the process is attached to. The linux launch function manually runs the stop event through HandlePrivateEvent() which broadcasts that stop as a public stop... triggering a stop message and the corresponding instructions where it stopped. During this cycle it also does an extra Push/Pop of an IO handler. My solution is 2 parts:

  1. When launching: on the initial stop, directly call SetPublicState() to set state to Stopped, instead letting it be done via broadcasting a public stop message
  1. Since there will no longer be public stop to pop an IO handler, we need to stop one from being pushed during the initial launch

There is a longer discussion of this on the [lldb-dev] list

Diff Detail

Event Timeline

sbest updated this revision to Diff 14472.Oct 6 2014, 2:18 PM
sbest retitled this revision from to spurious output to command line when launching a process on linux.
sbest updated this object.
sbest edited the test plan for this revision. (Show Details)
sbest added reviewers: tfiala, clayborg.
sbest added a subscriber: Unknown Object (MLST).
clayborg accepted this revision.Oct 6 2014, 3:08 PM
clayborg edited edge metadata.

Looks good as long as the test suite is happy.

This revision is now accepted and ready to land.Oct 6 2014, 3:08 PM
tfiala edited edge metadata.Oct 7 2014, 8:46 AM

Testing this over here now.

tfiala accepted this revision.Oct 7 2014, 9:13 AM
tfiala edited edge metadata.

Came back clean on Ubuntu 14.04 x86_64 with clang-3.5 (system clang)-built lldb.

tfiala closed this revision.Oct 7 2014, 9:16 AM
svn commit
Sending        source/Target/Process.cpp
Transmitting file data .
Committed revision 219213.

I made minor tweaks to the comments to match commenting style.

emaste added a subscriber: emaste.Oct 8 2014, 11:21 AM

Looks like this introduces a regression on FreeBSD
http://llvm.org/bugs/show_bug.cgi?id=21211

sbest added a comment.Oct 8 2014, 11:26 AM

I will look into this right now...

Oh, I did confirm that the test passes with this change reverted.

sbest added a comment.Oct 8 2014, 8:31 PM

I have done some digging into the failing test and isolated it to a simple C++ program. Basically the test is using the c++ api to lldb:

  1. Create an SBDebugger
  2. Load a simple inferior process, create an SBListener, and launch inferior with listener
  3. The test program expects to see the listener events Running Stopped

Prior to my this checkin, the events go:
Running
Stopped
Running
Stopped

After the checkin, the events go:
Launching
Running
Stopped
Running
Stopped

I'm still working on figuring out why the 'Launching' event is now showing up in the listener.