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:
paulatto 2012-10-10 17:48:27 +00:00
parent 53bb2fb7d5
commit 7350275bd6
1 changed files with 5 additions and 2 deletions

View File

@ -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]);