[Lldb-commits] [lldb] r222190 - 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

Enrico Granata egranata at apple.com
Mon Nov 17 15:14:11 PST 2014


Author: enrico
Date: Mon Nov 17 17:14:11 2014
New Revision: 222190

URL: http://llvm.org/viewvc/llvm-project?rev=222190&view=rev
Log:
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

Modified:
    lldb/trunk/source/DataFormatters/StringPrinter.cpp
    lldb/trunk/test/lang/cpp/wchar_t/TestCxxWCharT.py
    lldb/trunk/test/lang/cpp/wchar_t/main.cpp

Modified: lldb/trunk/source/DataFormatters/StringPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/DataFormatters/StringPrinter.cpp?rev=222190&r1=222189&r2=222190&view=diff
==============================================================================
--- lldb/trunk/source/DataFormatters/StringPrinter.cpp (original)
+++ lldb/trunk/source/DataFormatters/StringPrinter.cpp Mon Nov 17 17:14:11 2014
@@ -566,7 +566,7 @@ ReadUTFBufferAndDumpToStream (const Read
     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;

Modified: lldb/trunk/test/lang/cpp/wchar_t/TestCxxWCharT.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lang/cpp/wchar_t/TestCxxWCharT.py?rev=222190&r1=222189&r2=222190&view=diff
==============================================================================
--- lldb/trunk/test/lang/cpp/wchar_t/TestCxxWCharT.py (original)
+++ lldb/trunk/test/lang/cpp/wchar_t/TestCxxWCharT.py Mon Nov 17 17:14:11 2014
@@ -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

Modified: lldb/trunk/test/lang/cpp/wchar_t/main.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lang/cpp/wchar_t/main.cpp?rev=222190&r1=222189&r2=222190&view=diff
==============================================================================
--- lldb/trunk/test/lang/cpp/wchar_t/main.cpp (original)
+++ lldb/trunk/test/lang/cpp/wchar_t/main.cpp Mon Nov 17 17:14:11 2014
@@ -24,5 +24,7 @@ int main (int argc, char const *argv[])
     Foo<int> foo_x('a');
     Foo<wchar_t> 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.
 }





More information about the lldb-commits mailing list