ScriptedSyntheticChildren#

class lldb.plugins.scripted_synthetic_children.ScriptedSyntheticChildren(valobj: SBValue)#

The base class for a scripted synthetic children provider.

A synthetic children provider allows you to customize how a value is expanded into children when displayed (e.g. frame variable, bt). Register it with type synthetic add -l <ClassName> ....

Most of the base class methods are @abstractmethod that need to be overwritten by the inheriting class.

Methods Summary

get_child_at_index(index)

Get the child at the given index.

get_child_index(name)

Get the index of the child with the given name.

get_type_name()

Override the type name shown for this synthetic value.

get_value()

Make this a value-providing synthetic children provider: the value returned here becomes the value for this SBValue, in place of the value backing it.

has_children()

Whether this value might have children, without necessarily computing them.

num_children()

The number of children this value has.

update()

Called when the value backing this provider may have changed (e.g. after a continue), giving the provider a chance to refresh any cached state.

Methods Documentation

abstract get_child_at_index(index: int) SBValue | None#

Get the child at the given index.

Parameters:

index (int) – The index of the child to return.

Returns:

The value for the child at this index, or None if there is no child at this index.

Return type:

lldb.SBValue

get_child_index(name: str) int | None#

Get the index of the child with the given name.

Parameters:

name (str) – The name of the child to look up.

Returns:

The index of the child with this name, or None/a negative value if no such child exists. Defaults to a linear search over get_child_at_index/num_children.

Return type:

int

get_type_name() str | None#

Override the type name shown for this synthetic value.

Returns:

The type name to display, or None/empty to keep the default. Defaults to None.

Return type:

str

get_value() SBValue | None#

Make this a value-providing synthetic children provider: the value returned here becomes the value for this SBValue, in place of the value backing it. None of the other methods on this class (num_children, get_child_at_index, get_child_index) are consulted, and the children of the original value are not shown.

Returns:

The value to use instead of this value’s own, or None to leave this value unaffected. Defaults to None.

Return type:

lldb.SBValue

has_children() bool#

Whether this value might have children, without necessarily computing them. Used as a cheap check to decide whether to show an expansion arrow in graphical frontends, for example.

Returns:

True if this value might have children, False otherwise. Defaults to True.

Return type:

bool

abstract num_children() int#

The number of children this value has.

This can optionally take a second max_count parameter (i.e. def num_children(self, max_count)) if computing the exact count is expensive; in that case return max_count once at least that many children are known to exist.

Returns:

The number of children.

Return type:

int

update() bool#

Called when the value backing this provider may have changed (e.g. after a continue), giving the provider a chance to refresh any cached state.

Returns:

True if the previously computed children can be reused, False if they should be recomputed. Defaults to False.

Return type:

bool