44 ValueObjectSP engaged_sp(
45 valobj_sp->GetChildMemberWithName(
ConstString(
"__engaged_"),
true));
50 llvm::StringRef engaged_as_cstring(
51 engaged_sp->GetValueAsUnsigned(0) == 1 ?
"true" :
"false");
53 stream.
Printf(
" Has Value=%s ", engaged_as_cstring.data());
69 if (process ==
nullptr)
81 case CPPLanguageRuntime::LibCppStdFunctionCallableCase::Invalid:
85 case CPPLanguageRuntime::LibCppStdFunctionCallableCase::Lambda:
87 " Lambda in File %s at Line %u",
91 case CPPLanguageRuntime::LibCppStdFunctionCallableCase::CallableObject:
93 " Function in File %s at Line %u",
97 case CPPLanguageRuntime::LibCppStdFunctionCallableCase::FreeOrMemberFunction:
98 stream.
Printf(
" Function = %s ",
111 ValueObjectSP ptr_sp(
112 valobj_sp->GetChildMemberWithName(
ConstString(
"__ptr_"),
true));
113 ValueObjectSP count_sp(valobj_sp->GetChildAtNamePath(
114 {ConstString(
"__cntrl_"), ConstString(
"__shared_owners_")}));
115 ValueObjectSP weakcount_sp(valobj_sp->GetChildAtNamePath(
116 {ConstString(
"__cntrl_"), ConstString(
"__shared_weak_owners_")}));
121 if (ptr_sp->GetValueAsUnsigned(0) == 0) {
125 bool print_pointee =
false;
127 ValueObjectSP pointee_sp = ptr_sp->Dereference(
error);
128 if (pointee_sp &&
error.Success()) {
129 if (pointee_sp->DumpPrintableRepresentation(
130 stream, ValueObject::eValueObjectRepresentationStyleSummary,
132 ValueObject::PrintableRepresentationSpecialCases::eDisable,
134 print_pointee =
true;
137 stream.
Printf(
"ptr = 0x%" PRIx64, ptr_sp->GetValueAsUnsigned(0));
141 stream.
Printf(
" strong=%" PRIu64, 1 + count_sp->GetValueAsUnsigned(0));
144 stream.
Printf(
" weak=%" PRIu64, 1 + weakcount_sp->GetValueAsUnsigned(0));
155 ValueObjectSP ptr_sp(
156 valobj_sp->GetChildMemberWithName(
ConstString(
"__ptr_"),
true));
164 if (ptr_sp->GetValueAsUnsigned(0) == 0) {
168 bool print_pointee =
false;
170 ValueObjectSP pointee_sp = ptr_sp->Dereference(
error);
171 if (pointee_sp &&
error.Success()) {
172 if (pointee_sp->DumpPrintableRepresentation(
173 stream, ValueObject::eValueObjectRepresentationStyleSummary,
175 ValueObject::PrintableRepresentationSpecialCases::eDisable,
177 print_pointee =
true;
180 stream.
Printf(
"ptr = 0x%" PRIx64, ptr_sp->GetValueAsUnsigned(0));
217 m_pair_ptr =
nullptr;
219 ValueObjectSP valobj_sp = m_backend.GetSP();
223 TargetSP target_sp(valobj_sp->GetTargetSP());
238 m_pair_ptr = valobj_sp
239 ->GetValueForExpressionPath(
240 ".__i_.__ptr_->__value_",
nullptr,
nullptr,
242 .DontCheckDotVsArrowSyntax()
243 .SetSyntheticChildrenTraversal(
245 SyntheticChildrenTraversal::None),
250 m_pair_ptr = valobj_sp
251 ->GetValueForExpressionPath(
252 ".__i_.__ptr_",
nullptr,
nullptr,
254 .DontCheckDotVsArrowSyntax()
255 .SetSyntheticChildrenTraversal(
257 SyntheticChildrenTraversal::None),
261 auto __i_(valobj_sp->GetChildMemberWithName(g_i_,
true));
263 m_pair_ptr =
nullptr;
267 __i_->GetCompilerType().GetTypeTemplateArgument(0));
269 uint64_t bit_offset_ptr;
271 bool is_bitfield_ptr;
273 0, name, &bit_offset_ptr, &bitfield_bit_size_ptr, &is_bitfield_ptr);
275 m_pair_ptr =
nullptr;
280 m_pair_ptr =
nullptr;
283 llvm::dyn_cast_or_null<TypeSystemClang>(pair_type.
GetTypeSystem());
295 {
"payload", pair_type}});
296 llvm::Optional<uint64_t> size = tree_node_type.
GetByteSize(
nullptr);
300 ProcessSP process_sp(target_sp->GetProcessSP());
302 process_sp->ReadMemory(addr, buffer_sp->GetBytes(),
303 buffer_sp->GetByteSize(),
error);
306 DataExtractor extractor(buffer_sp, process_sp->GetByteOrder(),
307 process_sp->GetAddressByteSize());
308 auto pair_sp = CreateValueObjectFromData(
309 "pair", extractor, valobj_sp->GetExecutionContextRef(),
312 m_pair_sp = pair_sp->GetChildAtIndex(4,
true);
329 return m_pair_ptr->GetChildAtIndex(idx,
true);
331 return m_pair_sp->GetChildAtIndex(idx,
true);
332 return lldb::ValueObjectSP();
344 if (name ==
"second")
391 return (m_cntrl ? 1 : 0);
398 return lldb::ValueObjectSP();
400 ValueObjectSP valobj_sp = m_backend.GetSP();
402 return lldb::ValueObjectSP();
405 return valobj_sp->GetChildMemberWithName(
ConstString(
"__ptr_"),
true);
409 valobj_sp->GetChildMemberWithName(
ConstString(
"__ptr_"),
true)) {
411 auto value_sp = ptr_sp->Dereference(status);
414 valobj_sp->GetCompilerType().GetTypeTemplateArgument(0);
415 return value_sp->Cast(value_type_sp);
420 return lldb::ValueObjectSP();
426 ValueObjectSP valobj_sp = m_backend.GetSP();
430 TargetSP target_sp(valobj_sp->GetTargetSP());
434 lldb::ValueObjectSP cntrl_sp(
435 valobj_sp->GetChildMemberWithName(
ConstString(
"__cntrl_"),
true));
437 m_cntrl = cntrl_sp.get();
449 if (name ==
"__ptr_")
451 if (name ==
"$$dereference$$")
485 return (m_value_ptr_sp ? 1 : 0);
492 return lldb::ValueObjectSP();
495 return m_value_ptr_sp;
499 auto value_sp = m_value_ptr_sp->Dereference(status);
505 return lldb::ValueObjectSP();
509 ValueObjectSP valobj_sp = m_backend.GetSP();
513 ValueObjectSP ptr_sp(
514 valobj_sp->GetChildMemberWithName(
ConstString(
"__ptr_"),
true));
530 if (name ==
"__value_")
532 if (name ==
"$$dereference$$")
543 stream.
Printf(
"0x%016" PRIx64
" ", value);
546 nullptr,
nullptr, &valobj,
false,
false);
559 static llvm::Optional<std::pair<uint64_t, ValueObjectSP>>
564 if (!dataval_sp->GetError().Success())
567 ValueObjectSP layout_decider(
568 dataval_sp->GetChildAtIndexPath(llvm::ArrayRef<size_t>({0, 0})));
576 bool short_mode =
false;
578 bool using_bitmasks =
true;
584 uint64_t size_mode_value = 0;
586 if (ValueObjectSP is_long = dataval_sp->GetChildAtNamePath(
587 {ConstString(
"__s"), ConstString(
"__is_long_")})) {
588 using_bitmasks =
false;
589 short_mode = !is_long->GetValueAsUnsigned(0);
590 if (ValueObjectSP size_member =
591 dataval_sp->GetChildAtNamePath({ConstString(
"__s"), ConstString(
"__size_")}))
592 size = size_member->GetValueAsUnsigned(0);
596 llvm::SmallVector<size_t, 3> size_mode_locations[] = {
602 ValueObjectSP size_mode;
603 for (llvm::ArrayRef<size_t> loc : size_mode_locations) {
604 size_mode = dataval_sp->GetChildAtIndexPath(loc);
605 if (size_mode && size_mode->GetName() == g_size_name)
612 size_mode_value = (size_mode->GetValueAsUnsigned(0));
613 short_mode = ((size_mode_value & 0x80) == 0);
615 ValueObjectSP size_mode(dataval_sp->GetChildAtIndexPath({1, 0, 0}));
619 size_mode_value = (size_mode->GetValueAsUnsigned(0));
620 short_mode = ((size_mode_value & 1) == 0);
624 ValueObjectSP short_sp(dataval_sp->GetChildAtIndex(1,
true));
627 ValueObjectSP location_sp = short_sp->GetChildAtIndex(
630 if (location_sp->GetName() == g_size_name)
631 location_sp = short_sp->GetChildAtIndex(3,
true);
635 : ((size_mode_value >> 1) % 256);
641 const llvm::Optional<uint64_t> max_bytes =
642 location_sp->GetCompilerType().GetByteSize(
644 if (!max_bytes || size > *max_bytes || !location_sp)
647 return std::make_pair(size, location_sp);
650 ValueObjectSP l(dataval_sp->GetChildAtIndex(0,
true));
654 ValueObjectSP location_sp =
655 l->GetChildMemberWithName(
ConstString(
"__data_"),
true);
656 ValueObjectSP size_vo =
657 l->GetChildMemberWithName(
ConstString(
"__size_"),
true);
658 ValueObjectSP capacity_vo =
659 l->GetChildMemberWithName(
ConstString(
"__cap_"),
true);
660 if (!size_vo || !location_sp || !capacity_vo)
669 return std::make_pair(size, location_sp);
675 ValueObjectSP location_sp,
size_t size) {
685 const auto max_size = valobj.
GetTargetSP()->GetMaximumSizeOfStringSummary();
686 if (size > max_size) {
693 const size_t bytes_read = location_sp->GetPointeeData(extractor, 0, size);
694 if (bytes_read < size)
708 options.
SetData(std::move(extractor));
715 switch (*wchar_t_size) {
743 ValueObjectSP location_sp;
744 std::tie(size, location_sp) = *string_info;
750 template <StringPr
inter::StringElementType element_type>
754 std::string prefix_token, ValueObjectSP location_sp,
768 const auto max_size = valobj.
GetTargetSP()->GetMaximumSizeOfStringSummary();
769 if (size > max_size) {
777 const size_t bytes_read = location_sp->GetPointeeData(extractor, 0, size);
778 if (bytes_read < size)
781 options.
SetData(std::move(extractor));
784 if (prefix_token.empty())
791 return StringPrinter::ReadBufferAndDumpToStream<element_type>(options);
794 template <StringPr
inter::StringElementType element_type>
803 ValueObjectSP location_sp;
804 std::tie(size, location_sp) = *string_info;
806 return LibcxxStringSummaryProvider<element_type>(
807 valobj, stream, summary_options, prefix_token, location_sp, size);
809 template <StringPr
inter::StringElementType element_type>
814 const bool success = LibcxxStringSummaryProvider<element_type>(
815 valobj, scratch_stream, summary_options, prefix_token);
817 stream << scratch_stream.
GetData();
819 stream <<
"Summary Unavailable";
826 return formatStringImpl<StringPrinter::StringElementType::ASCII>(
827 valobj, stream, summary_options,
"");
833 return formatStringImpl<StringPrinter::StringElementType::UTF16>(
834 valobj, stream, summary_options,
"u");
840 return formatStringImpl<StringPrinter::StringElementType::UTF32>(
841 valobj, stream, summary_options,
"U");
844 static std::tuple<bool, ValueObjectSP, size_t>
851 if (!dataobj || !sizeobj)
852 return std::make_tuple<bool,ValueObjectSP,size_t>(
false, {}, {});
854 if (!dataobj->GetError().Success() || !sizeobj->GetError().Success())
855 return std::make_tuple<bool,ValueObjectSP,size_t>(
false, {}, {});
858 uint64_t size = sizeobj->GetValueAsUnsigned(0, &success);
860 return std::make_tuple<bool,ValueObjectSP,size_t>(
false, {}, {});
862 return std::make_tuple(
true,dataobj,size);
865 template <StringPr
inter::StringElementType element_type>
871 ValueObjectSP dataobj;
876 stream <<
"Summary Unavailable";
880 return LibcxxStringSummaryProvider<element_type>(
881 valobj, stream, summary_options, prefix_token, dataobj, size);
887 return formatStringViewImpl<StringPrinter::StringElementType::ASCII>(
888 valobj, stream, summary_options,
"");
894 return formatStringViewImpl<StringPrinter::StringElementType::UTF16>(
895 valobj, stream, summary_options,
"u");
901 return formatStringViewImpl<StringPrinter::StringElementType::UTF32>(
902 valobj, stream, summary_options,
"U");
910 ValueObjectSP dataobj;
915 stream <<
"Summary Unavailable";