13static inline void callstack() {
15 sprintf(pid_buf,
"%d", getpid());
17 name_buf[readlink(
"/proc/self/exe", name_buf, 511)]=0;
18 prctl(PR_SET_PTRACER, PR_SET_PTRACER_ANY, 0, 0, 0);
19 int child_pid = fork();
22 execl(
"/usr/bin/gdb",
"gdb",
"--batch",
"-n",
"-ex",
"thread",
"-ex",
"bt", name_buf, pid_buf, NULL);
25 waitpid(child_pid,NULL,0);
29# define CALLSTACK() callstack()
#define __END_DECLS
Definition: c_decls.h:10
#define __BEGIN_DECLS
Definition: c_decls.h:9