Page MenuHomePhabricator

Don't create unnecessary remote platforms

Authored by fjricci on Jun 23 2016, 9:54 AM.



When using 'platform select', re-use an existing platform
which matches the remote platform specs, rather than creating a new one.

Without this patch, repeating the following sequence of commands will generate a
large number of platforms which are unused (and inaccessible):
platform select remote-linux
platform connect <url>
platform select host
platform select remote-linux

Diff Detail

Event Timeline

fjricci updated this revision to Diff 61690.Jun 23 2016, 9:54 AM
fjricci retitled this revision from to Don't create unnecessary remote platforms.
fjricci updated this object.
fjricci added reviewers: clayborg, jingham, vharron.
fjricci added subscribers: sas, lldb-commits.
fjricci planned changes to this revision.EditedJun 23 2016, 11:04 AM

This will fail in the case where the remote-platform server dies, as lldb will not cleanup its data structures. I'll investigate how to make sure the platform is alive before selecting it.

clayborg accepted this revision.Jun 23 2016, 11:30 AM
clayborg edited edge metadata.

Make sure you keep a very close eye on all the buildbots with this one. I agree this change is good, but I seem to remember there were problems when this was done.

clayborg requested changes to this revision.Jun 23 2016, 11:31 AM
clayborg edited edge metadata.

Sorry missed your comments about when a platform dies. Also be sure to know that you might not have to connect to a platform for it to be useful. We have ios-simulator platforms that don't require connecting.

As I'm poking through the APIs, I found that platform_sp->IsConnected() will return true even if the remote server has been killed since connecting (at least on remote-linux with lldb-server in platform mode). Is this the expected behavior of that set of functions?

Although, given your comments about the ios platforms, IsConnected() doesn't seem like the right API to use anyway...

fjricci abandoned this revision.Jun 23 2016, 1:23 PM

I don't think that we can assume that the user always wants to re-use an existing platform, even of the same type. Probably the only way to resolve the problem this tries to fix would be to add a command to display all connected platforms, and an option to "platform select" to choose an existing platform to connect to. But that's outside the scope of this patch, and a bit of a design decision.

Platforms are funny because the "ios-simulator" platform doesn't need to be connected for anything since it exists and runs things locally. The platform is there to help us launch our processes so they run as simulator binaries, and also to help locate files and other things. Others like "remote-ios" will need to be connected in order to debug things since they might need to send files over and read files from the remote system for local caching.

ted added a subscriber: ted.Jun 23 2016, 3:40 PM

The Hexagon platform (currently in-house only) acts like the ios simulator platform, in that it doesn't connect - it fixes up the command line, then launches the Hexagon simulator (based on the debugserver launch code in the gdb-remote process plugin).