mirror of
https://github.com/paboyle/Grid.git
synced 2025-04-10 22:20:45 +01:00
Exec info and linux check to stop non-portable code breaking
This commit is contained in:
parent
c2d96644a0
commit
3281745fde
11
lib/Init.cc
11
lib/Init.cc
@ -16,8 +16,9 @@
|
|||||||
#include <iterator>
|
#include <iterator>
|
||||||
|
|
||||||
#define __X86_64
|
#define __X86_64
|
||||||
#define EXECINFO
|
|
||||||
#ifdef EXECINFO
|
|
||||||
|
#ifdef HAVE_EXECINFO_H
|
||||||
#include <execinfo.h>
|
#include <execinfo.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -225,7 +226,9 @@ void Grid_sa_signal_handler(int sig,siginfo_t *si,void * ptr)
|
|||||||
printf(" mem address %llx\n",(unsigned long long)si->si_addr);
|
printf(" mem address %llx\n",(unsigned long long)si->si_addr);
|
||||||
printf(" code %d\n",si->si_code);
|
printf(" code %d\n",si->si_code);
|
||||||
|
|
||||||
#ifdef __X86_64
|
// Linux/Posix
|
||||||
|
#ifdef __linux__
|
||||||
|
// And x86 64bit
|
||||||
ucontext_t * uc= (ucontext_t *)ptr;
|
ucontext_t * uc= (ucontext_t *)ptr;
|
||||||
struct sigcontext *sc = (struct sigcontext *)&uc->uc_mcontext;
|
struct sigcontext *sc = (struct sigcontext *)&uc->uc_mcontext;
|
||||||
printf(" instruction %llx\n",(unsigned long long)sc->rip);
|
printf(" instruction %llx\n",(unsigned long long)sc->rip);
|
||||||
@ -251,7 +254,7 @@ void Grid_sa_signal_handler(int sig,siginfo_t *si,void * ptr)
|
|||||||
REG(r14);
|
REG(r14);
|
||||||
REG(r15);
|
REG(r15);
|
||||||
#endif
|
#endif
|
||||||
#ifdef EXECINFO
|
#ifdef HAVE_EXECINFO_H
|
||||||
int symbols = backtrace (Grid_backtrace_buffer,_NBACKTRACE);
|
int symbols = backtrace (Grid_backtrace_buffer,_NBACKTRACE);
|
||||||
char **strings = backtrace_symbols(Grid_backtrace_buffer,symbols);
|
char **strings = backtrace_symbols(Grid_backtrace_buffer,symbols);
|
||||||
for (int i = 0; i < symbols; i++){
|
for (int i = 0; i < symbols; i++){
|
||||||
|
Loading…
x
Reference in New Issue
Block a user