[Lldb-commits] [lldb] r121440 - in /lldb/trunk/test/objc-stepping: ./ stepping-tests.m
Jim Ingham
jingham at apple.com
Thu Dec 9 16:27:27 PST 2010
Author: jingham
Date: Thu Dec 9 18:27:27 2010
New Revision: 121440
URL: http://llvm.org/viewvc/llvm-project?rev=121440&view=rev
Log:
Added the source file for some ObjC stepping tests. No test yet.
Added:
lldb/trunk/test/objc-stepping/
lldb/trunk/test/objc-stepping/stepping-tests.m
Added: lldb/trunk/test/objc-stepping/stepping-tests.m
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/objc-stepping/stepping-tests.m?rev=121440&view=auto
==============================================================================
--- lldb/trunk/test/objc-stepping/stepping-tests.m (added)
+++ lldb/trunk/test/objc-stepping/stepping-tests.m Thu Dec 9 18:27:27 2010
@@ -0,0 +1,133 @@
+#import <Foundation/Foundation.h>
+#include <stdio.h>
+
+struct return_me
+{
+ int first;
+ int second;
+};
+
+ at interface SourceBase: NSObject
+{
+ struct return_me my_return;
+}
+- (SourceBase *) initWithFirst: (int) first andSecond: (int) second;
+- (void) randomMethod;
+- (struct return_me) returnsStruct;
+ at end
+
+ at implementation SourceBase
+- (void) randomMethod
+{
+ printf ("Called in SourceBase version of randomMethod.\n");
+}
+
+- (struct return_me) returnsStruct
+{
+ return my_return;
+}
+
+- (SourceBase *) initWithFirst: (int) first andSecond: (int) second
+{
+ my_return.first = first;
+ my_return.second = second;
+
+ return self;
+}
+ at end
+
+ at interface Source : SourceBase
+{
+ int _property;
+}
+- (void) setProperty: (int) newValue;
+- (void) randomMethod;
+- (struct return_me) returnsStruct;
+ at end
+
+ at implementation Source
+- (void) setProperty: (int) newValue
+{
+ _property = newValue;
+}
+
+- (void) randomMethod
+{
+ [super randomMethod];
+ printf ("Called in Source version of random method.");
+}
+
+- (struct return_me) returnsStruct
+{
+ printf ("Called in Source version of returnsStruct.\n");
+ return [super returnsStruct];
+}
+
+ at end
+
+ at interface Observer : NSObject
+{
+ Source *_source;
+}
++ (Observer *) observerWithSource: (Source *) source;
+- (Observer *) initWithASource: (Source *) source;
+- (void) observeValueForKeyPath: (NSString *) path
+ ofObject: (id) object
+ change: (NSDictionary *) change
+ context: (void *) context;
+ at end
+
+ at implementation Observer
+
++ (Observer *) observerWithSource: (Source *) inSource;
+{
+ Observer *retval;
+
+ retval = [[Observer alloc] initWithASource: inSource];
+ return retval;
+}
+
+- (Observer *) initWithASource: (Source *) source
+{
+ [super init];
+ _source = source;
+ [_source addObserver: self
+ forKeyPath: @"property"
+ options: (NSKeyValueObservingOptionNew | NSKeyValueObservingOptionOld)
+ context: NULL];
+ return self;
+}
+
+- (void) observeValueForKeyPath: (NSString *) path
+ ofObject: (id) object
+ change: (NSDictionary *) change
+ context: (void *) context
+{
+ printf ("Observer function called.\n");
+ return;
+}
+ at end
+
+int main ()
+{
+ Source *mySource;
+ Observer *myObserver;
+ struct return_me ret_val;
+
+ NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
+
+ mySource = [[Source alloc] init];
+
+ [mySource randomMethod]; // Set first breakpoint here.
+ ret_val = [mySource returnsStruct]; // Set second breakpoint here.
+
+ myObserver = [Observer observerWithSource: mySource];
+
+ [mySource randomMethod]; // Set third breakpoint here.
+ ret_val = [mySource returnsStruct]; // Set fourth breakpoint here.
+ [mySource setProperty: 5]; // Set fifth breakpoint here.
+
+ [pool release];
+ return 0;
+
+}
More information about the lldb-commits
mailing list