#include <stdio.h>
#include <execinfo.h>
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<size; i++) {
printf("%d--->%s\n", i, symbols[i]);
}
return;
}
C 语言打印 trace
最新推荐文章于 2024-09-01 07:49:11 发布