summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lldb/source/DataFormatters/CXXFormatterFunctions.cpp3
-rw-r--r--lldb/test/lang/cpp/char1632_t/TestChar1632T.py6
-rw-r--r--lldb/test/lang/cpp/char1632_t/main.cpp2
-rw-r--r--lldb/test/lang/cpp/wchar_t/TestCxxWCharT.py3
-rw-r--r--lldb/test/lang/cpp/wchar_t/main.cpp1
5 files changed, 15 insertions, 0 deletions
diff --git a/lldb/source/DataFormatters/CXXFormatterFunctions.cpp b/lldb/source/DataFormatters/CXXFormatterFunctions.cpp
index d3c6f8e1da5..54af44b606c 100644
--- a/lldb/source/DataFormatters/CXXFormatterFunctions.cpp
+++ b/lldb/source/DataFormatters/CXXFormatterFunctions.cpp
@@ -362,6 +362,7 @@ lldb_private::formatters::Char16SummaryProvider (ValueObject& valobj, Stream& st
options.SetPrefixToken('u');
options.SetQuote('\'');
options.SetSourceSize(1);
+ options.SetBinaryZeroIsTerminator(false);
return ReadBufferAndDumpToStream<StringElementType::UTF16>(options);
}
@@ -387,6 +388,7 @@ lldb_private::formatters::Char32SummaryProvider (ValueObject& valobj, Stream& st
options.SetPrefixToken('U');
options.SetQuote('\'');
options.SetSourceSize(1);
+ options.SetBinaryZeroIsTerminator(false);
return ReadBufferAndDumpToStream<StringElementType::UTF32>(options);
}
@@ -407,6 +409,7 @@ lldb_private::formatters::WCharSummaryProvider (ValueObject& valobj, Stream& str
options.SetPrefixToken('L');
options.SetQuote('\'');
options.SetSourceSize(1);
+ options.SetBinaryZeroIsTerminator(false);
return ReadBufferAndDumpToStream<StringElementType::UTF16>(options);
}
diff --git a/lldb/test/lang/cpp/char1632_t/TestChar1632T.py b/lldb/test/lang/cpp/char1632_t/TestChar1632T.py
index 75156958ed3..d1ae51011dc 100644
--- a/lldb/test/lang/cpp/char1632_t/TestChar1632T.py
+++ b/lldb/test/lang/cpp/char1632_t/TestChar1632T.py
@@ -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'"])
diff --git a/lldb/test/lang/cpp/char1632_t/main.cpp b/lldb/test/lang/cpp/char1632_t/main.cpp
index 1fc7f281502..0b690de59f3 100644
--- a/lldb/test/lang/cpp/char1632_t/main.cpp
+++ b/lldb/test/lang/cpp/char1632_t/main.cpp
@@ -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"ﺸﺵۻ";
diff --git a/lldb/test/lang/cpp/wchar_t/TestCxxWCharT.py b/lldb/test/lang/cpp/wchar_t/TestCxxWCharT.py
index 84529c9793c..8b62c5409c4 100644
--- a/lldb/test/lang/cpp/wchar_t/TestCxxWCharT.py
+++ b/lldb/test/lang/cpp/wchar_t/TestCxxWCharT.py
@@ -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
diff --git a/lldb/test/lang/cpp/wchar_t/main.cpp b/lldb/test/lang/cpp/wchar_t/main.cpp
index 9a74d3efeb9..e249c37b678 100644
--- a/lldb/test/lang/cpp/wchar_t/main.cpp
+++ b/lldb/test/lang/cpp/wchar_t/main.cpp
@@ -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.
}
OpenPOWER on IntegriCloud