Objective-C - 命令行 (clang) - 打印堆栈跟踪
我想打印
我正在使用 clang(自动引用计数)从命令行编译的
Objective-C 程序的堆栈跟踪我想知道以下内容:
- 编译时是否必须添加任何参数?
- 我是否需要添加任何代码来启动跟踪并打印跟踪?
下面给出的是一个示例程序,我必须为其打印堆栈跟踪:
#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);
}
用于编译的命令:
clang -fobjc-arc test.m -framework Foundation -o test
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)