C语言打印函数堆栈方法

代码如下

#include 
#include 

static void printStack(void)
{
	#define STACK_SIZE 32;
	void *trace[STACK_SIZE];
	size_t size = backtrace(trace, STACK_SIZE);
	char **symbols = (char **)backtrace_symbols(trace,size);
	size_t i = 0;
	for(; i%s\n", i, symbols[i]);
	}
	return;
}


你可能感兴趣的:(C语言打印函数堆栈方法)