This is an archive of the discontinued LLVM Phabricator instance.

[lldb] Add PlatformMetadata for ScriptedPlatform
AcceptedPublic

Authored by mib on Jan 20 2023, 5:48 PM.

Details

Summary

This patch is a less intrusive implementation of 2d53527.

It introduces a new PlatformMetadata held by every platform that
contains various objects that might be used my a platform instance.

In its current form, the PlatformMetadata holds a reference to the
Debugger and a ScriptedMetadata pointer. These are necessary in other to
instanciate the scripted object that the ScriptedPlatform interacts with.

In order to make it less introsive with the rest of lldb's platform
creation code, platform metadata are set after the platform creation,
and requires to platform to reload them (using Platform::ReloadMetadata).

This approach has the tradeoff that the ScriptedPlaform instance is
technically invalid and useless right after its creation. However, the user
should never be in that situation, since we reload the platform metadata
everytime with create or select the platform.

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>

Diff Detail

Event Timeline

mib created this revision.Jan 20 2023, 5:48 PM
Herald added a project: Restricted Project. · View Herald TranscriptJan 20 2023, 5:48 PM
mib requested review of this revision.Jan 20 2023, 5:48 PM
mib added a comment.EditedJan 24 2023, 10:18 AM

Friendly reminder @labath @JDevlieghere

Cool, I like how this sidesteps having to go through the plugin instantiation mechanism. LGTM if Pavel's happy.

lldb/include/lldb/Interpreter/OptionGroupPlatform.h
19

newline

labath accepted this revision.Jan 27 2023, 4:54 AM

I wouldn't exactly use the word happy, but I also don't have the time to come up with an alternative proposal.

This revision is now accepted and ready to land.Jan 27 2023, 4:54 AM