Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions src/etc/lldb_providers.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,29 @@ class LLDBFeature(Flag):
Float128 = auto()
"""Added in LLDB 22.1. Adds builtin support for Float 128's, including an `eBasicTypeFloat128`,
a formatter, and handlers in `TypeSystemClang`"""
GetParent = auto()
"""Added in LLDB 23.1. Adds `SBValue.GetParent`, which retrieves the `SBValue` that the caller
originates from. Useful when a child object must be modified/styled based on information only
available to is parent e.g. unsized array types that must determine their length via the parent
wide pointer value."""
ProviderDecorator = auto()
"""Added in LLDB 23.1. Adds `@lldb.summary` and `@lldb.synthetic`, which can automatically
register decorated providers. At time of writing, we do not use this feature for the following
reasons:

1. backwards compatibility
2. to maintain more strict control over the order in which providers are loaded"""
PerObjectSynthetics = auto()
"""Currently only available in prerelease. Adds:

* `SBValue.SetTypeSynthetic` - allows synthetic providers to override their children's synthetic
provider without overriding the synthetic provider of all objects with that share a type name.
* `SBValue.GetTypeSyntheticImplementation` - retrieves the *instance* of the synthetic provider
associated with that variable. This allows us to easily inspect the state of a parent/child
and use it to make decisions about the current object without needing to redo work. It is worth
noting that this can be achieved backwards-compatibly (though less elegantly) by using a global
`weakref.WeakValueDictionary`, with the keys being `SBValue.GetID()` (which are unique per
session) and the values being the provider instance."""


def detect_features() -> LLDBFeature:
Expand All @@ -93,6 +116,12 @@ def detect_features() -> LLDBFeature:
features |= LLDBFeature.TypeRecognizers
if getattr(lldb, "eBasicTypeFloat128", None) is not None:
features |= LLDBFeature.Float128
if getattr(lldb.SBValue, "GetParent", None) is not None:
features |= LLDBFeature.GetParent
if getattr(lldb, "summary", None) is not None:
features |= LLDBFeature.ProviderDecorator
if getattr(lldb.SBValue, "SetTypeSynthetic", None) is not None:
features |= LLDBFeature.PerObjectSynthetics

return features

Expand Down
Loading