summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp
diff options
context:
space:
mode:
authorEnrico Granata <egranata@apple.com>2015-11-04 00:02:08 +0000
committerEnrico Granata <egranata@apple.com>2015-11-04 00:02:08 +0000
commitb766292951e660eb59caab38524406afecee04de (patch)
tree2e45e88848e59ccc150339407a4d9fc9a04ad5ce /lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp
parente54a4fa95d308578e30818d3fc6c2575ce6611fb (diff)
downloadbcm5719-llvm-b766292951e660eb59caab38524406afecee04de.tar.gz
bcm5719-llvm-b766292951e660eb59caab38524406afecee04de.zip
Fix an issue where LLDB would truncate summaries for string types without producing any evidence thereof
llvm-svn: 252018
Diffstat (limited to 'lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp')
-rw-r--r--lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp25
1 files changed, 21 insertions, 4 deletions
diff --git a/lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp b/lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp
index 3eaebef152a..950bd62c5c9 100644
--- a/lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp
+++ b/lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp
@@ -563,14 +563,23 @@ lldb_private::formatters::LibcxxWStringSummaryProvider (ValueObject& valobj, Str
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 @@ lldb_private::formatters::LibcxxStringSummaryProvider (ValueObject& valobj, Stre
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);
OpenPOWER on IntegriCloud