[Lldb-commits] [lldb] Define Telemetry plugin for LLDB. (PR #126588)
Pavel Labath via lldb-commits
lldb-commits at lists.llvm.org
Mon Feb 17 01:06:57 PST 2025
labath wrote:
> Given that they also need to support (1) they'd always have to be full blown plugins, right? So it's not like they could be migrated over to a "plugin light" if we came up with something like that?
Sort of. There would have to be *a* full-blown plugin. But there's no reason why setting the host platform must be handled at the same place as registering a (remote) platform plugin. For example, if we had a super-succinct mechanism to register a full-blown plugin, and the host platform wouldn't fit into that, we could put that into completely different place, and everything would be fine. Conversely, we could also make registering the host platform use the same callback iteration code as everything else (we'd pass `PlatformLinux::CreateHostPlatformCallback` to the PluginManager -- if linux was the host -- and then it would create the host platform by iterating through the callbacks).
But I don't think either of those is likely, so it's probably going to stay the way it is...
> > We don't need to inherit from `PluginInterface` as it really doesn't give you anything.
>
> From my understanding, the benefit of inheriting from the interface is you can re-use the existing cmake and C++ macros magic for defining vendor impl - that is, you just put `LLDB_PLUGIN_DEFINE(MyPlugin)` in the vendor code, along with the cmake declaration and you're done! The framework takes care of ensuring the `::Initialize()` is called to set the instance.
Not exactly. All `LLDB_PLUGIN_DEFINE` does is it sets up a call to `YourPlugin::Initialize`. Anything that happens after that is up to the plugin code. There is nothing requiring you to inherit `PluginInterface` in any object that you create. IOW, it's totally feasible to have a "plugin" which does not inherit from "PluginInterface". Whether that's a good idea is a different question. I'm personally fine with that as I never liked the PluginInterface interface much anyway.
>
> > How does that sound to you @oontvoo & @labath?
>
> SG, either way - the simpler the better :)
SGTM
https://github.com/llvm/llvm-project/pull/126588
More information about the lldb-commits
mailing list