iOS 获取调用栈信息
作者:
XPorter | 来源:发表于
2017-10-12 09:16 被阅读1001次#include <libkern/OSAtomic.h>
#include <execinfo.h>
void* callstack[128];
int frames = backtrace(callstack, 128);
char **strs = backtrace_symbols(callstack, frames);
int i;
NSMutableArray *backtrace = [NSMutableArray arrayWithCapacity:frames];
for (i = 0;i < 4;i++){
[backtrace addObject:[NSString stringWithUTF8String:strs[i]]];
}
free(strs);
NSLog(@"=====>>>>>堆栈<<<<<=====\n%@",backtrace);
本文标题: iOS 获取调用栈信息
本文链接:https://www.haomeiwen.com/subject/kygonttx.html
网友评论