[Lldb-commits] [lldb] r242572 - Teach the "extend char types" (char16_t, char32_t and wchar_t) formatters that a *single character* whose value is 0 is actually a valid thing to print out
Enrico Granata
egranata at apple.com
Fri Jul 17 13:54:53 PDT 2015
Author: enrico
Date: Fri Jul 17 15:54:52 2015
New Revision: 242572
URL: http://llvm.org/viewvc/llvm-project?rev=242572&view=rev
Log:
Teach the "extend char types" (char16_t, char32_t and wchar_t) formatters that a *single character* whose value is 0 is actually a valid thing to print out
Modified:
lldb/trunk/source/DataFormatters/CXXFormatterFunctions.cpp
lldb/trunk/test/lang/cpp/char1632_t/TestChar1632T.py
lldb/trunk/test/lang/cpp/char1632_t/main.cpp
lldb/trunk/test/lang/cpp/wchar_t/TestCxxWCharT.py
lldb/trunk/test/lang/cpp/wchar_t/main.cpp
Modified: lldb/trunk/source/DataFormatters/CXXFormatterFunctions.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/DataFormatters/CXXFormatterFunctions.cpp?rev=242572&r1=242571&r2=242572&view=diff
==============================================================================
--- lldb/trunk/source/DataFormatters/CXXFormatterFunctions.cpp (original)
+++ lldb/trunk/source/DataFormatters/CXXFormatterFunctions.cpp Fri Jul 17 15:54:52 2015
@@ -362,6 +362,7 @@ lldb_private::formatters::Char16SummaryP
options.SetPrefixToken('u');
options.SetQuote('\'');
options.SetSourceSize(1);
+ options.SetBinaryZeroIsTerminator(false);
return ReadBufferAndDumpToStream<StringElementType::UTF16>(options);
}
@@ -387,6 +388,7 @@ lldb_private::formatters::Char32SummaryP
options.SetPrefixToken('U');
options.SetQuote('\'');
options.SetSourceSize(1);
+ options.SetBinaryZeroIsTerminator(false);
return ReadBufferAndDumpToStream<StringElementType::UTF32>(options);
}
@@ -407,6 +409,7 @@ lldb_private::formatters::WCharSummaryPr
options.SetPrefixToken('L');
options.SetQuote('\'');
options.SetSourceSize(1);
+ options.SetBinaryZeroIsTerminator(false);
return ReadBufferAndDumpToStream<StringElementType::UTF16>(options);
}
Modified: lldb/trunk/test/lang/cpp/char1632_t/TestChar1632T.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lang/cpp/char1632_t/TestChar1632T.py?rev=242572&r1=242571&r2=242572&view=diff
==============================================================================
--- lldb/trunk/test/lang/cpp/char1632_t/TestChar1632T.py (original)
+++ lldb/trunk/test/lang/cpp/char1632_t/TestChar1632T.py Fri Jul 17 15:54:52 2015
@@ -76,6 +76,12 @@ class Char1632TestCase(TestBase):
self.expect("frame variable s16 s32",
substrs = ['(char16_t *) s16 = 0x','(char32_t *) s32 = ','"è²ãåããæ£ãªãã«ã²"','"à·´"'])
+ # check that zero values are properly handles
+ self.expect('frame variable cs16_zero', substrs=["U+0000 u'\\0'"])
+ self.expect('frame variable cs32_zero', substrs=["U+0x00000000 U'\\0'"])
+ self.expect('expression cs16_zero', substrs=["U+0000 u'\\0'"])
+ self.expect('expression cs32_zero', substrs=["U+0x00000000 U'\\0'"])
+
# Check that we can run expressions that return charN_t
self.expect("expression u'a'",substrs = ['(char16_t) $',"61 u'a'"])
self.expect("expression U'a'",substrs = ['(char32_t) $',"61 U'a'"])
Modified: lldb/trunk/test/lang/cpp/char1632_t/main.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lang/cpp/char1632_t/main.cpp?rev=242572&r1=242571&r2=242572&view=diff
==============================================================================
--- lldb/trunk/test/lang/cpp/char1632_t/main.cpp (original)
+++ lldb/trunk/test/lang/cpp/char1632_t/main.cpp Fri Jul 17 15:54:52 2015
@@ -10,6 +10,8 @@
int main (int argc, char const *argv[])
{
+ auto cs16_zero = (char16_t)0;
+ auto cs32_zero = (char32_t)0;
auto cs16 = u"hello world à¾à¾à¾";
auto cs32 = U"hello world à¾à¾à¾";
char16_t *s16 = (char16_t *)u"ﺸﺵۻ";
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=242572&r1=242571&r2=242572&view=diff
==============================================================================
--- lldb/trunk/test/lang/cpp/wchar_t/TestCxxWCharT.py (original)
+++ lldb/trunk/test/lang/cpp/wchar_t/TestCxxWCharT.py Fri Jul 17 15:54:52 2015
@@ -78,6 +78,9 @@ class CxxWCharTTestCase(TestBase):
self.expect("frame variable array",substrs = ['L"Hey, I\'m a super wchar_t string'])
self.expect("frame variable array",substrs = ['[0]'], matching=False)
+
+ self.expect('frame variable wchar_zero', substrs=["L'\\0'"])
+ self.expect('expression wchar_zero', substrs=["L'\\0'"])
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=242572&r1=242571&r2=242572&view=diff
==============================================================================
--- lldb/trunk/test/lang/cpp/wchar_t/main.cpp (original)
+++ lldb/trunk/test/lang/cpp/wchar_t/main.cpp Fri Jul 17 15:54:52 2015
@@ -29,6 +29,7 @@ int main (int argc, char const *argv[])
wchar_t *ws_NULL = nullptr;
wchar_t *ws_empty = L"";
wchar_t array[200], * array_source = L"Hey, I'm a super wchar_t string, éõñž";
+ wchar_t wchar_zero = (wchar_t)0;
memcpy(array, array_source, 39 * sizeof(wchar_t));
return 0; // Set break point at this line.
}
More information about the lldb-commits
mailing list