I would like to print the stack trace for my Objective-C program
I am compiling from the command line using clang (Automatic reference counting)
I would like to know the following:
- Do I have to add any parameters while compiling ?
- Do I have to add any code to start the trace and print the trace ?
Given below is a sample program for which I have to print the stack trace:
#import<Foundation/Foundation.h>
@interface Car : NSObject
@property (weak) NSNumber* doors;
@end
@implementation Car
@synthesize doors;
@end
int main()
{
system("clear");
Car *car1 = [[Car alloc] init];
NSNumber *d1 = [[NSNumber alloc] initWithInteger: 4];
//I want to start printing the stack trace from this point on
car1.doors = d1;
printf("---- end\n");
return(0);
}
Command used to compile:
clang -fobjc-arc test.m -framework Foundation -o test