27 explicit LibStdcppUniquePtrSyntheticFrontEnd(lldb::ValueObjectSP valobj_sp);
51 ValueObjectSP GetTuple();
56LibStdcppUniquePtrSyntheticFrontEnd::LibStdcppUniquePtrSyntheticFrontEnd(
57 lldb::ValueObjectSP valobj_sp)
62ValueObjectSP LibStdcppUniquePtrSyntheticFrontEnd::GetTuple() {
63 ValueObjectSP valobj_backend_sp = m_backend.GetSP();
65 if (!valobj_backend_sp)
68 ValueObjectSP valobj_sp = valobj_backend_sp->GetNonSyntheticValue();
72 ValueObjectSP obj_child_sp =
73 valobj_sp->GetChildMemberWithName(
ConstString(
"_M_t"),
true);
77 ValueObjectSP obj_subchild_sp =
78 obj_child_sp->GetChildMemberWithName(
ConstString(
"_M_t"),
true);
82 if (obj_subchild_sp) {
83 return obj_subchild_sp;
89bool LibStdcppUniquePtrSyntheticFrontEnd::Update() {
90 ValueObjectSP tuple_sp = GetTuple();
95 std::unique_ptr<SyntheticChildrenFrontEnd> tuple_frontend(
98 ValueObjectSP ptr_obj = tuple_frontend->GetChildAtIndex(0);
100 m_ptr_obj = ptr_obj->Clone(
ConstString(
"pointer")).get();
108 if (tuple_sp->GetByteSize() > ptr_obj->GetByteSize()) {
109 ValueObjectSP del_obj = tuple_frontend->GetChildAtIndex(1);
111 m_del_obj = del_obj->Clone(
ConstString(
"deleter")).get();
116 ValueObjectSP obj_obj = m_ptr_obj->Dereference(
error);
117 if (
error.Success()) {
118 m_obj_obj = obj_obj->Clone(
ConstString(
"object")).get();
125bool LibStdcppUniquePtrSyntheticFrontEnd::MightHaveChildren() {
return true; }
128LibStdcppUniquePtrSyntheticFrontEnd::GetChildAtIndex(
size_t idx) {
129 if (idx == 0 && m_ptr_obj)
130 return m_ptr_obj->GetSP();
131 if (idx == 1 && m_del_obj)
132 return m_del_obj->GetSP();
133 if (idx == 2 && m_obj_obj)
134 return m_obj_obj->GetSP();
135 return lldb::ValueObjectSP();
138size_t LibStdcppUniquePtrSyntheticFrontEnd::CalculateNumChildren() {
144size_t LibStdcppUniquePtrSyntheticFrontEnd::GetIndexOfChildWithName(
146 if (name ==
"ptr" || name ==
"pointer")
148 if (name ==
"del" || name ==
"deleter")
150 if (name ==
"obj" || name ==
"object" || name ==
"$$dereference$$")
155bool LibStdcppUniquePtrSyntheticFrontEnd::GetSummary(
161 uint64_t ptr_value = m_ptr_obj->GetValueAsUnsigned(0, &success);
167 stream.
Printf(
"0x%" PRIx64, ptr_value);
174 return (valobj_sp ?
new LibStdcppUniquePtrSyntheticFrontEnd(valobj_sp)
180 LibStdcppUniquePtrSyntheticFrontEnd formatter(valobj.
GetSP());
181 return formatter.GetSummary(stream, options);
static llvm::raw_ostream & error(Stream &strm)
A uniqued constant string class.
A stream class that can stream formatted output to a file.
size_t Printf(const char *format,...) __attribute__((format(printf
Output printf formatted output to the stream.
virtual size_t CalculateNumChildren()=0
virtual bool MightHaveChildren()=0
virtual size_t GetIndexOfChildWithName(ConstString name)=0
virtual lldb::ValueObjectSP GetChildAtIndex(size_t idx)=0
lldb::ValueObjectSP GetSP()
A class that represents a running process on the host machine.