summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lldb/source/Core/FormatManager.cpp11
-rw-r--r--lldb/test/functionalities/data-formatter/rdar-11628688/Makefile9
-rw-r--r--lldb/test/functionalities/data-formatter/rdar-11628688/TestFormattersBoolRefPtr.py70
-rw-r--r--lldb/test/functionalities/data-formatter/rdar-11628688/main.mm23
4 files changed, 113 insertions, 0 deletions
diff --git a/lldb/source/Core/FormatManager.cpp b/lldb/source/Core/FormatManager.cpp
index 5a5c1299565..da03277d63a 100644
--- a/lldb/source/Core/FormatManager.cpp
+++ b/lldb/source/Core/FormatManager.cpp
@@ -834,6 +834,17 @@ FormatManager::LoadSystemFormatters()
sys_category_sp->GetSummaryNavigator()->Add(ConstString("char *"), string_format);
sys_category_sp->GetSummaryNavigator()->Add(ConstString("const char *"), string_format);
sys_category_sp->GetRegexSummaryNavigator()->Add(any_size_char_arr, string_array_format);
+
+ lldb::TypeSummaryImplSP ostype_summary(new StringSummaryFormat(TypeSummaryImpl::Flags().SetCascades(false)
+ .SetSkipPointers(true)
+ .SetSkipReferences(true)
+ .SetDontShowChildren(true)
+ .SetDontShowValue(false)
+ .SetShowMembersOneLiner(false)
+ .SetHideItemNames(false),
+ "${var%O}"));
+
+ sys_category_sp->GetSummaryNavigator()->Add(ConstString("OSType"), ostype_summary);
}
static void
diff --git a/lldb/test/functionalities/data-formatter/rdar-11628688/Makefile b/lldb/test/functionalities/data-formatter/rdar-11628688/Makefile
new file mode 100644
index 00000000000..261658b10ae
--- /dev/null
+++ b/lldb/test/functionalities/data-formatter/rdar-11628688/Makefile
@@ -0,0 +1,9 @@
+LEVEL = ../../../make
+
+OBJCXX_SOURCES := main.mm
+
+CFLAGS_EXTRAS += -w
+
+include $(LEVEL)/Makefile.rules
+
+LDFLAGS += -framework Foundation
diff --git a/lldb/test/functionalities/data-formatter/rdar-11628688/TestFormattersBoolRefPtr.py b/lldb/test/functionalities/data-formatter/rdar-11628688/TestFormattersBoolRefPtr.py
new file mode 100644
index 00000000000..6f5d29d373e
--- /dev/null
+++ b/lldb/test/functionalities/data-formatter/rdar-11628688/TestFormattersBoolRefPtr.py
@@ -0,0 +1,70 @@
+"""
+Test lldb data formatter subsystem.
+"""
+
+import os, time
+import unittest2
+import lldb
+from lldbtest import *
+import datetime
+
+class DataFormatterOSTypeTestCase(TestBase):
+
+ mydir = os.path.join("functionalities", "data-formatter", "rdar-11628688")
+
+ @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
+ @dsym_test
+ def test_ostype_with_dsym_and_run_command(self):
+ """Test the formatters we use for OSType."""
+ self.buildDsym()
+ self.ostype_data_formatter_commands()
+
+ @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
+ @dwarf_test
+ def test_ostype_with_dwarf_and_run_command(self):
+ """Test the formatters we use for OSType."""
+ self.buildDwarf()
+ self.ostype_data_formatter_commands()
+
+ def setUp(self):
+ # Call super's setUp().
+ TestBase.setUp(self)
+ # Find the line number to break at.
+ self.line = line_number('main.mm', '// Set break point at this line.')
+
+ def ostype_data_formatter_commands(self):
+ """Test the formatters we use for OSType."""
+ self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
+
+ self.expect("breakpoint set -f main.mm -l %d" % self.line,
+ BREAKPOINT_CREATED,
+ startstr = "Breakpoint created: 1: file ='main.mm', line = %d, locations = 1" %
+ self.line)
+
+ self.runCmd("run", RUN_SUCCEEDED)
+
+ # The stop reason of the thread should be breakpoint.
+ self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
+ substrs = ['stopped',
+ 'stop reason = breakpoint'])
+
+ # This is the function to remove the custom formats in order to have a
+ # clean slate for the next test case.
+ def cleanup():
+ self.runCmd('type format clear', check=False)
+ self.runCmd('type summary clear', check=False)
+ self.runCmd('type synth clear', check=False)
+
+ # Execute the cleanup function during test case tear down.
+ self.addTearDownHook(cleanup)
+
+ # Now check that we use the right summary for OSType
+ self.expect('frame variable',
+ substrs = ["(OSType) a = 1952805748 'test'","(OSType) b = 1650815860 'best'"])
+
+
+if __name__ == '__main__':
+ import atexit
+ lldb.SBDebugger.Initialize()
+ atexit.register(lambda: lldb.SBDebugger.Terminate())
+ unittest2.main()
diff --git a/lldb/test/functionalities/data-formatter/rdar-11628688/main.mm b/lldb/test/functionalities/data-formatter/rdar-11628688/main.mm
new file mode 100644
index 00000000000..8d22659374a
--- /dev/null
+++ b/lldb/test/functionalities/data-formatter/rdar-11628688/main.mm
@@ -0,0 +1,23 @@
+//===-- main.m ------------------------------------------------*- ObjC -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#import <Foundation/Foundation.h>
+
+int main (int argc, const char * argv[])
+{
+
+ NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
+
+ OSType a = 'test';
+ OSType b = 'best';
+
+ [pool drain];// Set break point at this line.
+ return 0;
+}
+
OpenPOWER on IntegriCloud