Automatically enabling the Cocoa formatter categories for command-line LLDB. Previously, the categories were filled in but disabled by default. Tweaking test cases appropriately to keep working and do the right thing

llvm-svn: 155605
This commit is contained in:
Enrico Granata 2012-04-26 01:40:38 +00:00
parent 8a8e9d1b63
commit 73076f9269
6 changed files with 10 additions and 59 deletions

View File

@ -211,7 +211,7 @@ def GetSummary_Impl(valobj):
wrapper = NSTimeZoneClass_SummaryProvider(valobj, class_data.sys_params)
statistics.metric_hit('code_notrun',valobj)
else:
wrapper = NSUnknownDate_SummaryProvider(valobj, class_data.sys_params)
wrapper = NSUnknownDate_SummaryProvider(valobj)
statistics.metric_hit('unknown_class',valobj.GetName() + " seen as " + name_string)
return wrapper;

View File

@ -597,13 +597,13 @@ FormatManager::FormatManager() :
#endif
EnableCategory(m_objc_category_name,CategoryMap::Last);
//EnableCategory(m_corefoundation_category_name,CategoryMap::Last);
//EnableCategory(m_appkit_category_name,CategoryMap::Last);
//EnableCategory(m_coreservices_category_name,CategoryMap::Last);
//EnableCategory(m_coregraphics_category_name,CategoryMap::Last);
EnableCategory(m_corefoundation_category_name,CategoryMap::Last);
EnableCategory(m_appkit_category_name,CategoryMap::Last);
EnableCategory(m_coreservices_category_name,CategoryMap::Last);
EnableCategory(m_coregraphics_category_name,CategoryMap::Last);
EnableCategory(m_gnu_cpp_category_name,CategoryMap::Last);
EnableCategory(m_libcxx_category_name,CategoryMap::Last);
//EnableCategory(m_vectortypes_category_name,CategoryMap::Last);
EnableCategory(m_vectortypes_category_name,CategoryMap::Last);
EnableCategory(m_system_category_name,CategoryMap::Last);
}

View File

@ -127,17 +127,11 @@ class ObjCDataFormatterTestCase(TestBase):
self.runCmd('type format clear', check=False)
self.runCmd('type summary clear', check=False)
self.runCmd('type synth clear', check=False)
self.runCmd('type category disable CoreFoundation', check=False)
self.runCmd('type category disable CoreGraphics', check=False)
self.runCmd('type category disable CoreServices', check=False)
self.runCmd('type category disable AppKit', check=False)
# Execute the cleanup function during test case tear down.
self.addTearDownHook(cleanup)
self.runCmd("type category enable AppKit")
self.expect('frame variable italian', substrs = ['L\'Italia è una Repubblica democratica, fondata sul lavoro. La sovranità appartiene al popolo, che la esercita nelle forme e nei limiti della Costituzione.'])
self.expect('frame variable french', substrs = ['Que veut cette horde d\'esclaves, De traîtres, de rois conjurés?'])
self.expect('frame variable german', substrs = ['Über-Ich und aus den Ansprüchen der sozialen Umwelt'])
@ -165,11 +159,6 @@ class ObjCDataFormatterTestCase(TestBase):
self.runCmd('type format clear', check=False)
self.runCmd('type summary clear', check=False)
self.runCmd('type synth clear', check=False)
self.runCmd('type category disable CoreFoundation', check=False)
self.runCmd('type category disable CoreGraphics', check=False)
self.runCmd('type category disable CoreServices', check=False)
self.runCmd('type category disable AppKit', check=False)
# Execute the cleanup function during test case tear down.
self.addTearDownHook(cleanup)
@ -227,16 +216,11 @@ class ObjCDataFormatterTestCase(TestBase):
self.runCmd('type format clear', check=False)
self.runCmd('type summary clear', check=False)
self.runCmd('type synth clear', check=False)
self.runCmd('type category disable CoreFoundation', check=False)
self.runCmd('type category disable CoreGraphics', check=False)
self.runCmd('type category disable CoreServices', check=False)
self.runCmd('type category disable AppKit', check=False)
# Execute the cleanup function during test case tear down.
self.addTearDownHook(cleanup)
# Now enable AppKit and check we are displaying Cocoa classes correctly
self.runCmd("type category enable AppKit")
self.expect('frame variable num1 num2 num3 num4 num5 num6 num7 num8_Y num8_N num9',
substrs = ['(NSNumber *) num1 = ',' (int)5',
'(NSNumber *) num2 = ',' (float)3.1',
@ -359,8 +343,6 @@ class ObjCDataFormatterTestCase(TestBase):
'@"Europe/Rome"',
'@"Europe/Paris"'])
self.runCmd('type category list')
self.runCmd('type summary list')
self.expect('frame variable myclass',
substrs = ['(Class) myclass = NSValue'])
@ -396,17 +378,10 @@ class ObjCDataFormatterTestCase(TestBase):
self.runCmd('type format clear', check=False)
self.runCmd('type summary clear', check=False)
self.runCmd('type synth clear', check=False)
self.runCmd('type category disable CoreFoundation', check=False)
self.runCmd('type category disable CoreGraphics', check=False)
self.runCmd('type category disable CoreServices', check=False)
self.runCmd('type category disable AppKit', check=False)
# Execute the cleanup function during test case tear down.
self.addTearDownHook(cleanup)
# Now enable AppKit
self.runCmd("type category enable AppKit")
# check that the formatters are able to deal safely and correctly
# with ValueObjects that the expression parser returns
self.expect('expression ((id)@"Hello")', matching=False,
@ -449,10 +424,6 @@ class ObjCDataFormatterTestCase(TestBase):
self.runCmd('type format clear', check=False)
self.runCmd('type summary clear', check=False)
self.runCmd('type synth clear', check=False)
self.runCmd('type category disable CoreFoundation', check=False)
self.runCmd('type category disable CoreGraphics', check=False)
self.runCmd('type category disable CoreServices', check=False)
self.runCmd('type category disable AppKit', check=False)
self.runCmd('log timers disable', check=False)
@ -460,10 +431,6 @@ class ObjCDataFormatterTestCase(TestBase):
self.addTearDownHook(cleanup)
# check formatters for common Objective-C types
self.runCmd('type category enable CoreFoundation')
self.runCmd('type category enable CoreGraphics')
self.runCmd('type category enable CoreServices')
self.runCmd("type category enable AppKit")
self.runCmd("log timers enable")
self.expect("frame variable",
substrs = ['(CFGregorianUnits) cf_greg_units = 1 years, 3 months, 5 days, 12 hours, 5 minutes 7 seconds',
@ -514,18 +481,10 @@ class ObjCDataFormatterTestCase(TestBase):
self.runCmd('type format clear', check=False)
self.runCmd('type summary clear', check=False)
self.runCmd('type synth clear', check=False)
self.runCmd('type category disable CoreFoundation', check=False)
self.runCmd('type category disable CoreGraphics', check=False)
self.runCmd('type category disable CoreServices', check=False)
self.runCmd('type category disable AppKit', check=False)
# Execute the cleanup function during test case tear down.
self.addTearDownHook(cleanup)
# check formatters for common Objective-C types
self.runCmd('type category enable AppKit')
# as long as KVO is implemented by subclassing, this test should succeed
# we should be able to dynamically figure out that the KVO implementor class
# is a subclass of Molecule, and use the appropriate summary for it

View File

@ -51,13 +51,10 @@ class Radar10642615DataFormatterTestCase(TestBase):
# clean slate for the next test case.
def cleanup():
self.runCmd('type summary clear', check=False)
self.runCmd('type category disable VectorTypes', check=False)
# Execute the cleanup function during test case tear down.
self.addTearDownHook(cleanup)
self.runCmd('type category enable VectorTypes')
self.expect('frame variable',
substrs = ['(vFloat) valueFL = (1, 0, 4, 0)',
'(int16_t [8]) valueI16 = (1, 0, 4, 0, 0, 1, 0, 4)',

View File

@ -54,16 +54,11 @@ class DataFormatterOneIsSingularTestCase(TestBase):
self.runCmd('type format clear', check=False)
self.runCmd('type summary clear', check=False)
self.runCmd('type synth clear', check=False)
self.runCmd('type category disable CoreFoundation', check=False)
self.runCmd('type category disable CoreGraphics', check=False)
self.runCmd('type category disable CoreServices', check=False)
self.runCmd('type category disable AppKit', check=False)
# Execute the cleanup function during test case tear down.
self.addTearDownHook(cleanup)
# Now enable AppKit and check we are displaying Cocoa classes correctly
self.runCmd("type category enable AppKit")
# Now check that we are displaying Cocoa classes correctly
self.expect('frame variable key',
substrs = ['@"1 object"'])
self.expect('frame variable key', matching=False,

View File

@ -49,10 +49,10 @@ class Rdar10967107TestCase(TestBase):
self.runCmd("run", RUN_SUCCEEDED)
# check that each type is correctly bound to its list of children
self.expect("frame variable cf_greg_date", substrs = ['year','month','day','hour','minute','second'])
self.expect("frame variable cf_range", substrs = ['location','length'])
self.expect("frame variable cf_greg_date --raw", substrs = ['year','month','day','hour','minute','second'])
self.expect("frame variable cf_range --raw", substrs = ['location','length'])
# check that printing both does not somehow confuse LLDB
self.expect("frame variable", substrs = ['year','month','day','hour','minute','second','location','length'])
self.expect("frame variable --raw", substrs = ['year','month','day','hour','minute','second','location','length'])
if __name__ == '__main__':
import atexit