From 099263b48706d8ef833f0aa823d115eef4de7c43 Mon Sep 17 00:00:00 2001 From: Enrico Granata Date: Mon, 17 Nov 2014 23:14:11 +0000 Subject: [PATCH] Fix a problem where the StringPrinter could be mistaking an empty string for a read error, and reporting spurious 'unable to read data' messages. rdar://19007243 llvm-svn: 222190 --- lldb/source/DataFormatters/StringPrinter.cpp | 2 +- lldb/test/lang/cpp/wchar_t/TestCxxWCharT.py | 2 ++ lldb/test/lang/cpp/wchar_t/main.cpp | 2 ++ 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/lldb/source/DataFormatters/StringPrinter.cpp b/lldb/source/DataFormatters/StringPrinter.cpp index be08cf2..52d03fc 100644 --- a/lldb/source/DataFormatters/StringPrinter.cpp +++ b/lldb/source/DataFormatters/StringPrinter.cpp @@ -566,7 +566,7 @@ ReadUTFBufferAndDumpToStream (const ReadStringAndDumpToStreamOptions& options, else data_read = process_sp->ReadMemoryFromInferior(options.GetLocation(), (char*)buffer_sp->GetBytes(), bufferSPSize, error); - if (error.Fail() || data_read == 0) + if (error.Fail()) { options.GetStream()->Printf("unable to read data"); return true; diff --git a/lldb/test/lang/cpp/wchar_t/TestCxxWCharT.py b/lldb/test/lang/cpp/wchar_t/TestCxxWCharT.py index bade12d..10804c1 100644 --- a/lldb/test/lang/cpp/wchar_t/TestCxxWCharT.py +++ b/lldb/test/lang/cpp/wchar_t/TestCxxWCharT.py @@ -73,6 +73,8 @@ class CxxWCharTTestCase(TestBase): self.expect("frame variable mazeltov", substrs = ['(const wchar_t *) mazeltov = ','L"מזל טוב"']) + self.expect("frame variable ws_NULL",substrs = ['(wchar_t *) ws_NULL = 0x0']) + self.expect("frame variable ws_empty",substrs = [' L""']) if __name__ == '__main__': import atexit diff --git a/lldb/test/lang/cpp/wchar_t/main.cpp b/lldb/test/lang/cpp/wchar_t/main.cpp index 6e533b5a..258c1c1 100644 --- a/lldb/test/lang/cpp/wchar_t/main.cpp +++ b/lldb/test/lang/cpp/wchar_t/main.cpp @@ -24,5 +24,7 @@ int main (int argc, char const *argv[]) Foo foo_x('a'); Foo foo_y(L'a'); const wchar_t *mazeltov = L"מזל טוב"; + wchar_t *ws_NULL = nullptr; + wchar_t *ws_empty = L""; return 0; // Set break point at this line. } -- 2.7.4