Revert "[lldb] Fix string summary of an empty NSPathStore2"

This reverts commit 939ca455e7.

This failed on the debian bot for some reason:
  File "/home/worker/lldb-x86_64-debian/lldb-x86_64-debian/llvm-project/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libstdcpp/string/TestDataFormatterStdString.py", line 67, in test_with_run_command
    "s summary wrong")
AssertionError: 'L"hello world! מזל טוב!\\0!\\0!!!!\\0\\0A\\0\\U0000fffd\\U0000fffd\\U0000fffd\\ [truncated]... != 'L"hello world! מזל טוב!"'
Diff is 2156 characters long. Set self.maxDiff to None to see it. : s summary wrong
This commit is contained in:
Raphael Isemann
2020-03-19 13:07:10 +01:00
parent d4ad386ee1
commit 718d94187d
5 changed files with 10 additions and 33 deletions

View File

@@ -525,33 +525,27 @@ static bool ReadUTFBufferAndDumpToStream(
if (!options.GetStream())
return false;
uint32_t sourceSize;
uint32_t sourceSize = options.GetSourceSize();
bool needs_zero_terminator = options.GetNeedsZeroTermination();
bool is_truncated = false;
const auto max_size = process_sp->GetTarget().GetMaximumSizeOfStringSummary();
if (options.HasSourceSize()) {
sourceSize = options.GetSourceSize();
if (!options.GetIgnoreMaxLength()) {
if (sourceSize > max_size) {
sourceSize = max_size;
is_truncated = true;
}
}
} else {
if (!sourceSize) {
sourceSize = max_size;
needs_zero_terminator = true;
} else if (!options.GetIgnoreMaxLength()) {
if (sourceSize > max_size) {
sourceSize = max_size;
is_truncated = true;
}
}
const int bufferSPSize = sourceSize * type_width;
lldb::DataBufferSP buffer_sp(new DataBufferHeap(bufferSPSize, 0));
// Check if we got bytes. We never get any bytes if we have an empty
// string, but we still continue so that we end up actually printing
// an empty string ("").
if (sourceSize != 0 && !buffer_sp->GetBytes())
if (!buffer_sp->GetBytes())
return false;
Status error;