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 = valobj_sp->GetChildMemberWithName(
"_M_t",
true);
76 ValueObjectSP obj_subchild_sp =
77 obj_child_sp->GetChildMemberWithName(
"_M_t",
true);
81 if (obj_subchild_sp) {
82 return obj_subchild_sp;
88bool LibStdcppUniquePtrSyntheticFrontEnd::Update() {
89 ValueObjectSP tuple_sp = GetTuple();
94 std::unique_ptr<SyntheticChildrenFrontEnd> tuple_frontend(
97 ValueObjectSP ptr_obj = tuple_frontend->GetChildAtIndex(0);
99 m_ptr_obj = ptr_obj->Clone(
ConstString(
"pointer")).get();
107 if (tuple_sp->GetByteSize() > ptr_obj->GetByteSize()) {
108 ValueObjectSP del_obj = tuple_frontend->GetChildAtIndex(1);
110 m_del_obj = del_obj->Clone(
ConstString(
"deleter")).get();
115 ValueObjectSP obj_obj = m_ptr_obj->Dereference(
error);
116 if (
error.Success()) {
117 m_obj_obj = obj_obj->Clone(
ConstString(
"object")).get();
124bool LibStdcppUniquePtrSyntheticFrontEnd::MightHaveChildren() {
return true; }
127LibStdcppUniquePtrSyntheticFrontEnd::GetChildAtIndex(
size_t idx) {
128 if (idx == 0 && m_ptr_obj)
129 return m_ptr_obj->GetSP();
130 if (idx == 1 && m_del_obj)
131 return m_del_obj->GetSP();
132 if (idx == 2 && m_obj_obj)
133 return m_obj_obj->GetSP();
134 return lldb::ValueObjectSP();
137size_t LibStdcppUniquePtrSyntheticFrontEnd::CalculateNumChildren() {
143size_t LibStdcppUniquePtrSyntheticFrontEnd::GetIndexOfChildWithName(
145 if (name ==
"ptr" || name ==
"pointer")
147 if (name ==
"del" || name ==
"deleter")
149 if (name ==
"obj" || name ==
"object" || name ==
"$$dereference$$")
154bool LibStdcppUniquePtrSyntheticFrontEnd::GetSummary(
160 uint64_t ptr_value = m_ptr_obj->GetValueAsUnsigned(0, &success);
166 stream.
Printf(
"0x%" PRIx64, ptr_value);
173 return (valobj_sp ?
new LibStdcppUniquePtrSyntheticFrontEnd(valobj_sp)
179 LibStdcppUniquePtrSyntheticFrontEnd formatter(valobj.
GetSP());
180 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.