2 Summary and synthetic providers for LLDB-specific shared pointers
4 Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5 See https://llvm.org/LICENSE.txt for license information.
6 SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
10 class SharedPtr_SyntheticChildrenProvider
:
11 def __init__(self
, valobj
, dict):
18 def num_children(self
):
21 def get_child_index(self
, name
):
28 def get_child_at_index(self
, index
):
30 return self
.valobj
.GetChildMemberWithName("_M_ptr")
33 self
.valobj
.GetChildMemberWithName("_M_refcount")
34 .GetChildMemberWithName("_M_pi")
35 .GetChildMemberWithName("_M_use_count")
40 def SharedPtr_SummaryProvider(valobj
, dict):
41 return "use = " + str(valobj
.GetChildMemberWithName("count").GetValueAsUnsigned())
44 class ValueObjectSP_SyntheticChildrenProvider
:
45 def __init__(self
, valobj
, dict):
52 def num_children(self
):
55 def get_child_index(self
, name
):
62 def get_child_at_index(self
, index
):
64 return self
.valobj
.GetChildMemberWithName("ptr_")
66 return self
.valobj
.GetChildMemberWithName("cntrl_").GetChildMemberWithName(
72 def ValueObjectSP_SummaryProvider(valobj
, dict):
73 return "use = " + str(
74 1 + valobj
.GetChildMemberWithName("count").GetValueAsUnsigned()
78 def __lldb_init_module(debugger
, dict):
79 debugger
.HandleCommand(
80 'type summary add -x ".*ValueObjectSP" --expand -F sp_cp.ValueObjectSP_SummaryProvider'
82 debugger
.HandleCommand(
83 'type synthetic add -x ".*ValueObjectSP" -l sp_cp.ValueObjectSP_SyntheticChildrenProvider'
85 debugger
.HandleCommand(
86 'type summary add -x ".*SP" --expand -F sp_cp.SharedPtr_SummaryProvider'
88 debugger
.HandleCommand(
89 'type synthetic add -x ".*SP" -l sp_cp.SharedPtr_SyntheticChildrenProvider'