This is an archive of the discontinued LLVM Phabricator instance.

Call remote platform GetSupportedArchAtIndex if connected to remote.
ClosedPublic

Authored by flackr on May 11 2015, 11:53 AM.

Details

Summary

Based on our IRC discussion I've updated PlatformLinux::GetSupportedArchitectureAtIndex to call the PlatformRemoteGdbServer::GetSupportedArchitectureAtIndex if connected remotely. This should return the correct thing for android (to fix those failing tests), and is also working for mac to linux.

Diff Detail

Repository
rL LLVM

Event Timeline

flackr updated this revision to Diff 25487.May 11 2015, 11:53 AM
flackr retitled this revision from to Call remote platform GetSupportedArchAtIndex if connected to remote..
flackr updated this object.
flackr edited the test plan for this revision. (Show Details)
flackr added a reviewer: tberghammer.
flackr set the repository for this revision to rL LLVM.
flackr added a subscriber: Unknown Object (MLST).
tberghammer edited edge metadata.May 12 2015, 3:03 AM

The concept looks good, but when PlatformLinux is the host and it runs on a non Linux OS then I think it shouldn't return any supported architecture. It was always broken but it would be a good point to address it as you change the full GetSupportedArchitectureAtIndex code.

source/Plugins/Platform/Linux/PlatformLinux.cpp
88–116

I feel that this class is a bit over-design for this size of problem but I am fine with it if you prefer this way.

flackr updated this revision to Diff 25580.May 12 2015, 5:29 AM
flackr edited edge metadata.

Removed class and restored to comparison to index, and ensured that the returned arch is linux, otherwise return no supported archs.

The concept looks good, but when PlatformLinux is the host and it runs on a non Linux OS then I think it shouldn't return any supported architecture. It was always broken but it would be a good point to address it as you change the full GetSupportedArchitectureAtIndex code.

Done, checks that the host arch is Linux before returning it, else we fall back to just returning false.

source/Plugins/Platform/Linux/PlatformLinux.cpp
88–116

Removed and restored to an index check.

tberghammer accepted this revision.May 12 2015, 5:43 AM
tberghammer edited edge metadata.

Looks good. Thanks for adding the check for Linux

This revision is now accepted and ready to land.May 12 2015, 5:43 AM
This revision was automatically updated to reflect the committed changes.
clayborg edited edge metadata.May 12 2015, 10:33 AM

Looks fine. You will want to merge this with the other PlatformLinux::GetSupportedArchitectureAtIndex() fixes where in the non-host mode we iterate through all supported architectures.

Looks fine. You will want to merge this with the other PlatformLinux::GetSupportedArchitectureAtIndex() fixes where in the non-host mode we iterate through all supported architectures.

I think we don't have to merge that as we can query the supported architectures from PlatformGdbRemote. It wouldn't make too much sense for me to advertise support for an architecture which isn't (necessarily) supported by the remote target.

ted edited edge metadata.May 12 2015, 11:28 AM

The problem with querying PlatformGDBRemote is it's only valid if you're connected to the remote platform. I'm trying to set the Platform when creating a target, so there is no connection yet.

Perhaps this:

if (m_remote_platform_sp)
  return m_remote_platform_sp->GetSupportedArchitectureAtIndex(idx, arch);

<choose from list>

In that case we have to add some logic to distinguish between PlatformLinux and PlatformAndroid. Currently PlatfromAndroid uses the same GetSupportedArchitectureAtIndex function as PlatfrormLinux what will make the selection (practically) un-deterministic.

Yes Ted, merge your other changes in after the:

if (m_remote_platform_sp)
    return m_remote_platform_sp->GetSupportedArchitectureAtIndex(idx, arch);

so that we can select the platform when not connected.