[Lldb-commits] [lldb] r113314 - in /lldb/trunk/test/objc: ./ Makefile main.m
Greg Clayton
gclayton at apple.com
Tue Sep 7 16:55:31 PDT 2010
Author: gclayton
Date: Tue Sep 7 18:55:31 2010
New Revision: 113314
URL: http://llvm.org/viewvc/llvm-project?rev=113314&view=rev
Log:
Added an objective C test that creates some NSString, NSArray and NSDictionary
objects and populates them so we can test making expression calls with these
objects. We will need to make this test case more complete as time goes on to
make sure we can evaluate all functions.
Added:
lldb/trunk/test/objc/
lldb/trunk/test/objc/Makefile
lldb/trunk/test/objc/main.m
Added: lldb/trunk/test/objc/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/objc/Makefile?rev=113314&view=auto
==============================================================================
--- lldb/trunk/test/objc/Makefile (added)
+++ lldb/trunk/test/objc/Makefile Tue Sep 7 18:55:31 2010
@@ -0,0 +1,125 @@
+#----------------------------------------------------------------------
+# Fill in the source files to build
+#----------------------------------------------------------------------
+C_SOURCES :=
+CXX_SOURCES :=
+OBJC_SOURCES :=main.m
+OBJCXX_SOURCES :=
+
+# Uncomment line below for debugging shell commands
+# SHELL = /bin/sh -x
+
+#----------------------------------------------------------------------
+# Change any build/tool options needed
+#----------------------------------------------------------------------
+DS := /usr/bin/dsymutil
+DSFLAGS =
+CFLAGS ?=-arch x86_64 -g -O0
+CPLUSPLUSFLAGS +=$(CFLAGS)
+CPPFLAGS +=$(CFLAGS)
+LD = gcc
+LDFLAGS = $(CFLAGS) -lobjc -framework Foundation
+OBJECTS =
+EXE=a.out
+DSYM=$(EXE).dSYM
+
+#----------------------------------------------------------------------
+# Check if we have any C source files
+#----------------------------------------------------------------------
+ifneq "$(strip $(C_SOURCES))" ""
+ OBJECTS +=$(strip $(C_SOURCES:.c=.o))
+endif
+
+#----------------------------------------------------------------------
+# Check if we have any C++ source files
+#----------------------------------------------------------------------
+ifneq "$(strip $(CXX_SOURCES))" ""
+ OBJECTS +=$(strip $(CXX_SOURCES:.cpp=.o))
+ LD = g++
+endif
+
+#----------------------------------------------------------------------
+# Check if we have any ObjC source files
+#----------------------------------------------------------------------
+ifneq "$(strip $(OBJC_SOURCES))" ""
+ OBJECTS +=$(strip $(OBJC_SOURCES:.m=.o))
+ LDFLAGS +=-lobjc
+endif
+
+#----------------------------------------------------------------------
+# Check if we have any ObjC++ source files
+#----------------------------------------------------------------------
+ifneq "$(strip $(OBJCXX_SOURCES))" ""
+ OBJECTS +=$(strip $(OBJCXX_SOURCES:.mm=.o))
+ LD = g++
+ ifeq $(findstring lobjc,$(LDFLAGS)) ""
+ LDFLAGS +=-lobjc
+ endif
+endif
+
+
+#----------------------------------------------------------------------
+# Make the dSYM file from the executable
+#----------------------------------------------------------------------
+$(DSYM) : $(EXE)
+ $(DS) $(DSFLAGS) -o "$(DSYM)" "$(EXE)"
+
+#----------------------------------------------------------------------
+# Compile the executable from all the objects (default rule) with no
+# dsym file.
+#----------------------------------------------------------------------
+$(EXE) : $(OBJECTS)
+ $(LD) $(LDFLAGS) $(OBJECTS) -o "$(EXE)"
+
+
+#----------------------------------------------------------------------
+# Automatic variables based on items already entered. Below we create
+# an objects lists from the list of sources by replacing all entries
+# that end with .c with .o, and we also create a list of prerequisite
+# files by replacing all .c files with .d.
+#----------------------------------------------------------------------
+PREREQS := $(OBJECTS:.o=.d)
+
+#----------------------------------------------------------------------
+# Rule for Generating Prerequisites Automatically using .d files and
+# the compiler -MM option. The -M option will list all system headers,
+# and the -MM option will list all non-system dependencies.
+#----------------------------------------------------------------------
+%.d: %.c
+ @set -e; rm -f $@; \
+ $(CC) -M $(CPPFLAGS) $< > $@.$$$$; \
+ sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \
+ rm -f $@.$$$$
+
+%.d: %.cpp
+ @set -e; rm -f $@; \
+ $(CC) -M $(CPPFLAGS) $< > $@.$$$$; \
+ sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \
+ rm -f $@.$$$$
+
+%.d: %.m
+ @set -e; rm -f $@; \
+ $(CC) -M $(CPPFLAGS) $< > $@.$$$$; \
+ sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \
+ rm -f $@.$$$$
+
+%.d: %.mm
+ @set -e; rm -f $@; \
+ $(CC) -M $(CPPFLAGS) $< > $@.$$$$; \
+ sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \
+ rm -f $@.$$$$
+
+#----------------------------------------------------------------------
+# Include all of the makefiles for each source file so we don't have
+# to manually track all of the prerequisites for each source file.
+#----------------------------------------------------------------------
+sinclude $(PREREQS)
+
+.PHONY: clean
+dsym: $(DSYM)
+all: $(EXE) $(DSYM)
+clean:
+ rm -rf "$(EXE)" "$(DSYM)" $(OBJECTS) $(PREREQS)
+
+
+
Added: lldb/trunk/test/objc/main.m
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/objc/main.m?rev=113314&view=auto
==============================================================================
--- lldb/trunk/test/objc/main.m (added)
+++ lldb/trunk/test/objc/main.m Tue Sep 7 18:55:31 2010
@@ -0,0 +1,22 @@
+#import <Foundation/Foundation.h>
+
+
+int main (int argc, char const *argv[])
+{
+ NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
+ static NSString *g_global_nsstr = @"Howdy";
+ NSString *str1 = [NSString stringWithFormat:@"string %i", 1];
+ NSString *str2 = [NSString stringWithFormat:@"string %i", 2];
+ NSString *str3 = [NSString stringWithFormat:@"string %i", 3];
+ NSArray *array = [NSArray arrayWithObjects: str1, str2, str3, nil];
+ NSDictionary *dict = [NSDictionary dictionaryWithObjectsAndKeys:
+ str1, @"1",
+ str2, @"2",
+ str3, @"3",
+ nil];
+
+ id str_id = str1;
+ SEL sel = @selector(length);
+ [pool release];
+ return 0;
+}
More information about the lldb-commits
mailing list