mirror of
https://gitee.com/acl-dev/acl.git
synced 2024-11-30 10:57:34 +08:00
9697f95b8f
This reverts commit 15d999759e
.
48 lines
620 B
C
48 lines
620 B
C
#include "lib_acl.h"
|
|
#include <execinfo.h>
|
|
#include <stdio.h>
|
|
#include <string.h>
|
|
#include "sigsegv.h"
|
|
|
|
static void stack3(void)
|
|
{
|
|
const char *file = "trace.txt";
|
|
void *buf[10];
|
|
size_t n, i;
|
|
char **s;
|
|
char *m = NULL;
|
|
|
|
acl_trace_save(file);
|
|
|
|
n = backtrace(buf, 10);
|
|
s = backtrace_symbols(buf, n);
|
|
|
|
for (i = 0; i < n; i++)
|
|
printf(">>%s\n", s[i]);
|
|
|
|
free(s);
|
|
strcpy(m, "hello");
|
|
}
|
|
|
|
static void stack2(void)
|
|
{
|
|
stack3();
|
|
}
|
|
|
|
static void stack1(void)
|
|
{
|
|
stack2();
|
|
}
|
|
|
|
static void trace(void)
|
|
{
|
|
stack1();
|
|
}
|
|
|
|
int main(void)
|
|
{
|
|
setup_sigsegv();
|
|
trace();
|
|
return (0);
|
|
}
|