[Lldb-commits] [lldb] r239777 - Add a formatter for wchar_t[N] arrays
Enrico Granata
egranata at apple.com
Mon Jun 15 16:01:47 PDT 2015
Author: enrico
Date: Mon Jun 15 18:01:47 2015
New Revision: 239777
URL: http://llvm.org/viewvc/llvm-project?rev=239777&view=rev
Log:
Add a formatter for wchar_t[N] arrays
rdar://21299888
Modified:
lldb/trunk/source/DataFormatters/FormatManager.cpp
lldb/trunk/test/lang/cpp/wchar_t/TestCxxWCharT.py
lldb/trunk/test/lang/cpp/wchar_t/main.cpp
Modified: lldb/trunk/source/DataFormatters/FormatManager.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/DataFormatters/FormatManager.cpp?rev=239777&r1=239776&r2=239777&view=diff
==============================================================================
--- lldb/trunk/source/DataFormatters/FormatManager.cpp (original)
+++ lldb/trunk/source/DataFormatters/FormatManager.cpp Mon Jun 15 18:01:47 2015
@@ -1152,19 +1152,23 @@ FormatManager::LoadSystemFormatters()
.SetShowMembersOneLiner(false)
.SetHideItemNames(false);
+ TypeSummaryImpl::Flags string_array_flags;
+ string_array_flags.SetCascades(false)
+ .SetSkipPointers(true)
+ .SetSkipReferences(false)
+ .SetDontShowChildren(true)
+ .SetDontShowValue(true)
+ .SetShowMembersOneLiner(false)
+ .SetHideItemNames(false);
+
lldb::TypeSummaryImplSP string_format(new StringSummaryFormat(string_flags, "${var%s}"));
- lldb::TypeSummaryImplSP string_array_format(new StringSummaryFormat(TypeSummaryImpl::Flags().SetCascades(false)
- .SetSkipPointers(true)
- .SetSkipReferences(false)
- .SetDontShowChildren(true)
- .SetDontShowValue(true)
- .SetShowMembersOneLiner(false)
- .SetHideItemNames(false),
+ lldb::TypeSummaryImplSP string_array_format(new StringSummaryFormat(string_array_flags,
"${var%s}"));
lldb::RegularExpressionSP any_size_char_arr(new RegularExpression("char \\[[0-9]+\\]"));
+ lldb::RegularExpressionSP any_size_wchar_arr(new RegularExpression("wchar_t \\[[0-9]+\\]"));
TypeCategoryImpl::SharedPointer sys_category_sp = GetCategory(m_system_category_name);
@@ -1190,6 +1194,7 @@ FormatManager::LoadSystemFormatters()
AddCXXSummary(sys_category_sp, lldb_private::formatters::Char32StringSummaryProvider, "char32_t * summary provider", ConstString("char32_t *"), string_flags);
AddCXXSummary(sys_category_sp, lldb_private::formatters::WCharStringSummaryProvider, "wchar_t * summary provider", ConstString("wchar_t *"), string_flags);
+ AddCXXSummary(sys_category_sp, lldb_private::formatters::WCharStringSummaryProvider, "wchar_t * summary provider", ConstString("wchar_t \\[[0-9]+\\]"), string_array_flags, true);
AddCXXSummary(sys_category_sp, lldb_private::formatters::Char16StringSummaryProvider, "unichar * summary provider", ConstString("unichar *"), string_flags);
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=239777&r1=239776&r2=239777&view=diff
==============================================================================
--- lldb/trunk/test/lang/cpp/wchar_t/TestCxxWCharT.py (original)
+++ lldb/trunk/test/lang/cpp/wchar_t/TestCxxWCharT.py Mon Jun 15 18:01:47 2015
@@ -76,6 +76,9 @@ class CxxWCharTTestCase(TestBase):
self.expect("frame variable ws_NULL",substrs = ['(wchar_t *) ws_NULL = 0x0'])
self.expect("frame variable ws_empty",substrs = [' L""'])
+ self.expect("frame variable array",substrs = ['L"Hey, I\'m a super wchar_t string'])
+ self.expect("frame variable array",substrs = ['[0]'], matching=False)
+
if __name__ == '__main__':
import atexit
lldb.SBDebugger.Initialize()
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=239777&r1=239776&r2=239777&view=diff
==============================================================================
--- lldb/trunk/test/lang/cpp/wchar_t/main.cpp (original)
+++ lldb/trunk/test/lang/cpp/wchar_t/main.cpp Mon Jun 15 18:01:47 2015
@@ -26,5 +26,7 @@ int main (int argc, char const *argv[])
const wchar_t *mazeltov = L"××× ×××";
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, éõñž";
+ memcpy(array, array_source, 39 * sizeof(wchar_t));
return 0; // Set break point at this line.
}
More information about the lldb-commits
mailing list