mirror of https://gitlab.com/QEF/q-e.git
fixed to not include any header if -D__PTRACE is not set
git-svn-id: http://qeforge.qe-forge.org/svn/q-e/trunk/espresso@9511 c92efa57-630b-4861-b058-cf58834340f0
This commit is contained in:
parent
53bb2fb7d5
commit
7350275bd6
|
@ -2,22 +2,25 @@
|
|||
/*
|
||||
Print the stack trace
|
||||
*/
|
||||
#ifdef __PTRACE
|
||||
#include <execinfo.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
|
||||
void F77_FUNC(ptrace,PTRACE)(int *kilobytes)
|
||||
{
|
||||
#ifdef __PTRACE
|
||||
void *array[10];
|
||||
void *array[12];
|
||||
size_t size;
|
||||
char **strings;
|
||||
size_t i;
|
||||
|
||||
size = backtrace (array, 10);
|
||||
size = backtrace (array, 12);
|
||||
strings = backtrace_symbols (array, size);
|
||||
|
||||
printf ("Obtained %zd stack frames.\n", size);
|
||||
printf ("Use 'addr2line -e /where/is/code.x 0x12345' to get the source line number\n");
|
||||
|
||||
for (i = 0; i < size; i++)
|
||||
printf ("%s\n", strings[i]);
|
||||
|
|
Loading…
Reference in New Issue