This is an archive of the discontinued LLVM Phabricator instance.

[lldb/test] Use SBPlatform info for lldbplatformutil.getPlatform()
ClosedPublic

Authored by labath on Nov 21 2022, 6:44 AM.

Details

Summary

Previously, we just used the platform name. This worked mostly OK, but
it required adding special handling for any unusual (and potentially
downstream) platform plugins, as evidenced by the hardcoding of the
qemu-user platform.

The current implementation was added in
D121605/21c5bb0a636c23ec75b13681c0a6fdb03ecd9c0d, which this essentially
reverts and goes back to the previous method of retrieving the platform
name from the platform triple (the "OS" field).

The motivation for D121605 was the ability to retrieve the process
without constructing an SBDebugger object (which would be necessary in a
world where SBPlatforms are managed by SBDebuggers). However, this world
did not arrive (mainly due to other commitments on my part), and I now
think that if we do want to go in that direction, that we should just
create a dummy/empty SBDebugger object for holding the initial
SBPlatform.

One benefit of D121605 was the unification of getPlatform and
getHostPlatform code paths, and I preserve that benefit by unifying them
in the other direction -- using the host SBPlatform for getHostPlatform.

Diff Detail

Event Timeline

labath created this revision.Nov 21 2022, 6:44 AM
Herald added a project: Restricted Project. · View Herald TranscriptNov 21 2022, 6:44 AM
labath requested review of this revision.Nov 21 2022, 6:44 AM
Herald added a project: Restricted Project. · View Herald TranscriptNov 21 2022, 6:44 AM
This revision is now accepted and ready to land.Nov 28 2022, 1:47 PM