I have found solution for Visual Studio Print n levels of callstack?推荐答案要以编程方式在运行时打印回溯,可以使用以下功能:To print a backtrace at runtime programmatically, you can use this function:#import <execinfo.h>void PrintBacktrace ( void ){ void *callstack[128]; int frameCount = backtrace(callstack, 128); char **frameStrings = backtrace_symbols(callstack, frameCount); if ( frameStrings != NULL ) { // Start with frame 1 because frame 0 is PrintBacktrace() for ( int i = 1; i < frameCount; i++ ) { printf("%s\n", frameStrings[i]); } free(frameStrings); }} 这篇关于在运行时打印调用堆栈(XCode)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
06-06 17:52