我正在使用以下代码从我的iOS应用程序中获取崩溃报告:
void *frames[128];
int i,len = backtrace(frames, 128);
char **symbols = backtrace_symbols(frames,len);
NSMutableString *buffer = [[NSMutableString alloc] initWithCapacity:4096];
NSBundle *bundle = [NSBundle mainBundle];
[buffer appendFormat:@"PComp version %@ build %@\n\n",
[bundle objectForInfoDictionaryKey:@"CFBundleVersion"],
[bundle objectForInfoDictionaryKey:@"CIMBuildNumber"]];
[buffer appendString:@"Uncaught C++ Exception\n"];
[buffer appendString:@"Stack trace:\n\n"];
for (i = 0; i < len; ++i) {
[buffer appendFormat:@"%4d - %s\n",i,symbols[i]];
}
这只会提供有关当前线程的信息吗?我怎样才能获得所有线程的堆栈跟踪?