diff options
author | Enrico Granata <egranata@apple.com> | 2012-09-13 18:27:09 +0000 |
---|---|---|
committer | Enrico Granata <egranata@apple.com> | 2012-09-13 18:27:09 +0000 |
commit | b2698cdf595a40d40be11fb0041ce7c1dd38ab28 (patch) | |
tree | 049addcd6345e07dca7ce0878e4209a0b3e4fcf4 /lldb/test/functionalities/data-formatter | |
parent | d0080c45f90afb7abcf6c4f5733c239422836819 (diff) | |
download | bcm5719-llvm-b2698cdf595a40d40be11fb0041ce7c1dd38ab28.tar.gz bcm5719-llvm-b2698cdf595a40d40be11fb0041ce7c1dd38ab28.zip |
<rdar://problem/11086338> Implementing support for synthetic children generated by running C++ code instead of Python scripts ; Adding a bunch of value-generating APIs to our private code layer ; Providing synthetic children for NSArray
llvm-svn: 163818
Diffstat (limited to 'lldb/test/functionalities/data-formatter')
3 files changed, 126 insertions, 0 deletions
diff --git a/lldb/test/functionalities/data-formatter/rdar-11086338/Makefile b/lldb/test/functionalities/data-formatter/rdar-11086338/Makefile new file mode 100644 index 00000000000..9f7fb1ca623 --- /dev/null +++ b/lldb/test/functionalities/data-formatter/rdar-11086338/Makefile @@ -0,0 +1,9 @@ +LEVEL = ../../../make + +OBJC_SOURCES := main.m + +CFLAGS_EXTRAS += -w + +include $(LEVEL)/Makefile.rules + +LDFLAGS += -framework Foundation diff --git a/lldb/test/functionalities/data-formatter/rdar-11086338/TestRdar11086338.py b/lldb/test/functionalities/data-formatter/rdar-11086338/TestRdar11086338.py new file mode 100644 index 00000000000..2c61943fe72 --- /dev/null +++ b/lldb/test/functionalities/data-formatter/rdar-11086338/TestRdar11086338.py @@ -0,0 +1,82 @@ +""" +Test lldb data formatter subsystem. +""" + +import os, time +import unittest2 +import lldb +from lldbtest import * +import datetime + +class DataFormatterRdar11086338TestCase(TestBase): + + mydir = os.path.join("functionalities", "data-formatter", "rdar-11086338") + + @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin") + @dsym_test + def test_rdar11086338_with_dsym_and_run_command(self): + """Test that NSArray reports its synthetic children properly.""" + self.buildDsym() + self.rdar11086338_tester() + + @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin") + @dwarf_test + def test_rdar11086338_with_dwarf_and_run_command(self): + """Test that NSArray reports its synthetic children properly.""" + self.buildDwarf() + self.rdar11086338_tester() + + def setUp(self): + # Call super's setUp(). + TestBase.setUp(self) + # Find the line number to break at. + self.line = line_number('main.m', '// Set break point at this line.') + + def rdar11086338_tester(self): + """Test that NSArray reports its synthetic children properly.""" + self.runCmd("file a.out", CURRENT_EXECUTABLE_SET) + + self.expect("breakpoint set -f main.m -l %d" % self.line, + BREAKPOINT_CREATED, + startstr = "Breakpoint created: 1: file ='main.m', 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 are displaying Cocoa classes correctly + self.expect('frame variable arr', + substrs = ['@"6 objects"']) + self.expect('frame variable other_arr', + substrs = ['@"4 objects"']) + self.expect('frame variable arr --ptr-depth 1', + substrs = ['@"6 objects"','[0] = 0x','[1] = 0x','[2] = 0x','[3] = 0x','[4] = 0x','[5] = 0x']) + self.expect('frame variable other_arr --ptr-depth 1', + substrs = ['@"4 objects"','[0] = 0x','[1] = 0x','[2] = 0x','[3] = 0x']) + self.expect('frame variable arr --ptr-depth 1 -d no-run-target', + substrs = ['@"6 objects"','@"hello"','@"world"','@"this"','@"is"','@"me"','@"http://www.apple.com']) + self.expect('frame variable other_arr --ptr-depth 1 -d no-run-target', + substrs = ['@"4 objects"','(int)5','@"a string"','@"6 objects"']) + self.expect('frame variable other_arr --ptr-depth 2 -d no-run-target', + substrs = ['@"4 objects"','@"6 objects" {','@"hello"','@"world"','@"this"','@"is"','@"me"','@"http://www.apple.com']) + + +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-11086338/main.m b/lldb/test/functionalities/data-formatter/rdar-11086338/main.m new file mode 100644 index 00000000000..1b4a6e03857 --- /dev/null +++ b/lldb/test/functionalities/data-formatter/rdar-11086338/main.m @@ -0,0 +1,35 @@ +//===-- 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]; + + + NSMutableArray* arr = [[NSMutableArray alloc] init]; + [arr addObject:@"hello"]; + [arr addObject:@"world"]; + [arr addObject:@"this"]; + [arr addObject:@"is"]; + [arr addObject:@"me"]; + [arr addObject:[NSURL URLWithString:@"http://www.apple.com/"]]; + + NSDate *aDate = [NSDate distantFuture]; + NSValue *aValue = [NSNumber numberWithInt:5]; + NSString *aString = @"a string"; + + NSArray *other_arr = [NSArray arrayWithObjects:aDate, aValue, aString, arr, nil]; + + [pool drain];// Set break point at this line. + return 0; +} + |