Fix an issue where LLDB would truncate summaries for string types without producing any evidence thereof
llvm-svn: 252018
diff --git a/lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp b/lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp
index 3eaebef..950bd62 100644
--- a/lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp
+++ b/lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp
@@ -563,14 +563,23 @@
return false;
DataExtractor extractor;
+
+ StringPrinter::ReadBufferAndDumpToStreamOptions options(valobj);
+
if (summary_options.GetCapping() == TypeSummaryCapping::eTypeSummaryCapped)
- size = std::min<decltype(size)>(size, valobj.GetTargetSP()->GetMaximumSizeOfStringSummary());
+ {
+ const auto max_size = valobj.GetTargetSP()->GetMaximumSizeOfStringSummary();
+ if (size > max_size)
+ {
+ size = max_size;
+ options.SetIsTruncated(true);
+ }
+ }
location_sp->GetPointeeData(extractor, 0, size);
// std::wstring::size() is measured in 'characters', not bytes
auto wchar_t_size = valobj.GetTargetSP()->GetScratchClangASTContext()->GetBasicType(lldb::eBasicTypeWChar).GetByteSize(nullptr);
- StringPrinter::ReadBufferAndDumpToStreamOptions options(valobj);
options.SetData(extractor);
options.SetStream(&stream);
options.SetPrefixToken("L");
@@ -618,12 +627,20 @@
if (!location_sp)
return false;
+ StringPrinter::ReadBufferAndDumpToStreamOptions options(valobj);
+
DataExtractor extractor;
if (summary_options.GetCapping() == TypeSummaryCapping::eTypeSummaryCapped)
- size = std::min<decltype(size)>(size, valobj.GetTargetSP()->GetMaximumSizeOfStringSummary());
+ {
+ const auto max_size = valobj.GetTargetSP()->GetMaximumSizeOfStringSummary();
+ if (size > max_size)
+ {
+ size = max_size;
+ options.SetIsTruncated(true);
+ }
+ }
location_sp->GetPointeeData(extractor, 0, size);
- StringPrinter::ReadBufferAndDumpToStreamOptions options(valobj);
options.SetData(extractor);
options.SetStream(&stream);
options.SetPrefixToken(0);