32template <StringElementType element_type>
34 switch (element_type) {
35 case StringElementType::ASCII:
36 case StringElementType::UTF8:
38 case StringElementType::UTF16:
40 case StringElementType::UTF32:
52static std::optional<std::pair<uint64_t, ValueObjectSP>>
55 if (!valobj_pair_sp || !valobj_pair_sp->GetError().Success())
58 ValueObjectSP size_sp = valobj_pair_sp->GetChildMemberWithName(
"_Mysize");
59 ValueObjectSP capacity_sp = valobj_pair_sp->GetChildMemberWithName(
"_Myres");
60 ValueObjectSP bx_sp = valobj_pair_sp->GetChildMemberWithName(
"_Bx");
61 if (!size_sp || !capacity_sp || !bx_sp)
65 uint64_t size = size_sp->GetValueAsUnsigned(0, &success);
68 uint64_t capacity = capacity_sp->GetValueAsUnsigned(0, &success);
72 size_t bufSize = std::max<size_t>(16 / element_size, 1);
73 bool isShortString = capacity < bufSize;
78 return std::make_pair(size, buf_sp);
83 return std::make_pair(size, ptr_sp);
87template <StringPr
inter::StringElementType element_type>
91 std::string prefix_token) {
96 auto [size, location_sp] = *string_info;
99 stream, summary_options, location_sp, size, prefix_token);
101template <StringPr
inter::StringElementType element_type>
104 std::string prefix_token) {
107 valobj, scratch_stream, summary_options, prefix_token);
109 stream << scratch_stream.
GetData();
111 stream <<
"Summary Unavailable";
115template <StringPr
inter::StringElementType element_type>
118 std::string prefix_token) {
121 if (!data_sp || !size_sp)
124 bool success =
false;
125 uint64_t size = size_sp->GetValueAsUnsigned(0, &success);
127 stream <<
"Summary Unavailable";
133 scratch_stream, summary_options, data_sp, size, prefix_token);
136 stream << scratch_stream.
GetData();
138 stream <<
"Summary Unavailable";
143 std::vector<uint32_t> indexes;
152 summary_options,
"L");
160 valobj, stream, summary_options,
"");
167 valobj, stream, summary_options,
"u8");
174 valobj, stream, summary_options,
"u");
181 valobj, stream, summary_options,
"U");
188 summary_options,
"L");
196 summary_options,
"");
203 summary_options,
"u8");
210 summary_options,
"u");
217 summary_options,
"U");
static std::optional< std::pair< uint64_t, ValueObjectSP > > ExtractMsvcStlStringInfo(ValueObject &valobj, uint64_t element_size)
Determine the size in bytes of valobj (a MSVC STL std::string object) and extract its data payload.
static bool formatStringImpl(ValueObject &valobj, Stream &stream, const TypeSummaryOptions &summary_options, std::string prefix_token)
static constexpr uint64_t StringElementByteSize()
static bool MsvcStlStringSummaryProviderImpl(ValueObject &valobj, Stream &stream, const TypeSummaryOptions &summary_options, std::string prefix_token)
static bool formatStringViewImpl(ValueObject &valobj, Stream &stream, const TypeSummaryOptions &summary_options, std::string prefix_token)
static ValueObjectSP ExtractMsvcStlStringData(ValueObject &valobj)
StringPrinter::StringElementType StringElementType
size_t GetIndexOfChildMemberWithName(llvm::StringRef name, bool omit_empty_base_classes, std::vector< uint32_t > &child_indexes) const
Lookup a child member given a name.
const char * GetData() const
A stream class that can stream formatted output to a file.
CompilerType GetCompilerType()
virtual lldb::ValueObjectSP GetChildMemberWithName(llvm::StringRef name, bool can_create=true)
lldb::ValueObjectSP GetChildAtNamePath(llvm::ArrayRef< llvm::StringRef > names)
A class that represents a running process on the host machine.
std::shared_ptr< lldb_private::ValueObject > ValueObjectSP